GNU/Linux Desktop Survival Guide
by Graham Williams
Rolling Your Own
Compiling your own Linux kernel may sound like a pretty scary task. Take a deep breath and “enjoy the experience.” It is actually not such a big thing to compile your own kernel. And Debian makes it even more straightforward by supplying the kernel-package to leave you with a kernel-image package that you simply install, just as you would any kernel-image package you might get from Debian.
The advantages of compiling your own kernel include being able to tune the kernel to your specific hardware, and ending up with a smaller kernel. You may also need to compile your own kernel if the default kernel does not support some specific hardware you have. The distributed kernels though are becoming modular and it is becoming rare that you would need to compile your own kernel. If you do though, the recipe here should help and the introduction to compiling your own kernel at http://newbiedoc.sourceforge.net/tutorials/kernel-pkg/index-kernel-pkg.htmlshould prove a useful read.
The hardware we review in this book has occasionally required kernel compiles. For example, Bartok (42.16) contains over 1GB of memory but the supplied kernels limit to less than 1GB (NOHIGHMEM). Mint (42.42) had a specific kernel compiled for it with sound support through ALSA, IDE SCSI emulation support for CDRW, and with PPP and IPMASQ support. Velox (42.41) had a kernel compiled with sound support through ALSA, IDE SCSI emulation support for CDRW, and support for dual processors.
Some sample compiles of the kernel are included with specific installations in Section 42. See Section 42.16.5 for an example of compiling kernel 2.4.16 with extra memory support (HIGHMEM) and multiple CPU support (SMP). See Section 42.31.3 for an example of obtaining the linux kernel source (kernel 2.4.19) directly and compiling it the Debian way for Bach (42.31). See Section 42.28.3 for an example of obtaining the linux kernel source (kernel 2.4.19) and patching it with a pre-release (2.4.20-pre11) and compiling it the Debian way for Vivaldi (42.28).
Note that kernel version numbers interact with Debian's package management. By calling your own compiled kernel version 2:kayon.1 it will be a more recent version number than the standard Debian kernel-image package. That is, kernel-image-2.2.14_2:kayon.1_i386 is regarded as being more recent than kernel-image-2.2.14_2.2.14-1_i386. Thus, the packaging system will not try to install a more recent 2.2.14 over your own kernel image. Debian kernel packages always have the version number the same as the kernel version number.