HOWTO Deploy A Paravirtualized Xen Kernel

This HOWTO describes how to use one of the paravirtualized kernels we distribute here on the site. As an example we will be using linux-, which we want to deploy into a guest filesystem to give it paravirtualized capability.

Update: The HOWTO describes a Xen domU guest but it can be adapted for other virtualization schemes. For instance kernels can also be run under as KVM or VMWare guests, in which case the root device will be /dev/sda1 (for most emulated hardware) or /dev/vda1 (virtio).

Let's assume that the guest filesystem is mounted at /mnt/loop (in other words, /mnt/loop is the root of the guest filesystem)

# cp linux- /mnt/loop
# cd /mnt/loop
# tar -xf linux-

At this point there should be a kernel in /mnt/loop/boot and corresponding modules in /mnt/loop/lib/modules. Now we need to change other aspects of the guest filesystem to be compatible with the domU kernel. Important things to note is that the root device for the kernel is /dev/xvda1 and the default boot console is hvc0.

If you want to boot the domU kernel using pygrub or pvgrub you will need an entry in /boot/grub/grub.conf or /boot/grub/menu.lst inside the guest filesystem:

title vmlinuz-
root (hd0,0)
kernel /boot/vmlinuz- console=hvc0 root=/dev/xvda1 ro

For most distros it will be necessary to update /etc/fstab inside the guest filesystem:

/dev/xvda1        /             ext3     defaults,errors=remount-ro 0 0

Finally you need to define the hvc0 console, which will depend on what linux distribution you are installing to. Many distros use /etc/inittab to define consoles (refer to your distro's documentation; the below happens to work for OpenSuse but the details will probably be different for you):

hvc0:2345:respawn:/sbin/mingetty hvc0

Also add hvc0 to /etc/securetty inside the guest filesystem if you want to allow root logins on this console.

© 2010-2013 Stacklet LLC - Privacy