The kernel is the core of the operating system. Containing most of the device drivers, the kernel offers interfaces for programs to access system hardware such as memory, graphic cards, and block devices.
Though Gentoo has offered different kernels in the past, currently only the Linux kernel is supported.
Which kernel to install?
Gentoo provides a choice of methods to get a kernel up and running, from a standard binary kernel as would be supplied by most distributions to a custom configured and compiled kernel.
When starting out, the gentoo-kernel-bin provides a quick and easy way to get a kernel up and running, while still providing a light, high performance kernel (just like any modern distribution would). Once a system is installed and functioning correctly, a different kernel may be selected if needed. The can be kept around in case of issues booting a custom kernel.
When manually compiling kernel sources or using Genkernel to automate some of the process, Gentoo recommends the package for most users. Its stable versions follow the long term stable (LTS) kernels from upstream kernel.org.
The distribution kernel project provides packages to install and manage kernels through Portage. These kernels are compiled (if needed) and installed with just an emerge command like any other package, which can lessen the administrative burden. Kernel updates are performed when updating the system (i.e., emerge -avuDN @world), and the only manual step is to have the bootloader use the new kernel.
These kernels come with a default configuration that should "just work" for most systems. For users not interested in configuring their own kernel from scratch, these kernels can get things up and running quicker:
Thepackage provides a kernel that will be compiled and installed when the package is emerged. This comes with a default configuration that should work out of the box on most systems, but allows customization if desired.
Theis a binary package containing a precompiled kernel, allowing for faster installation. This package is a precompiled version of the gentoo-kernel package with a default configuration.
Since the gentoo-kernel* packages automate the configuration and compilation process - independently from the usual, manual way of compiling and installing kernels - the rest of this article concerns installation using the package. See the distribution kernel project for further information on distribution kernels
Installing kernel source code
To obtain a kernel, it is necessary to install the kernel source code. The recommended kernel sources for a Gentoo desktop system are. These are maintained by the Gentoo developers, and patched when necessary to fix security vulnerabilities and functional problems, as well as to improve compatibility with rare system architectures.
USE flags for sys-kernel/gentoo-sources Full sources including the Gentoo patchset for the 6.7 kernel tree
|!!internal use only!! DO NOT SET THIS FLAG YOURSELF!, used for creating build images and the first half of bootstrapping [make stage1]
|Apply experimental patches; for more information, see "https://wiki.gentoo.org/wiki/Project:Kernel/Experimental".
|Force kernel ebuilds to automatically update the /usr/src/linux symlink
emerge --ask sys-kernel/gentoo-sources
There are many other kernel packages in the Portage tree. For details on many of these, see the Kernel sources overview article. Further help on choosing a kernel can be found in developer Greg Kroah-Hartman's article What Stable Kernel Should I Use?.
Searching all kernel packages
A full list of kernel sources with short descriptions can be found by searching with emerge:
emerge --search sources
Managing the kernel
- Automatic configuration
- genkernel is a tool used to automate the build process of the kernel and initramfs, helping system administrators through the kernel build process.
- Understanding manual configuration
- A guide on manual configuration offering a broader understanding of concepts.
- Applying manual configuration
- A guide on manual configuration providing the tools and steps needed to get the job done.
- Instructions for hardening the kernel.
- Modules are object files that contain code to extend the kernel.
- Descriptions of various optimizations for the kernel.
- Command-line parameters
- Descriptions of some commonly useful command-line parameters which can be passed to the kernel at boot time for troubleshooting.
- Kernel upgrade
- Steps to upgrade to a new kernel using an existing configuration.
- Kernel removal
- Steps to completely remove old kernels.
Kernel configuration support
See the IKCONFIG support sub-article.
Kernel command-line parameters
When booting from a bootloader, the Linux kernel can accept command-line parameters to change its behavior. This can help, for example, in troubleshooting the kernel at boot time, or to blacklist a certain module that should not be loading. See Gentoo's Kernel/Command-line parameters article for more details.
Kernel.org has a nicely formatted list of available kernel command-line parameters in their admin guide.
- fwupd — a daemon that provides a safe, reliable way of applying firmware updates on Linux.
- Linux firmware — is a package distributed alongside the Linux kernel that contains firmware binary blobs necessary for partial or full functionality of certain hardware devices.
- The kernel category — all the kernel related articles on the wiki.
- The hardware category — lists of hardware stacks with associated kernel configurations.
- planet.kernel.org - Blogs related to the Linux kernel.
- kernelnewbies.org - A "community of aspiring Linux kernel developers who work to improve their kernels, as well as more experienced developers willing to share their knowledge".
- kernel.org/doc/ - Official comprehensive documentation for the Linux kernel.
- What Stable Kernel Should I Use? - An article by kernel developer Greg Kroah-Hartman.
- Building the kernel as root can be harmful
- The Linux Kernel Module Programming Guide