Kernel/Configuration

This article describes the manual configuration and setup of the Linux kernel. For an automatic method see the genkernel article.

Set symlink
The symlink should always point to the kernel sources that is currently being used. This can be done in one of three ways:

1. Install the kernel sources with the  USE flag active. This will make the point to the newly installed kernel sources. If necessary, it can still be modified later with the following two methods:

2. Setting the symlink with the eselect tool:

This outputs the available kernel sources. The asterisk indicates the chosen sources. To change the kernel sources, e.g. to the second entry, do:

3. Setting the symlink manually:

Configuration tools
The kernel offers several tools to configure itself:

make config — Text based configuration. The options are prompted one after another. All options need to be answered, and out-of-order access to former options is not possible.

make menuconfig — Graphical menu (only text input). Navigate through the menu to modify the desired options.

make nconfig — Graphical menu based on ncurses. Requires to be installed.

make xconfig — Graphical menu using Qt4. Requires to be installed.

make gconfig — Graphical menu using GTK+. Requires, and  to be installed.

make oldconfig — Review changes between kernel versions and update to create new for kernel.

There are also several scripts to create miscellaneous default configurations. See:

Configuration
This article describes the configuration using the make menuconfig tool, but the procedure is similar for the other menus.

Usage
In the shown menu the blue bar indicates the position of the cursor. With the and  arrow keys change the position of the cursor. The and   arrow keys traverse the menu bar in the bottom and define what happens when the  key is pressed. For the menu bar below, Select switches to a sub menu for the menu entries ending with ---> while Exit exits a sub menu. As an alternative the key can be pressed twice to exit the application.

Pressing an associated letter key - will move the position of the cursor lines that have characters in bold. The, , keys are excluded from navigation in this way; they are sanctified for other purposes. If a line begins with a Y, M, or N, the next character will be bold and capable of being jumped to. For example, relative to the cursor's current position, if the next line reads "Network Device Support --->" pressing the key will move the cursor to that line.

Menu entries, which start with brackets, are drivers or features that can be activated:


 * [ ], [*]
 * Options in square brackets can be activated or deactivated. The asterisk marks the menu entry as activated. The value can be changed with the key. It is also possible to press  key (Yes) to activate or  key (No) to deactivate the selected entry.
 * If the option is activated, the selected feature/driver will be built into the kernel and will always be available at boot time.


 * < >, , <*>
 * Options in angle brackets can be activated or deactivated, but also activated as module (indicated by a M). The values can be modified by pressing / keys as before or by pressing the key to activate the feature/driver as a module.
 * See the Kernel Modules article for differentiation.


 * {M}, {*}
 * Options in curly brackets can be activated or activated as module but not be deactivated. This happens because another driver is dependent on this feature.


 * -M-, -*-
 * Options between hyphens are activated in the shown way by another driver. There is no choice.

Furthermore some menu entries have a tag at the end:


 * (NEW)
 * This driver is new in the kernel and is maybe not stable enough.


 * (EXPERIMENTAL)
 * This driver is experimental and most likely not stable enough.


 * (DEPRECATED)
 * This driver is deprecated and not needed for most systems.


 * (OBSOLETE)
 * This driver is obsolete and should not be activated.

Most options have a description, which see by pressing the key or choosing Help in the menu bar.

Driver selection
See the hardware detection article and the articles in the Hardware category.

Search modules
Within menuconfig, use the key to search modules by name.

As shown below, the search result will show numbers in front of the matches. Pressing in the example below would make menuconfig jump straight to the option Bluetooth device drivers in the menu structure.

Enabling Gentoo Linux common settings
There is a kernel configuration option called  only present in  and other Kernel Project maintained kernels. It does nothing on its own, but sets various required configuration options for typical installations.

This setting automatically selects  and   support, which are needed for handling  on Gentoo Linux, but might be expanded in the future to enable other mandatory settings for a Gentoo Linux system. For more information, read the help information available through the kernel configuration system as described earlier in this guide.

Build
After configuration has been accomplished successfully, compile the kernel:

For processors with multiple cores, make all the cores do the work: add the option -j(NUMBER_CORES +1). For example, a dual core processor contains two cores plus one (2+1):

Setup
If drivers are activated as modules, they must be installed:

The modules will be copied to a sub directory of.

To install the actual kernel:

This command executes, which is part of the package. ''The new kernel is installed into. If a symbolic link already exists, it is refreshed by making a link from  to the new kernel, and the previously installed kernel is available as . (installkernel'' man page). The same for and  files. These symlinks are handy, because they always point to the newest kernel without changing the file path (e.g. they can be used in the bootloader configuration).

Bootloader
Change the system's bootloader configuration to pick up at boot the new kernel.

Finally restart the system with the new kernel.

Comparing Current Kernel Configuration with Default Configuration
Use the following procedure to get an overview over the kernel configurations that deviate from the default. Keep in mind that the modification of configuration setting may entail additional configuration settings.

The search function in make menuconfig can be used to look up the flags and their interpretation. When you're done, clean up