This is a quick guide to building a custom 2.6 kernel, patching the kernel, and adding loadable kernel modules. You’ll find detailed recipes in Linux Cookbook(O’Reilly) in Chapter 10, “Patching, Customizing, and Upgrading Kernels,” and Chapter 12, “Managing the Bootloader and Multi-Booting,” which tells how to customize your GRUB or LILO boot menus for different kernels.
Why would you want to build a custom kernel? To add features or remove unnecessary features. On routers and firewalls, it adds a bit of security to use kernels that have had all the unnecessary features removed, and you can reduce the size considerably to fit on devices with limited storage.
Many distributions have their own distribution-specific tools for building kernels. You don’t need these for building vanilla kernels from kernel.org. But, it’s a different story when you’re using distribution-specific kernel sources. Red Hat and Fedora package theirs as source RPMs, so you can’t just build the kernel, but must also build an RPM. Fear not, for this appendix reveals how. Red Hat/Fedora kernels are heavily patched, to the point that a vanilla kernel may not even work, so you need to know the Red Hat Way of customizing kernels.
Debian, on the other hand, does very little modification to Linux kernels. They remove any bits that don’t meet their policies, and that’s all. So, vanilla kernels work fine on Debian systems.
You’ll need a build environment, ...