genkernel
Build an initial RAM disk and kernel
TLDR
Automatically compile and install a generic kernel
Build and install the bzImage, initramfs, kernel, or ramdisk only
Apply changes to the kernel configuration before compiling and installing
Generate a kernel with a custom name
Use a kernel source outside the default directory /usr/src/linux
SYNOPSIS
genkernel [options] {all|linux|initramfs|clean|help} [kernel-args...] [-- --kernel-config=/path/to/.config]
PARAMETERS
--menuconfig
Invoke interactive kernel menuconfig before build
--oldconfig
Use existing .config with defaults for new options
--gconfig
Use graphical gconfig interface
--install
Install kernel and modules after building
--no-clean
Skip kernel tree cleanup before compile
--kerneldir=PATH
Specify kernel source directory (default: /usr/src/linux)
--config=PATH
Use alternate genkernel.conf
--makeopts=OPTS
Pass extra options to make
--bootdir=PATH
Set /boot directory
--zimage
Build zImage instead of bzImage (some arches)
--symlink
Create symlink to latest kernel image
--firmware
Include all firmware modules
DESCRIPTION
genkernel is a Gentoo Linux utility that automates building, compiling, and installing custom Linux kernels with matching initramfs images. It simplifies kernel management by handling configuration, module compilation, firmware inclusion, and bootloader updates.
Ideal for Gentoo users, it supports complex setups like LVM, RAID, encryption (LUKS), and filesystems (Btrfs, XFS). Run genkernel all for a full build-install cycle from kernel sources in /usr/src/linux. Options allow customization, such as interactive config via --menuconfig or using existing configs with --oldconfig.
genkernel reads /etc/genkernel.conf for defaults like CFLAGS, MAKEOPTS, and feature modules. It generates initramfs-genkernel-arch.img and symlinks kernels to /boot. Post-build, update GRUB or other bootloaders manually.
This tool reduces errors in manual kernel workflows, supports cross-compilation, and integrates with Portage for easy source management via emerge sys-kernel/gentoo-sources.
CAVEATS
Gentoo-specific; requires kernel sources and Portage. May overwrite manual configs. Always verify bootloader after genkernel all. Cross-compiles need TOOLCHAIN_PREFIX.
CONFIGURATION
Edit /etc/genkernel.conf for defaults like LUKS=1, RAID=1, MODULES_LOAD=(module1 module2).
TARGETS
all: full build+install; linux: kernel only; initramfs: image only; clean: cleanup.
HISTORY
Developed for Gentoo Linux around 2004-2005 to ease kernel compilation amid frequent updates. Evolved with initramfs support post-2.6 kernels; now at version 4.x with Btrfs, ZFS modules.
SEE ALSO
dracut(8), mkinitcpio(8), update-initramfs(8), depmod(8)


