Before we into the installation and configuration of the virtual machine, we should explain some basic terms that are quite common in the world of Xen.
Xen comes with extensive
Installing the Xen hypervisor under Gentoo is a breeze, as usually :). The following will install both the hypervisor and a userspace management tools:
# emerge app-emulation/xen
As Xen requires a modified kernel, at least for domain0, you'll have to install
patched kernel sources, unless you choose to manage them manually. It's
generally not a good idea, so we suggest just plain old boring installation of
the
# emerge sys-kernel/xen-sources
If you choose to configure and build the kernel yourself (which isn't a bad idea
at all), you'll notice some differences from the
As Xen requires each domain to have its own kernel image loaded into memory, you usually want to strip the domU kernels to the bare minimum that's required for a proper function. Unlike the dom0 which is generally responsible for tasks like I/O to hard drives, networking stuff and graphics output, the domUs don't require to worry about your HW devices at all. There's simply no need to include a driver for your SCSI controller into domU kernel as it's already handled by dom0.
As we have installed only one kernel source package, we'll have to create a
directory where the different kernels are to be built. Let's start with the
dom0. Please substitute
# mkdir -p ~/xen-build/2.6.16.28-dom0
Now you should configure the kernel for dom0. Please note that there are some differences from the general kernel config and don't forget to customize the examples according to your needs, especially with regard to kernel versions and file paths.
# cd /usr/src/linux-2.6.16.28-xen # make O=~/xen-build/2.6.16.28-dom0 menuconfig
Here are the most importand Xen-related settings that should take care about:
General setup ---> Local version - append to kernel release(It's a good idea to set it to "-dom0" in order to distinguish between the dom0 and domU kernel images) Processor type and features ---> Subarchitecture Type (Set to "Xen-compatible" ) XEN ---> [*] Privileged Guest (domain 0) <*> PCI device backend driver <*> Block-device backend driver(You usually want your domUs to be able to access some kind of storage :) ) <*> Network-device backend driver <*> Network-device loopback driver < > TPM-device backend driver < > Block-device frontend driver < > Network-device frontend driver < > Block device tap driver < > TPM-device frontend driver [*] Scrub memory before freeing it to Xen [*] Disable serial port drivers <*> Export Xen attributes in sysfsFIXME: add a blurb about various config options and their meaning
Now thaty you've configured your dom0 kernel, it's time to build it. Standard
# make O=~/xen-build/2.6.16.28-dom0(Only if you've included module support:) # make O=~/xen-build/2.6.16.28-dom0 modules modules_install
Now let's install your dom0 kernel image to the
# cp ~/xen-build/2.6.16.28-dom0/vmlinuz /boot/linux-2.6.16.28-xen0-vmlinuz
(Please make sure you include the correct names of the Xen and kernel images:) # Example Xen settings for Grub title=Xen-3.0.2, Linux 2.6.16.28 kernel /boot/xen-3.0.2.gz dom0_mem=64M module /boot/linux-2.6.16.28-xen0-vmlinuz <<your-regular-kernel-options-go-here>>
After you've double-checked that everything at least seems to be okay and/or that you have console access to the box being Xenized, try to reboot it. If it comes back up, chances are that you can proceed with the real joy, creating virtual domains.
TODO