From Gentoo Wiki
Jump to: navigation, search

Alternative: Using 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 upgraded to new versions as part of @world upgrade without a need for manual action. Distribution kernels default to a configuration supporting the majority of hardware but they can be customized via /etc/portage/savedconfig.

Installing correct installkernel

Before using the distribution kernels, please verify that you are using the correct installkernel package for your system. When using systemd-boot (formerly gummiboot), install:

root #emerge --ask sys-kernel/installkernel-systemd-boot

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

root #emerge --ask sys-kernel/installkernel-gentoo

Installing a distribution kernel

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

root #emerge --ask sys-kernel/gentoo-kernel

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

root #emerge --ask sys-kernel/gentoo-kernel-bin

Upgrading and cleaning up

Once the kernel is installed, the package manager will automatically upgrade it to newer versions. The previous versions will be kept until the package manager is requested to clean up stale packages. Please remember to periodically run:

root #emerge --depclean

to save space. Alternatively, to specifically clean up old kernel versions:

root #emerge --prune sys-kernel/gentoo-kernel sys-kernel/gentoo-kernel-bin

Post-install/upgrade tasks

Due to technical limitations, distribution kernels can not automatically rebuild kernel modules installed by other packages. Therefore, after kernel upgrade manually execute:

root #emerge --ask @module-rebuild

If any of these modules (e.g. ZFS) are needed at early boot, rebuild initramfs afterward:

root #emerge --config sys-kernel/gentoo-kernel
root #emerge --config sys-kernel/gentoo-kernel-bin