- Introduction
- Things You'll Need
- Kernel Configuration
- Building the Kernel
- In Case of Emergency...
- Conclusion
Kernel Configuration
Here's a summary of the steps:
make mrproper.
make xconfig (or make menuconfig).
Load the saved config file, if you have one.
make dep.
make bzImage.
make modules.
make modules_install.
Copy arch/architecture/boot/bzImage to /boot/bzImage.name.
Configure the bootloader.
The master configuration for your kernel is stored in /usr/src/version/.config. This file is created by the config process you'll run, and it's a good idea to copy it somewhere else in case you need to build another kernel with minor changes later on. A number of configuration templates are provided with the kernel source; they're located in the configs directory. These templates can be used as a starting point for creating your own kernel.
Before configuring your kernel, clean up your source directory:
[root@heinz linux-2.4.20-8]# make mrproper
The make mrproper command cleans up any leftover files from previous kernel builds in your source directory.
NOTE
It also wipes out any .config files in your source directory.
Next, you need to name your kernel by editing the Makefile, located in your source directory. The first four lines of the Makefile define the kernel version:
VERSION = 2 PATCHLEVEL = 4 SUBLEVEL = 20 EXTRAVERSION = -8
Just change the EXTRAVERSION entry to a unique identifier for the kernel you're building:
EXTRAVERSION = -oct-03
This identifier will show up in your boot menu, and will also define a unique module directory for the kernel.
Now you're ready to configure the kernel. There are a number of interface choices, and the README file provides a full list. The most important ones to know are menuconfig (text-based, as shown in Figure 2) and xconfig (X11-based, as shown in Figure 3). The xconfig interface is much easier to work with, and I wouldn't recommend using menuconfig unless your system lacks X11 support. Here's the syntax:
[root@heinz linux-2.4.20-8]# make xconfig
or
[root@heinz linux-2.4.20-8]# make menuconfig
Figure 2 The menuconfig interface.
Figure 3 The xconfig interface.
The configuration interface presents an exhaustive list of options. For each option, three choices are available:
Yes. Support will be compiled directly into the kernel.
Module. Support will be provided via a loadable kernel module.
No. Support is not included.
NOTE
Loadable kernel modules offer a way for drivers to be loaded dynamically into the kernel. Loading drivers only if needed keeps the overall size of the kernel to a minimum. If you want to leave the door open for hardware upgrades in the future, include modules for anything you might be adding to the system.
As you start to drill down into the individual categories, you may find the choices a bit overwhelming. The xconfig interface really helps out here, as there's a help option for almost every choice. Knowing the hardware in your system will simplify the process as well. After you've made all your choices, click the Save button to store everything in the .config file (located in your source directory), and exit the configuration tool. If you're storing copies of your .config files in another location, don't forget to copy the new one over.