Using a kernel.org kernel under xen

From PrgmrWiki

first, download the kernel source you prefer:

wget http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.29.3.tar.bz2

next, install the packages normally required to build the kernel (this example is for Debian, it should be easy enough to find out what packages your favorite distro needs to build the kernel.)

apt-get install  build-essential libncurses5-dev 

untar and configure the kernel.Personally, I like menuconfig, but that's just taste. The required kernel options for a xen guest kernel are documented at the Xen wiki here: http://wiki.xen.org/wiki/Mainline_Linux_Kernel_Configs#Configure_kernel_for_domU_support.

 tar -jxf linux-2.6.29.3.tar.bz2 
 cd linux-2.6.29.3
 make menuconfig
       -> Processor type and features                                      
         -> Paravirtualized guest support 
           -> XEN 

and don't forget your network driver

  -> Device Drivers                                                  
       -> Network device support
              -> XEN_NETDEV_FRONTEND

and your disk driver

-> Device Drivers                                                
     -> Block devices 
           -> XEN_BLKDEV_FRONTEND

and xenfs is sometimes useful (allows you to access the xenbus)

       -> Device Drivers                                                 
               -> XENFS

Personally, I leave out the balloon driver. Ram is cheap, and if you are running this on a VPS, well, most Xen VPS providers sell you dedicated ram, so if they are honest, they won't be ballooning ram away from you. (I suppose a provider could start everyone off with a large max mem and then set mem= to what you are paying for, then do instant ram upgrades without a reboot, but prgmr.com doesn't do that right now and I don't know of anyone who does.)

then customize 'till your hearts content. Remember, you can remove support for just about all hardware now.

now, make the kernel as usual.

make -j4 ; make install modules_install

make your initrd as per debian (or whatever distro you are running)

 mkinitramfs -o /boot/initrd-2.6.29.3.img 2.6.29.3


setup grub as you would normally.


title kernel.org paravirt DomU
  root (hd0,0)
  kernel /boot/vmlinuz-2.6.29.3  root=LABEL=PRGMRDISK1 ro
  initrd /boot/initrd-2.6.29.3.img

also, note that your console will be hvc0. if you are on redhat or anyone who uses a different value, you probably want to start a getty on hvc0.


 shutdown -h now


log into your prgmr menu, and press '2' for start/create. Wait for 2 seconds for it to fall through to 'user DomU bootloader' then when you see your pvgrub menu, choose the title you set above. In my case:



    GNU GRUB  version 0.97  (16777216K lower / 0K upper memory)

 +-------------------------------------------------------------------------+
 | Debian lenny                                                            |  
 | Debian lenny single user                                                |
 | kernel.org paravirt DomU                                                |
 |                                                                         |
 |                                                                         |
 |                                                                         |
 |                                                                         |
 |                                                                         |
 |                                                                         |
 |                                                                         |
 |                                                                         |
 |                                                                         |  
 +-------------------------------------------------------------------------+
    Use the ^ and v keys to select which entry is highlighted.
    Press enter to boot the selected OS, 'e' to edit the
    commands before booting, or 'c' for a command-line.

choose the kernel.org paravirt DomU and you are done.

rcs:~# uname -a
Linux rcs.xen.prgmr.com 2.6.29.3 #1 SMP Tue May 12 06:32:52 UTC 2009 x86_64 GNU/Linux