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 /usr/src/linux should always point to the kernel sources, you are actually using. To do this you can:


 * install the kernel with active symlink USE flag.


 * set the symlink with eselect:
 * This outputs the available kernel sources. The star indicates the chosen sources. To change the kernel sources, e.g. to the second entry, do:
 * This outputs the available kernel sources. The star indicates the chosen sources. To change the kernel sources, e.g. to the second entry, do:


 * set the symlink yourself, e.g.:

Configuration tools
The kernel offers several tools to configure himself:


 * make config
 * Text based configuration. The options are prompted one after another. You have to answer all options and out-of-order access to former options is not possible.


 * make menuconfig
 * Graphical menu (only text input). You can navigate through the menu and change the options you want.


 * make xconfig
 * Graphical menu using Qt4. You have to install.


 * make gconfig
 * Graphical menu using GTK+. You have to install, and.

Also there are several scripts to create misc default configuration. See:

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

Usage
In the shown menu the blue bar indicates your position. With the arrow keys and  you can change the position. The arrow keys and  traverse the menu bar in the bottom and define, what happens, when you hit the  key. Select switches to a sub menu - the menu entries ending with ---> -, while Exit exits a sub menu. Alternative you can hit the key twice.

Menu entries, which starts with brackets, are drivers or features, which you can activate:


 * [ ], [*]
 * Options in square brackets can be activated or deactivated. The asterisk marks the menu entry as activated. You change the value with the key or press  (Yes) to activate or  (No) to deactivate the entry.
 * Is the option activated, the chosen driver will be build into the kernel and is always available at boot time.


 * < >, , <*>
 * Options in angle brackets can be activated or deactivated, but also activated as module (indicated by a M). You change the value as before and press key for activate as module.
 * The differentiation between a driver as module and a driver build into the kernel is, that the module is not loaded at boot time, so speeds up the boot. As needed you are loading the module yourself or let a tool like udev do it (as needed also at boot time). Simpler in the usability is a driver build into the kernel.


 * {M}, {*}
 * Options in curly brackets can be activated or activated as module but not be deactivated, because another driver needs this activated in either way.


 * -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 get by pressing the key or choose in the menu bar Help.

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

Build
After configuring the kernel you have to compile the kernel:

If you have a processor with multiple cores, you can let all the cores do the work. For this add the parameter -j(NUMBER_CORES +1). For a dual core processor:

Setup
If activated drivers as modules, you have to install them:

The modules will be copied to a sub folder of /lib/modules.

The kernel needs to be copied to the /boot folder. Therefor you have to mount /boot first, if the folder has its own partition:

Now you can copy the kernel to /boot:

Replace ARCH with your architecture, e.g. for x86 and x86_64 (amd64) systems it is x86. The target name is arbitrary. The version number helps to distinguish several kernels.

Alternative there is a tool:

This command executes /sbin/installkernel, which is part of the package. It copies the kernel and the additional files in Debian's naming syntax to /boot and creates there the symlinks vmlinuz</tt>, System.map</tt> and config</tt>, which points to the new kernel etc. . If there are already such symlinks, the old ones are renamed with an ending .old</tt>. These symlinks are handy, because they point always to the newest kernel without changing the file path (e.g. in the bootloader configuration).

Bootloader
Change your bootloader configuration to pick up at boot the new kernel.

Finally restart your system with the new kernel.

Links

 * kernel changelog with some explanations