Handbook:Parts/Installation/Kernel/Dist-Kernel

Distribution kernels
Distribution Kernels are ebuilds that cover the complete process of unpacking, configuring, compiling, and installing the kernel. The primary advantage of this method is that the kernels are updated to new versions by the package manager as part of @world upgrade. This requires no more involvement than running an command. Distribution kernels default to a configuration supporting the majority of hardware, however two mechanisms are offered for customization: savedconfig and config snippets. See the project page for more details on configuration.

Installing the correct installkernel package
Before using the distribution kernels, please verify that the correct installkernel package for the system has been installed. When using systemd-boot (formerly gummiboot) as the bootloader, install:

When using a traditional a layout (e.g. GRUB, LILO, etc.), the gentoo variant should be installed by default. If in doubt:

Installing a distribution kernel
To build a kernel with Gentoo patches from source, type:

System administrators who want to avoid compiling the kernel sources locally can instead use precompiled kernel images:

Upgrading and cleaning up
Once the kernel is installed, the package manager will automatically update it to newer versions. The previous versions will be kept until the package manager is requested to clean up stale packages. To reclaim disk space, stale packages can be trimmed by periodically running emerge with the  option:

Alternatively, to specifically clean up old kernel versions:

Post-install/upgrade tasks
Distribution kernels are capable of rebuilding kernel modules installed by other packages. provides the  USE flag which controls a subslot dependency on.

Enabling this USE flag on packages like and  allows them to automatically be rebuilt against a newly updated kernel and, if applicable, will re-generate the initramfs accordingly.

Manually rebuilding the initramfs
If required, manually trigger such rebuilds by, after a kernel upgrade, executing:

If any kernel modules (e.g. ZFS) are needed at early boot, rebuild the initramfs afterward via: