Project:Distribution Kernel

The Distribution Kernel project Article description::aims to maintain sys-kernel/*-kernel packages. These kernel packages have three goals:


 * 1) Covering kernel maintenance wholly within packages (install via emerge, upgrade as part of @world upgrade), without requiring additional actions from the user or resorting to non-portable hacks.
 * 2) Providing a default configuration that works for most of diverse systems, for users who are not interested in configuring their own kernel from scratch.
 * 3) Supporting different bootloaders and  layouts (LILO, GRUB, systemd-boot, EFI stub…) with minimal effort, including deploying self-built kernel binary packages over a fleet of heterogeneous systems.

Current packages
The following packages are provided:

The project currently maintains two LTS branches (5.4 and 5.10), plus newer branches that are marked stable at the time. Usually, the last EOL version is also kept for a short time.
 * (built from source, customizable)
 * (built from source, customizable)
 * (prebuilt)

Trying it out
Simply, either run

or

depending on your preference for from-source builds or prebuilt binaries. You need to use the non-bin if you wish to customise your config.

Users of systemd-boot should have the kernel installed automatically into /boot, while users of e.g. GRUB will need to run after installation completes. It is possible to use a hook in to automatically update GRUB or run arbitrary commands at the point of kernel installation.

See the AMD64 Handbook for more details.

Modifying kernel configuration
The modern versions of Distribution Kernels support two mechanisms for changing the kernel configuration: savedconfig and directory. Savedconfig replaces the entire default config with an administrator-supplied config file, so it is probably a better choice for those desiring to build an entirely custom kernel. When using, configuration files are merged on top of the default configuration file, so it is more convenient for use-cases that change some specific options.

Preparing a modified kernel config
The easiest way to modify the current kernel configuration is to run one the configuration UIs in the kernel build tree. To do that, select a kernel ebuild and run it up to the configure phase. For example:

Note the directory used by make. Enter it and run a kernel configuration tool such as nconfig or menuconfig:

After saving changes, the new config will be written to the file (in the modprep directory).

Using savedconfig
To use savedconfig, put the kernel config into an appropriate directory. The filename can either match the package name, or name with version. For example, creating the following file will apply the same configuration anytime a version of the  package is emerged:

Afterward, enable the  USE flag on the relevant kernel package, then re-emerge the package:

Note that the default Gentoo kernel configuration will not used if savedconfig has been enabled. When using an outdated configuration file, unset symbols (a.k.a newly added symbols) will take the upstream kernel's default values rather than Gentoo's default configuration. It is important to note there could be differences between the two.

Using /etc/kernel/config.d
To use the config.d approach, put a config override file into directory. Make sure that the file has suffix. All files present in that directory will be merged in lexical order to the default Gentoo config.

For example:

Note that the 'is not set' comments unset options.

Using different option files for different kernel versions or variants is not supported via the config.d configuration method at the moment.