Mainline Linux Kernel Configs

From Xen
Revision as of 14:11, 15 March 2012 by Anthony (talk | contribs) (remove two duplicates dom0 option)

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

To download it: [1]

or the latest from Linus Torvalds tree: 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:// 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

  1. 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.
  2. Enable these core options (Processor type and features| Paravirtualized guest support]
    • CONFIG_XEN=y
  3. And Xen pv console device support (Device Drivers|Character devices
  4. And Xen disk and network support (Device Drivers|Block devices and Device Drivers|Network device support)
  5. And the rest (Device Drivers|Xen driver support)
  6. And for tmem support:

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_ACPI_PROCFS=y (optional)

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:


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
 $ sudo apt-get install kernel-package fakeroot
 $ export CONCURRENCY_LEVEL=<number_of_cores +1>
 $ sudo make-kpkg clean
 $ sudo 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.
# Added these lines

Again this is the Ubuntu way, find a way for your particular distribution to do the same.