aboutsummaryrefslogtreecommitdiffstats
KERN(1) General Commands Manual KERN(1)

kern
configure, build, and install kernels

kern [all]

kern set [kernel]

kern config [host]

kern diff [config]

kern build

kern install

kern postinst

kern clean

kern is a program for automating the deployment of kernels on Gentoo-based systems. It is comprised of a set of commands that manage specific tasks related to building, configuring, and installing kernels.

Commands that operate directly on the kernel sources need to be launched from within the source tree directory, usually /usr/src/linux. Specifically, those commands are config, diff, build, and install.

kern uses sudo(8) internally to launch commands that require superuser permissions. Care was taken to minimize the amount of privilege escalation. Particularly, the build command does not build the kernel with superuser permissions, as the set command changes the owner of the kernel source tree to the user invoking kern.

Throughout this manual, the “selected kernel” refers to the kernel source tree that is referenced by the /usr/src/linux symbolic link. In other words, the “selected kernel” is the currently selected kernel as reported by kernel.eselect(5).

The commands are as follows:

all
Changes the current directory to /usr/src/linux and runs the whole suite of commands in order.

This command additionally prompts the user for confirmation if the generated configuration file differs from the one used by the running kernel.

set [kernel]
Sets the selected kernel to kernel. This command uses eselect(1), particularly its kernel.eselect(5) backend to achieve this. The kernel argument can be any kernel name understood by that backend, for example ‘linux-5.4.36-gentoo’.

If no kernel is given, this command determines the latest available kernel automatically.

config [template]
Configures the kernel using the base template and the given kernfrag(7) template.

If no template is given, this command uses the output of hostname(1) as the template name.

diff [config]
Uses git-diff(1) if available, otherwise diff(1) to display the differences between the generated kernel configuration and config.

If no config is given, this command compares against the configuration of the currently running kernel. This requires a kernel configuration to be present under /proc/config.gz. See the CONFIG_IKCONFIG configuration option in the kernel for more information.

build
Builds the selected kernel.
install
Installs the selected kernel.

This command mounts /boot if it is a separate partition and not already mounted.

postinst
Runs any relevant post-installation jobs. Currently this calls emerge(1) with @module-rebuild.
clean
Uses eclean-kernel to remove obsolete kernels.

If no command is given, assume all.

/usr/src/linux
A symbolic link pointing to the directory that contains the kernel source tree.
/etc/kernfrag
The directory containing the kernfrag(7) tree.

emerge(1), eselect(1), kernfrag(7)

kern was written by Wolfgang Müller
June 4, 2020