The Linux kernel build system uses Kconfig to describe every configurable feature as a symbol with a type, default value, and dependency tree. Before you compile the kernel you must produce aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/deelerdev/linux/llms.txt
Use this file to discover all available pages before exploring further.
.config file that sets every required symbol. The Kconfig front-ends — menuconfig, xconfig, nconfig, and others — let you browse and edit those symbols interactively, while batch targets such as defconfig and localmodconfig generate a baseline automatically.
Configuration targets
Runmake help from the kernel source root to list every available target. The most commonly used ones are:
| Target | Description |
|---|---|
menuconfig | Text-based curses UI; runs in any terminal |
xconfig | Qt5-based graphical UI |
nconfig | Alternative ncurses UI with function-key shortcuts |
gconfig | GTK-based graphical UI (limited help text) |
defconfig | Generate a .config from the architecture default |
localmodconfig | Trim the config to only modules loaded on the running system |
oldconfig | Update an existing .config to a new kernel version, prompting for new symbols |
olddefconfig | Same as oldconfig but answers new symbols with their defaults silently |
listnewconfig | Print new symbols introduced since the last .config |
allmodconfig | Enable every symbol that can be built as a module |
allyesconfig | Enable every symbol that can be built in |
allnoconfig | Disable every optional symbol |
randconfig | Set symbols to random values (useful for CI testing) |
savedefconfig | Write a minimal defconfig to defconfig |
Using make menuconfig
Install build dependencies
Install the packages your distribution requires before running any configuration front-end.
- Debian / Ubuntu
- Fedora / RHEL
- Arch Linux
Start from a baseline
Use the architecture default as your starting point, or copy your running kernel’s config if it is available.
Open the interactive menu
y (built-in), m (module), and n (disabled). Press / to search by symbol name. Press ? for help on the selected symbol. Press Esc Esc to go back one level, or select Exit at the top-level menu to save and quit.Common configuration options
SMP and CPU topology
SMP and CPU topology
Symmetric multiprocessing is controlled by
CONFIG_SMP. On most modern hardware you want this enabled.CONFIG_NR_CPUS sets the compile-time maximum number of logical CPUs the kernel will support. Setting it too low wastes no resources, but the kernel will refuse to bring up CPUs beyond that limit at boot.Debugging features
Debugging features
Enable these symbols on a development or test kernel. They add significant runtime overhead and are not suitable for production.
Security features
Security features
These options harden the kernel against exploitation:
Trimming the config with localmodconfig
Trimming the config with localmodconfig
localmodconfig queries lsmod and disables modules not currently loaded, producing a much smaller config. This is useful for fast iteration on development machines.Run this on the target machine with all relevant hardware attached and drivers loaded, otherwise you may trim modules you actually need.
Out-of-tree builds with O=
You can keep build artifacts entirely separate from the source tree using the O= variable. This is useful when you share a single source checkout across multiple configurations.
make invocations for that build must pass the same O= value.
Saving and managing .config files
Environment variables for Kconfig
| Variable | Effect |
|---|---|
KCONFIG_CONFIG | Override the default .config filename |
KCONFIG_DEFCONFIG_LIST | Space-separated list of fallback configs when .config does not exist |
KCONFIG_OVERWRITECONFIG | Prevent Kconfig from replacing a .config symlink |
KCONFIG_WARN_UNKNOWN_SYMBOLS | Warn about unrecognised symbols in the config input |
KCONFIG_WERROR | Treat Kconfig warnings as errors |
KCONFIG_ALLCONFIG | File containing symbols to force when using allyes/allmod/allno/alldef/randconfig |
