How to install a custom kernel

We'd like to give an example on how to compile your own kernel and install it on the OMF baseline image. We are assuming that the machine you compile the kernel on and the nodes you want to install it on both run Ubuntu.

Preparation

Building the kernel

  • download the kernel source, e.g. wget http://mirror.aarnet.edu.au/pub/ftp.kernel.org/linux/kernel/v2.6/linux-2.6.32.tar.bz2
  • unpack it: tar xjf linux-2.6.32.tar.bz2
  • apply some patches (optional): cd linux-2.6.32; patch -p1 < ../patch-avdeyev.1-combined; cd ..
  • insert a configuration file (optional): cp kernel-2.6.32-i686.config.ovz linux-2.6.32/.config
  • to check or modify your kernel configuration, install some dependencies: sudo apt-get install libncurses5 libncurses5-dev. Then cd linux-2.6.32 and run make menuconfig
  • to make use of multiple CPU cores during kernel compilation, run export CONCURRENCY_LEVEL=5. The number should be twice the number of CPU cores you have +1.
  • to build the kernel package, run fakeroot make-kpkg --initrd --append-to-version=-openvz-omf kernel-image kernel-headers

Installation on the node

  • use omf load to put a fresh baseline image onto one of your nodes
  • copy the two .deb packages (in our example linux-headers-2.6.32.12-openvz-omf_2.6.32.12-openvz-omf-10.00.Custom_i386.deb and linux-image-2.6.32.12-openvz-omf_2.6.32.12-openvz-omf-10.00.Custom_i386.deb) to the node
  • on the node run dpkg -i linux-headers-2.6.32.12-openvz-omf_2.6.32.12-openvz-omf-10.00.Custom_i386.deb linux-image-2.6.32.12-openvz-omf_2.6.32.12-openvz-omf-10.00.Custom_i386.deb
  • have a look at your /boot/grub/grub.cfg. After the line "### BEGIN /etc/grub.d/10_linux ###" it should list your freshly installed kernel. If it is not on top of the list, edit the line "set default="0"" to 1 to boot the second entry, 2 to boot the third entry and so on. To make the default value permanent, edit /etc/default/grub and set "GRUB_DEFAULT=" in there. You need to run update-grub to generate a new grub.cfg.
  • reboot the node. It should come back running your new kernel. If it doesn't, connect a screen to see why it's not booting.

Additional drivers

  • you might need drivers that are not part of the kernel that you installed, such as the "madwifi" driver. The easiest way to install them onto your baseline image is to copy the driver source to the node and compile it there. The kernel headers are installed under /usr/src. The driver should find these headers automatically. Just "make; make install" the drivers and then try to load them using modprobe.