Debian Squeeze (or 6) is shipped with Linux kernel 2.6.32. However, back in November 2010, Phoronix announced a wonderful patch for the kernel which includes 200 lines of magic: they reduce the maximum latency by 10, and the average latency by 60. It is now integrated in the 2.6.38 kernel: we’ll see how to compile & install it on Debian.
First of all, you’ll need to install the following packages: fakeroot, kernel-package and the kernel source code.
1. Install the packages fakeroot, kernel-package and download the kernel source code.
2. Extract the kernel source code to /usr/src/.
3. Inside the kernel source code directory, open a terminal and type make xconfig to configure the kernel in a window or type make menuconfig (dependency: libncurses5-dev required) if you want a basic configuration menu in the terminal. The kernel default configuration works perfectly on my Debian PC, but you may want to configure it to suit your needs.
4. Once this is done, use make-kpkg clean to clean the source tree & reset the kernel-package parameters.
5. Compiling time! You must be the root user, so check twice before you do anything. Type fakeroot make-kpkg –initrd –revision=custom.1.0 kernel_image. You can change the “1.0” at will: it’s just used to keep track of your own kernel builds. Compiling takes a lot of time, i.e. 2-3 hours, so wait patiently.
6. We’ve now got an image of the kernel as a .deb package. Make sure you’re in the directory containing the image, and type dpkg -i linux-image-184.108.40.206-subarchitecture-custom.1.0_i386.deb. The subarchitecture part is an optional sub-architecture, such as “686”, depending on what kernel options you set; if you use the default configuration, just type dkpg -i linux-image-220.127.116.11-custom.1.0_i386.deb.
7. Reboot and see if you have any error messages (unlikely to happen).
8. (Optional) Make sure the kernel has been updated: type uname -r in a terminal, it should return 18.104.22.168.
Nota bene: I know backport packages have been released for the 2.6.38 kernel, but this will work with -any- kernel, so you don’t have to wait for backport packages when there aren’t.
There is another way to compile the kernel, which simply consists in using make deb-pkg in the kernel source code directory; this article only explains how to compile it the “Debian way”.
Last but not least, I am not responsible for any damage done to your computer. There’s no reason to have any problem except if you haven’t properly followed the steps.
Original article: Compiling a New Kernel — debian.org. Retrieved and shortened.