Kernel Configuration

To be able to build kernels, you obviously need the kernel source package (called kernel-source) installed. In addition, you need gcc, make, and a number of other packages. One of the SUSE installation package set options is "Kernel development"; if you have installed that selection, you have everything you need.

If you want to base your kernel configuration on the currently running kernel, you have more than one way to begin.

The configuration of the kernel that is actually running is always available in / proc/config .gz, which is a gzipped "virtual" file in the /proc filesystem, which is created in memory on the fly by the running kernel (see Listing 27-1).

Listing 27-1: Looking at the Configuration of the Running Kernel [email protected]: /proc # zcat config.gz | more #

# Automatically generated make config: don't edit

CONFIG_X86=y CONFIG_MMU=y CONFIG_UID16=y

CONFIG_GENERIC_ISA_DMA=y #

# Code maturity level options

CONFIG_EXPERIMENTAL=y CONFIG_CLEAN_COMPILE=y # CONFIG_STANDALONE is not set CONFIG_BROKEN_ON_SMP=y

# General setup

It is instructive to page through this file and look at the various options in it that refer to the hardware, filesystems, and so on that are to be supported by the kernel.

♦ The =y at the end of lines means that the support for the relevant item is compiled into the kernel.

♦ Lines ending is not set clearly imply that the support is not included.

♦ Lines ending =m imply that the support is provided by a loadable kernel module rather than being compiled into the kernel itself. SUSE provides most functionality in the form of modules.

In a newly installed system, you should find that /usr/src/linux/.config is identical to

/boot/config-<version-number>-default and to the content of /proc/config.gz when uncompressed.

The kernel build process takes place in /usr/src/linux/, which is a symbolic link to /usr/src/linux-<version number>/ (for example, / usr/src/ linux-2.6.5-7.79/). The commands that you use to build the kernel must be issued in this directory because they refer to the top-level kernel makefile, which is /usr/src/linux/Makefile.

The configuration file for building the kernel is the file .config in this directory. If this file does not exist, you need to create it for the first time. If the kernel that is running is the exact same version that the source code is for, you can simply do this:

[email protected]:~ # zcat /proc/config.gz > /usr/src/linux/.config [email protected]:~ # cd /usr/src/linux/

[email protected]: /usr/src/linux-2.6.5-7.79/ # make oldconfig

Tip You may want to backup any existing .config file first.

Alternatively, the command make cloneconfig has exactly the same effect. If the version of the kernel source is newer than the running kernel, then the command make oldconfig is what you need.

Creating a new kernel configuration can be done in essentially one of three ways.

[email protected]: /usr/src/linux-2.6.5-7.79/ # make config

(note that the version number you see on the directory depends on the kernel source version that is installed), you will see something like this:

[email protected]: /usr/src/linux-2.6.5-7.79/ # make config scripts/kconfig/conf arch/i386/Kconfig drivers/char/lirc/Kconfig:102:warning: 'select' used by config symbol

'LIRC_SIR' refer to undefined symbol 'LIRC_SIR_IRDA' #

# using defaults found in .config

* Linux Kernel Configuration

* Code maturity level options

Prompt for development and/or incomplete code/drivers (EXPERIMENTAL) [Y/n/?] Y

Select only drivers expected to compile cleanly (CLEAN_COMPILE) [Y/n/?] Y

Select only drivers that don't need compile-time external firmware

* General setup

Support for paging of anonymous memory (swap) (SWAP) [Y/n/?]

This is simply a series of questions and answers; there is no way to go back, and it certainly could not be described as "user friendly."

♦ A more pleasant method is the following:

[email protected]: /usr/src/linux-2.6.5-7.79 # make menuconfig

This requires the ncurses-devel package to be installed. You will see a screen something like the one in Figure 27-1.

Figure 27-1: Using make menuconfig for kernel configuration

This is a much nicer text-based, menu-driven interface that splits the items into sections and submenus. When you have completed your selections, save the configuration file (see Figure 27-2).

Figure 27-2: Saving the configuration

♦ However, the nicest interface is the graphical one that you can get by running the command [email protected]: /usr/src/linux-2.6.5-7.79 # make xconfig

This requires the qt3-devel package to be installed to create the graphical user interface. This contains exactly the same information as the other two systems but is easier to navigate and is a new interface (previously make xconfig used the less elegant Tk graphical toolkit to create its graphical user interface). See Figures 27-3 and 27-4 for examples of the interface.

A nice feature of this interface is that if you choose Options O Show all Options, you can see the name of each kernel configuration variable, the possible values it can have, and its current setting.

Tip There is also an option make gconfig that uses the GTK+ libraries for a GNOME-like interface.

Whichever interface you use for configuring the kernel, most items offer the choice of y, m, or n (in the xconfig interface these are represented by a tick in the checkbox, a dot in the checkbox, and an empty checkbox, respectively):

♦ y means "Compile this option into the kernel."

♦ m means "Compile this option as a module."

♦ n means "Don't include this option."

When you have saved your configuration, you will have a new .config file. This is the one you will use when you start building the kernel.

Figure 27-3: Using make xconfig for kernel configuration
Figure 27-4: Selecting options in the xconfig interface

Was this article helpful?

0 0

Post a comment