How to compile Xen with custom Linux kernel

Each Xen distribution comes with a specific version of Linux kernel. Here I'm using Xen version 3.2.0, which comes with linux version 2.6.18.

An example of Xen 3.2.0 enabled linux distribution is SLES 10. However, the kernel version here for SLES 10 is Because of some tools that only work on this particular version of SLES kernel, I really needed to have Xen 3.2.0 compiled against it. Since I could not find a guide for compiling Xen with something other than its default linux kernel, I decided to write the steps down:

Setting up the environment

TODO: list tools needed here

- mercurial
- autoconf
- automake
- libc
- kernel source
- …

WARNING: Although most steps below refer to a 2.6.18 version, we are actually compiling version What happens is that the only way to trick Xen into believing we're compiling its default kernel is to create symbolic links to our directories using names that Xen is expecting. So do not forget to use the correct .config file (e.g., the one for version

  1. cd $HOME
  2. hg clone -r RELEASE-3.2.0
  3. cd xen-3.2-testing.hg
  4. ln -s /usr/src/linux- $HOME/xen-3.2-testing.hg/linux-2.6.18-xen.hg
  5. Modify $HOME/xen-3.2-testing.hg/buildconfigs/src.hg-clone to disable kernel 2.6.18 download (TODO paste file here)
  6. cd linux-2.6.18-xen.hg
  7. make mrproper (Otherwise Xen will complain, because it puts kernel objects on the build directory)
  8. mkdir $HOME/xen-3.2-testing.hg/build-linux-2.6.18-xen_x86_32 (that's the build directory)
  9. make O=$HOME/xen-3.2-testing.hg/build-linux-2.6.18-xen_x86_32/ mrproper
  10. Copy /boot/config- to build-linux-2.6.18-xen_x86_32/.config
  11. Edit .config CONFIG_LOCALVERSION to something different (e.g., xenpae-joana)
  12. make O=$HOME/xen-3.2-testing.hg/build-linux-2.6.18-xen_x86_32/ vmlinuz
  13. make xen
  14. make dist
  15. make install-xen
  16. make install-tools
  17. cd dist
  18. sh
  19. Edit /boot/grup/menu.lst and put Xen image files there
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License