Custom Kernels on Debian
I’ve been running Debian on my laptop for the last two months. Some people were quite surprised about that since I’m such an Ubuntu religious nut and all, but I’ve always liked Debian and running it again have made me realise yet again just how awesome it is. I’ll probably install Ubuntu on it again for Unity. In my humble opinion Unity’s underlying technologies is better than what is used in Gnome Shell and it’s not available in Debian yet, but that’s a whole different blog post entirely.
An unnatural deep-seeded desire to run the latest and greatest
I haven’t bothered with custom kernels in a long time. I think the last time I ran a custom kernel on my own machine was in 2006. There was a time where I would just read kernel code and change random things just to see what would happen, I’m definitely not that brave anymore.
Today, while reading through the Ubuntu Alpha 2 release notes I noticed that it ships with kernel 2.6.38-rc2, and that it also contains the famous ‘200 line patch‘ that improves desktop performance on high loads. I wanted in on that, but the newest pre-built Debian kernels are on 2.6.37. I thought that I might as well see how much work it is to install a vanilla kernel these days, and as it turns out, it’s incredibly easy.
How it’s done
- Download a kernel tarball from kernel.org and put it in a new directory and extract
- Install the ‘kernel-package’ package
- If you’d like to make any modifications, do so and run ‘make-kpkg –initrd kernel_image’ (with sudo or fakeroot if you’re not root) in the root of the kernel source
- It will base the configuration on your running kernel and prompt for new features/drivers/etc. If you’re unsure or don’t care about a question, just press enter.
- After the process is complete, you’ll have a brand new kernel package one directory up. All you need to do is install it using “dpkg -i”. It will create an initramfs image and add it all to GRUB for you in the postinst scripts.
- Reboot to run the new kernel.
That was surprisingly easy. The kernel booted the first time and wi-fi/sound/video/suspend/etc works 100%. Even better, I get a package that I can recycle on other computers if I want and when Debian releases a newer kernel, then I can simply update using my favourite package management front-end.