|< Day Day Up >|
Recipe 10.3. Slimming a Stock 2.4 Kernel
$ uname -r 2.4.22
The prequisites are:
Unpack the new kernel sources into a folder in your home directory, such as ~/src:
$ tar xvjf linux-2.4.22.tar.bz2
All of the following commands are run from ~/src/linux-2.4.22:
$ make mrproper $ make menuconfig $ make dep $ make bzImage $ make modules $ su # make modules_install # cp ~/src/linux-2.4.22/arch/i386/boot/bzImage /boot/vmlinuz-2.4.22-new-kernel # cp ~/src/linux-2.4.22/System.map /boot/System.map-2.4.22-new-kernel
When you configure the kernel, keep in mind that you are starting from scratch, so you must explicitly enable every feature that you want. And you must make sure that features you do not want are not enabled. These are some core features that you definitely want:
When you're finished, add the new kernel to the bootoader, reboot, and enjoy. Remember to copy your new .config file to a directory outside of the build tree to preserve it.
This procedure configures the new kernel from scratch. make oldconfig doesn't work, because it does not let you change the old configuration; it only lets you add new things.
A typical base kernel runs around 1-3 MB (compressed), and the corresponding /lib/modules/$version runs around 10-30 MB. Some folks like to strip their kernels to the absolute bare essentials. On a server, especially one that is exposed to the Internet, it's a good security practice to keep it as lean as possible. But having a bit of fat on a desktop system or workstation isn't all that significant, and it may be convenient for future changes.
The name vmlinuz, according to lore, came about because the kernel on old Unix systems was vmunix. The vm stands for "virtual memory," to distinguish it from older kernels that did not have this feature. In your build tree, you'll see a vmlinux file. vmlinuz is the compressed version of this file. There's no need to be dull and stick with naming your kernels vmlinuz-$version. You can name them anything you like—kernel-mustard, kernel-panic, kernel-of-truth, fred-and-ginger . . . anything at all.
10.3.4 See Also
|< Day Day Up >|