Setting Up Configuration Menus
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.
Kernel RPM Packages
Chapter 10.
Package | Description |
---|---|
binutils-* | Required binary utilities |
cpp-* | A GNU C language preprocessor |
gcc-* | The C language compiler |
glibc-devel-* | For developing programs (such as the kernel) that require C language libraries |
glibc-kernheaders-* | Kernel C language header files |
kernel-source-* | Kernel source files |
ncurses-* | A language library for presenting graphics on a terminal; required for make menuconfig |
ncurses-devel-* | Header files for ncurses screens |
tcl-* | TCL scripting language; designed for use with TK; required for make xconfig |
tk-* | Widgets for GUIs designed to work with TCL; required for make xconfig |
Tip | 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.
Make Menus
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.
Tip | 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:
make config
make menuconfig
make xconfig
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.
Why a Menu?
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.
Tip | 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.
make config
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.

Figure 12.5: The make config process
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.
make menuconfig
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.

Figure 12.6: The make menuconfig main menu
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.

Figure 12.7: The Wireless LAN kernel menu
Note | 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.
make xconfig
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.

Figure 12.8: The Linux Kernel Configuration menu
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.