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 (41.17) contains over 1GB of memory but the supplied kernels limit to less than 1GB (NOHIGHMEM). Mint (41.43) 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 (41.42) 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 41. See Section 41.17.5 for an example of compiling kernel 2.4.16 with extra memory support (HIGHMEM) and multiple CPU support (SMP). See Section 41.32.3 for an example of obtaining the linux kernel source (kernel 2.4.19) directly and compiling it the Debian way for Bach (41.32). See Section 41.29.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 (41.29).
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.