Mainline Linux Kernel Configs
Getting the current stable version
With v3.0 - how did dom0 support get there has technical details, but the summary is that the 3.0 is "With Linux 3.0 we now have the major components to be classified as a working initial domain aka dom0.". There are bugs, which are documented in Linux 3.0 and further bugs
Download it: [1] from Linus Torvalds tree: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Getting the current development version
The current day-to-day development is happening in a Konrad's git tree
The repository has numerous topic branches to track individual lines of development, and a couple of roll-up branches which contain everything merged together for easy compilation and running.
NOTE! All active git branches require at least Xen 4.0.1, using older version (4.0.0 or older) will cause problems, xend not starting, etc.
Current active branches are:
- linux-next - patches that are queued up
to go to Linus Torvalad's tree. This includes bug-fixes, new features, etc.
- testing (in Konrad's repository) is off patches being run/developed and obviously going through testing - which means they might not compile or work properly.
Downloading the git tree
$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen.git linux $ cd linux
that will automatically check out the 'origin/master' default branch. Note that you need at least 256 MB of free memory, otherwise the "git clone" will fail.
Changing the branch: You most probably want to use the "linux-next" (or "upstream/xen") branch, so do this:
$ cd /usr/src $ cd linux $ git reset --hard $ git checkout -b upstream/xen origin/upstream/xen Branch upstream/xen set up to track remote branch refs/remotes/origin/upstream/xen Switched to a new branch "upstream/xen" $ git pull $ git log | less
(or replace "origin/upstream/xen" with "testing" for example)
Later when you want to update the tree use:
$ cd linux $ make clean $ git pull
Configuring the kernel
Configure as normal; you can start with your current .config file or use make defconfig and then depending on what you want your kernel to do (it can do both):
make menuconfig
NOTE0: Make sure you have correct CPU type (Processor Family) set in the kernel configuration, Xen Dom0 options won't show up at all if you have too old CPU selected (too old means a CPU that doesn't support PAE; Pentium Pro was the first CPU to have PAE).
NOTE1: If you're building 32 bit version of the kernel, you first need to enable PAE support, since Xen only supports 32 bit PAE kernels nowadays. Xen kernel build options won't show up at all before you've enabled PAE for 32 bit builds (Processor type and features -> High Memory Support (64GB) -> PAE (Physical Address Extension) Support). PAE is not needed for 64 bit kernels.
Configure kernel for domU support
- If building 32 bit kernel make sure you have CONFIG_X86_PAE enabled (which is set by selecting CONFIG_HIGHMEM64G)
- non-PAE mode doesn't work in 2.6.25, and has been dropped altogether from 2.6.26 and newer kernel versions.
- Enable these core options (Processor type and features| Paravirtualized guest support]
- CONFIG_PARAVIRT=y
- CONFIG_XEN=y
- CONFIG_PARAVIRT_GUEST=y
- CONFIG_PARAVIRT_SPINLOCKS=y
- And Xen pv console device support (Device Drivers|Character devices
- CONFIG_HVC_DRIVER=y
- CONFIG_HVC_XEN=y
- And Xen disk and network support (Device Drivers|Block devices and Device Drivers|Network device support)
- CONFIG_XEN_FBDEV_FRONTEND=y
- CONFIG_XEN_BLKDEV_FRONTEND=y
- CONFIG_XEN_NETDEV_FRONTEND=y
- And the rest (Device Drivers|Xen driver support)
- CONFIG_XEN_PCIDEV_FRONTEND=y
- CONFIG_INPUT_XEN_KBDDEV_FRONTEND=y
- CONFIG_XEN_FBDEV_FRONTEND=y
- CONFIG_XEN_XENBUS_FRONTEND=y
- CONFIG_XEN_SAVE_RESTORE=y
- CONFIG_XEN_GRANT_DEV_ALLOC=m
- And for tmem support:
- CONFIG_XEN_TMEM=y
- CONFIG_CLEANCACHE=y
- CONFIG_FRONTSWAP=y
- CONFIG_XEN_SELFBALLOONING=y
Configure kernel for dom0 support
NOTE: Xen dom0 support depends on ACPI support. Make sure you enable ACPI support or you won't see Dom0 options at all.
In addition to the config options above you also need to enable:
- CONFIG_X86_IO_APIC=y
- CONFIG_ACPI=y
- CONFIG_ACPI_PROCFS=y (optional)
- CONFIG_XEN_DOM0=y
- CONFIG_PCI_XEN=y
- CONFIG_XEN_DEV_EVTCHN=y
- CONFIG_XENFS=y
- CONFIG_XEN_COMPAT_XENFS=y
- CONFIG_XEN_SYS_HYPERVISOR=y
- CONFIG_XEN_GNTDEV=y
- CONFIG_XEN_BACKEND=y
- CONFIG_XEN_NETDEV_BACKEND=m
- CONFIG_XEN_BLKDEV_BACKEND=m
- CONFIG_XEN_PCIDEV_BACKEND=m
- CONFIG_XEN_PRIVILEGED_GUEST=y
- CONFIG_XEN_BALLOON=y
- CONFIG_XEN_SCRUB_PAGES=y
If you're using RHEL5 or CentOS5 as a dom0 (ie. you have old udev version), make sure you enable the following options as well:
- CONFIG_SYSFS_DEPRECATED=y
- CONFIG_SYSFS_DEPRECATED_V2=y
For more current Xen related config options check the example .config files from the troubleshooting section, and check the 2.6.18-to-2.6.31-and-higher wiki page.
Building the kernel
There are two parts when building Xen: Xen and the Kernel. After Kernel configuration you have to do two things, build the kernel and build the ramdrive.
This is the Ubuntu way:
$ cd /usr/src/linux $ sudo make -j <number_of_cores +1> $ sudo apt-get install kernel-package fakeroot $ sudo CONCURRENCY_LEVEL=<number_of_cores +1> make-kpkg clean $ sudo CONCURRENCY_LEVEL=<number_of_cores +1> fakeroot make-kpkg --initrd --append-to-version=-pv kernel-image kernel-headers $ sudo dpkg -i ../<linux-image-3.0.XXX.deb>
The first line will make the kernel with the hidden configuration file (your file hopefully). You might have to do this several times because you will encounter errors that will requiere turning modules off, and start compiling again. It is a good plactice to use make clean when you change many modules at a time. The next line is used for dpkg but is not really that important. the sudo fakeroot line will create your ramdrive needed to boot. This is the debian way of making the image usable this will event copy it to boot but will not update grub.
The old-skool way:
cd linux make clean cp -a .config .config-old make oldconfig make menuconfig (if you need to change something) make bzImage make modules make modules_install # in the following lines replace "version" with the actual kernel version you're compiling. make install # And then generate initrd/initramfs image for your dom0 kernel, example for Fedora/RHEL/CentOS: mkinitrd -f /boot/initrd-version.img version # For Fedora Core the 'make install' does it automatically
Update modules
You need to update some new modules that your newly created kernel requires with XEN. Please note that often a monholitic kernel is a wise choice as it doesn't necessarilly requires initrd.
$ sudo vim /etc/modules # /etc/modules: kernel modules to load at boot time. # # This file contains the names of kernel modules that should be loaded # at boot time, one per line. Lines beginning with "#" are ignored. lp rtc # Added these lines xen-evtchn xen-gntdev xen-netback xen-blkback xenfs blktap
Again this is the Ubuntu way, find a way for your particular distribution to do the same.