Recently I started the process of upgrading all deployed server instances of Ubuntu to the latest LTS release Hardy Heron or Ubuntu 8.04. For the most part the transition was fairly smooth,however several Xen guest images that are deployed on a Dell PowerEdge 1950 virtual server has been plagued with kernel panics. In attempting to solve this issue I thought I would also use the time to learn the Debian way of building kernel packages. The process itself is fairly straight forward and might convince me to stop rolling vanilla kernel builds manually. For future reference,I captured the steps below.
There are several sites (like here and here) out there that contain more instructions and the full background on the process. Here are the steps I followed to build new deb packages for those that just want the steps and minimal direction.
- Update the system
- Install the needed packages
- Download an appropriate kernel from kernel.org. For this example it is Linux Kernel 2.6.26
- Remove any old link to /usr/src/linux that may exist.
- Unpack the kernel downloaded previously
- Create a new link to the unpacked source code
- Pull in the current kernel configuration into the new source tree
- Let the kernel pull in the new configuration values available in the kernel into the old configuration file
- If you need to change or alter configuration values,run the kernel console menu configuration program
- Use the Debian tools to build new deb packages. Instead of uname -m,you may substitute other text to help identify your kernel.
- If all goes well,you can now install the resulting debian packages.
- You can now reboot and try the new kernel out. If something fails,you can always revert back to your older kernel using the GRUB menu at boot.
sudo aptitude update
sudo aptitude safe-upgrade
sudo aptitude install gcc kernel-package libc6-dev libncurses-dev fakeroot build-essential
wget -c http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.26.tar.bz2
rm -f /usr/src/linux
cd /usr/src &&tar xfj /path/you_downloaded_file/into/linux-2.6.26.tar.bz2
ln -s /usr/src/linux-2.6.26 /usr/src/linux
cp /boot/config-`uname -r` /usr/src/linux/.config
cd /usr/src/linux &&make oldconfig
cd /usr/src/linux &&make menuconfig
make-kpkg clean
make-kpkg -initrd -revision=`uname -m` kernel_image kernel_headers modules_image
cd /usr/src &&dpkg -i linux*2.6.26*.deb
update-grub &&reboot