If you re going to customize your kernel in any way, you need a configuration menu. Different menus are available in text, terminal graphics, and GUI formats. Each of these menus requires a series of packages: the source code and language libraries for the kernel, and language libraries for graphical configuration screens.
Several RPMs associated with building a kernel are available, as shown in Table 12.3. Some provide the source code; others are related to languages and libraries needed to configure and process the kernel. Install them using the rpm command described in Chapter 10 .
Required binary utilities
A GNU C language preprocessor
The C language compiler
glibc- devel -*
For developing programs (such as the kernel) that require C language libraries
Kernel C language header files
Kernel source files
A language library for presenting graphics on a terminal; required for make menuconfig
Header files for ncurses screens
TCL scripting language; designed for use with TK; required for make xconfig
Widgets for GUIs designed to work with TCL; required for make xconfig
If you get a Failed dependencies message related to kernel-headers , install the glibc-kernheaders-* RPM package. Many dependencies explicitly cite the RPM package that you need. Dependencies related to kernel-headers do not.
If you re reconfiguring an existing kernel, you don t need to install the kernel- x . cputype .rpm package. You ll actually be creating a new kernel from some of the other packages when you compile it later in this chapter.
If you re willing to customize your kernel in text mode, you don t need the ncurses* or tcl-* or tk-* RPM packages. But a kernel contains a huge number of settings that you can customize, which makes the graphical kernel configuration screens a terrific convenience. You ll see this for yourself in the following section.
Now that you have the right RPM packages installed, it s time to examine the three different menus available for customizing your kernel. Start by navigating to the directory with your Linux kernel s source files, /usr/src/linux- versionnumber . For convenience, we ll call it the /usr/src/linux- x directory for the rest of this chapter.
By default, Red Hat Linux links the /usr/src/linux-2.4 directory to the default source code directory for your original kernel.
You ll find a Makefile in /usr/src/linux- x that lets you configure your kernel. That file includes three different kernel configuration tools:
We introduce these tools briefly in the following sections. Then we ll use make xconfig to analyze what you can configure in your kernel in detail.
Before moving on, navigate to the /usr/src/linux- x directory on your computer. The make commands shown won t work unless you re in that directory.
You can edit your configuration file directly. As described earlier, your first kernel configuration is documented in the config- x file, in your /boot directory. This file includes all kinds of settings, such as:
CONFIG_MODULES=y CONFIG_3C359=m # CONFIG_IRDA_DEBUG is not set
In other words, the CONFIG_MODULES setting, which lets your kernel use modular drivers, are integrated into the kernel. The CONFIG_3C359=m command makes this particular network card driver into a module; when Red Hat detects this card, it will be able to use the insmod command (see Chapter 11 ) to use this driver. Unused elements such as CONFIG_IRDA_DEBUG are left out of the kernel and modules; the hash mark (#) turns it into a comment, and your kernel ignores the line.
When you re done, you should save the file to .config in the /usr/src/linux- x directory. Then you ll be ready to compile and install your kernel, as described later in this chapter.
If you ve recompiled your kernel before, the settings are normally saved in the /usr/src/linux-x/.config file. One previous revision is saved in /usr/src/linux-x/.config.old . Nevertheless, this is a good time to back up your .config file to another directory.
But because this file contains about 2000 lines, analyzing each line can be a time-consuming process. For that reason, three kernel tools are available to help.
When you re in the /usr/src/linux- x directory, the make config command starts a kernel configuration tool. It prompts you with a series of questions, as shown in Figure 12.5.
It starts by looking for a .config file in your /usr/src/linux- x directory. If that file does not exist, it uses uname -p to identify your CPU and find the corresponding file in the /usr/src/linux- x / configs directory. The settings in the selected file become your default values.
Alternatively, if you re modifying your kernel for the first time, you can use the installed configuration in /boot/config- x , where x represents the kernel version number. Copy it to /usr/src/linux- x / .config with the following command:
# cp /boot/config- x /usr/src/linux- x /.config
Next , you get a bunch of questions. For each question, you have up to four options. Y and N are straightforward. In many cases, you can select M , which makes the relevant driver module available in a file. And if you enter ? , you open a help file related to the question.
But you need to answer hundreds of questions. If you just have to change the setting for the 366th question, you might miss it. If you pass a question, there is no way to go back. You just have to press Ctrl+C and start the process again. For this reason, the other two make menu options are more popular.
When you re in the /usr/src/linux- x directory, the make menuconfig command should give you a low-resolution graphical menu. As long as you have the ncurses* RPM packages installed, as described earlier, you should see a menu similar to Figure 12.6.
Like make config , this option looks for a .config file in the /usr/src/linux- x directory. If it does not exist, it uses the *.config file customized for your CPU in the /usr/src/linux- x /configs directory.
As you can see, kernel settings are organized into menus. You can highlight a setting and select Help at any time. Unfortunately, help is not available for every variable.
Highlight a menu option and press Enter to review detailed configuration options; for example, Figure 12.7 illustrates some available Wireless LAN devices. As you can see, some are available modules, while others are built into the kernel.
You can run make menuconfig on a Telnet or SSH connection from a remote computer. Depending on your point of view, this may be a convenience or a security risk. More information on Telnet and SSH is available in Chapter 23 .
As you can see, many other menus are available through make menuconfig . We illustrate these options in detail in the next section, since the make xconfig menus are easier to read in a book.
When you exit out of make menuconfig , you get a chance to save your new configuration. If you answer yes, this tool writes your new kernel configuration to /usr/src/linux- x /.config .
When you re in the /usr/src/linux- x directory and a GUI, the make xconfig command should give you a high-resolution graphical menu. As long as you have the tcl-* and tk-* RPM packages installed, you should see a menu similar to Figure 12.8.
Like make config , this option looks for a .config file in the /usr/src/linux- x directory. If it does not exist, it uses the *.config file customized for your CPU in the /usr/src/linux- x /configs directory. If you want to start with a different configuration file, the two buttons in the lower-right corner can help.
As you can see, different kernel settings are organized into different sections. We ll look at these sections in much more detail later in this chapter. When you re happy with your changes, click Save And Exit; otherwise , click Quit Without Saving.