Xen 3.0 from sources (08-26-2006)

Edited Sat, 26 Aug 2006 14:03

This is how i installed a Debian VM on my Ubuntu Dapper through Xen:

  • Ubuntu Dapper (host)
  • Debian Sarge (guest)
  • Xen (3.0.2-2)
  • Linux 2.6.16
  • NVidia Driver 8774 (also worked with rev. 8762)
Edited Fri, 25 Aug 2006 23:34

Download and untar the sources (not the binaries) here.

cd xen-3.0.2-2/

Modify the Makefile in order to build two different kernels, one for the Domain 0, the other for the Users Domains (the guest(s) OSes) (Note: the naming syntax is significative)

# replace this line 
KERNELS ?= linux-2.6-xen
# by this one
KERNELS=linux-2.6-xen0 linux-2.6-xenU

Download the kernel tarball and compile all

make world
make install

These commands will download, build and install, the kernel and tools. Let it happens even if you want to build your kernels by yourself, we will make some changes in the configs before rebuilding them. However, if your system already has the Xen tools don't execute the last command, you don't need it.

Currently there must be two disctincts directories:

drwxrwxrwx 20 root  root      1624 Aug 22 01:56 linux-2.6.16-xen0/
drwxrwxrwx 20 root  root      1576 Aug 22 02:22 linux-2.6.16-xenU/

Note: if we hadn't made these modifications in the Makefile instead of the previous directories we would have had:

# Used both as xenU and xen0
drwxrwxrwx 19 root  root       888 Aug 22 01:14 linux-2.6.16-xen/
Edited Sat, 26 Aug 2006 14:06
make linux-2.6-xen0-config CONFIGMODE=xconfig

When you issue this command it automatically generates a kernel config from buildconfigs/linux-defconfig_xen0_x86_32 (according to your architecture).

The 'XEN' section becomes accessible once you checked-in 'xen-compatible' in the section 'processor type and features'.

However, you may want use a different base config like that of your distribution, go donwload the sources, and search for the config file.

# depending on your processor
cp buildconfigs/linux-defconfig_xen_x86_32 linux-2.6.16-xen0/.config
cd linux-2.6.16-xen0

# config it
make xconfig
cd ..

# if you want to install the NVidia driver jump to the next section,
# patch xen-sparse, then jump back here.

# build and install
make linux-2.6-xen0-build
make linux-2.6-xen0-install

# Installation destinations
/lib/modules/2.6.16-xen0/
/boot/*xen0

# initrd (if needed)
cd /boot
mkinitramfs -o initrd.img-2.6.16-xen0 2.6.16-xen0

This is what is appended to menu.lst (part of the section not automatically generated):

title           Xen 3.0 / XenLinux 2.6
kernel          /boot/xen-3.gz
module          /boot/vmlinuz-2.6-xen0 root=/dev/sda5 ro
module          /boot/initrd.img-2.6.16-xen0

NVidia Graphical Device Driver:

By default, you can use the open driver 'nv' (just replace 'nvidia' by 'nv' in the driver section and don't load the "glx" module), the drawback is that you must switch your xorg.conf confs each times you reboot from your main kernel to your xen kernel, this can be very annoying.

The NVidia driver is not natively suppported by Xen nor Xen isn't yet supported by NVidia (at least until to the revision 8774), but luckily there is a workaround which works and permits to install it, follow this thread (when it refers to xen you must understand xen0, patch xen-sparse, build the kernel, patch and compile the nvidia kernel module, copy it in /lib/modules/...).

Edited Fri, 01 Sep 2006 10:01

The default guest kernel (the one compiled with make world/install) should be right enough to be used without changes, but if like me you want to be sure that the processor type or anything else are appropriately selected, you want rebuild xenU by following these steps:

# Note: all the physical devices are meaningless for xenU, corresponding 
#       sections are left out unchecked.
make linux-2.6-xenU-config CONFIGMODE=xconfig
make linux-2.6-xenU-build
make linux-2.6-xenU-install

# Installation destinations
/lib/modules/2.6.16-xenU/
/boot/*xenU

# Note: xenU is lighter than xen0
-rw-r--r--  1 root root 1505400 Aug 22 01:56 vmlinuz-2.6.16-xen0
-rw-r--r--  1 root root 1220491 Aug 22 02:22 vmlinuz-2.6.16-xenU

If the fs is ext3, you don't need to provide an initrd.

Edited Fri, 25 Aug 2006 23:29

For the remaining steps of the installation, you must follow this howto except you need to deboostrap a Debian OS like here or here, and the paths to the kernels of the user domains confs in /etc/xen/ are paths to the user domain kernel /boot/vmlinuz-2.6.16-xenU.

Note: on my first boot i've had this problem, the solution worked fine for me, until i tried to use ssh (ssh needs to open /dev/tty) so i undoed the changes in /etc/inittab, i rebooted, then everything was ok...

sebastien |dot| martini |at| gmail |dot| com