Skip to main content

Documentation 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.

Kconfig is the Linux kernel’s configuration system. Before you compile the kernel, you use Kconfig to choose which subsystems, drivers, and features to include—either built directly into the kernel image (y), compiled as loadable modules (m), or excluded entirely (n). The result is a .config file that controls the entire build.

What Kconfig is and how it works

The kernel source tree contains thousands of Kconfig files, one in almost every subdirectory. Each file describes a set of configuration symbols with their types, default values, dependencies, and help text. Running any make *config target reads all of these files and presents them together as a single configuration database organized in a tree. Every symbol has a type: bool (y/n), tristate (y/m/n), string, int, or hex. Tristate is unique to the kernel and allows the middle state m, meaning “build as a module.” Dependencies between symbols are declared with depends on and select, so enabling one option may automatically enable or restrict others. The final configuration is written to .config in the kernel source root. The build system converts this file to include/generated/autoconf.h, which every C source file includes to pick up the #ifdef CONFIG_* guards.

Configuration interfaces

The kernel provides several frontends for generating and editing .config.

menuconfig

Text-based TUI in the terminal. Requires ncurses development headers. The most widely used interactive tool.

xconfig

Qt5-based graphical interface. Requires Qt5 development headers. Useful for browsing the full tree visually.

nconfig

Alternative text interface with function-key navigation. Requires ncurses. Shows function key hints at the bottom.

defconfig

Loads the architecture default configuration. A clean starting point for a given CPU architecture.
make menuconfig
menuconfig requires libncurses-dev (Debian/Ubuntu) or ncurses-devel (Fedora/RHEL). xconfig requires qtbase5-dev or equivalent.

The .config file format

The .config file is a plain text file. Each line is either a comment or a symbol assignment:
# Networking support
CONFIG_NET=y
CONFIG_IPV6=m
# CONFIG_DECNET is not set
The three states map directly to Kconfig tristate values:
ValueMeaning
=yBuilt into the kernel image
=mCompiled as a loadable module (.ko file)
# CONFIG_FOO is not setDisabled — the symbol evaluates to n
Symbols set to y are compiled unconditionally into vmlinuz. Symbols set to m produce a .ko file in /lib/modules/<version>/ that can be loaded on demand with modprobe.

Searching for symbols in menuconfig

Inside menuconfig, press / to open the search dialog. You can search by symbol name fragment or use regular expressions. The result list shows each match, its current value, and where it appears in the menu hierarchy. Press the number shown next to a result to jump directly to that entry.

Updating an existing config

When you move to a newer kernel version, new symbols are introduced that your old .config does not know about. Use make oldconfig to step through each new symbol interactively, or make olddefconfig to accept all defaults silently:
1

Copy your existing config

cp /boot/config-$(uname -r) .config
2

Update to the new kernel's symbols

Accept defaults silently:
make olddefconfig
Or review each new symbol interactively:
make oldconfig
3

Build with the updated config

make -j $(nproc --all)
To see only the symbols that changed between two config files, use the helper script:
scripts/diffconfig .config.old .config

Building a minimal config with localmodconfig

make localmodconfig reads the list of currently loaded kernel modules (via lsmod) and disables every module that is not in use. This dramatically reduces compile time on distributions that ship universal kernels with hundreds of drivers.
yes "" | make localmodconfig
localmodconfig disables drivers for hardware that is not currently active—including USB peripherals unplugged at build time, VPN drivers not yet connected, and virtualization support if you have not run a VM recently. If a feature stops working after installing the new kernel, it was likely compiled out. Re-enable it with make menuconfig and rebuild.
To build for a different machine, export its module list and transfer it:
# On the target machine
lsmod > ~/lsmod-target.txt

# On the build machine
yes "" | make LSMOD=~/lsmod-target.txt localmodconfig

Important configuration categories

Found under Processor type and features (x86) or the equivalent for your architecture. Key options include:
  • CONFIG_SMP — symmetric multiprocessing support (required on multi-core systems)
  • CONFIG_X86_64 — 64-bit x86 support
  • CONFIG_NUMA — non-uniform memory access support (servers with multiple CPU sockets)
  • CONFIG_HZ — kernel timer frequency (100, 250, or 1000 Hz)
  • CONFIG_PREEMPT — kernel preemption model (none, voluntary, or full)
Found under File systems. Enable as modules any filesystem you mount occasionally:
  • CONFIG_EXT4_FS — ext4 (common Linux root filesystem)
  • CONFIG_XFS_FS — XFS (common on RHEL/Fedora)
  • CONFIG_BTRFS_FS — Btrfs (snapshots, RAID, checksums)
  • CONFIG_VFAT_FS — FAT32/VFAT (USB drives, EFI partition)
  • CONFIG_NTFS3_FS — NTFS read/write (Windows partitions)
  • CONFIG_NFS_FS — NFS client support
Found under Networking support:
  • CONFIG_NET — core networking (almost always required)
  • CONFIG_IPV6 — IPv6 support
  • CONFIG_NETFILTER — iptables/nftables packet filtering
  • CONFIG_BRIDGE — network bridge support (VMs, containers)
  • CONFIG_TUN — TUN/TAP virtual devices (VPN software)
  • CONFIG_WIRELESS — 802.11 wireless LAN support
Found under Security options:
  • CONFIG_SECURITY — enables the Linux Security Module (LSM) framework
  • CONFIG_SECURITY_SELINUX — SELinux mandatory access control
  • CONFIG_SECURITY_APPARMOR — AppArmor profile-based MAC
  • CONFIG_STACKPROTECTOR_STRONG — stack canary buffer overflow protection
  • CONFIG_STRICT_KERNEL_RWX — enforce read-only kernel text segments
  • CONFIG_MODULE_SIG — require module signature verification
Found under Kernel hacking. Useful for development builds, but increase kernel size and reduce performance:
  • CONFIG_DEBUG_INFO — DWARF debug symbols (needed to decode stack traces with gdb)
  • CONFIG_DYNAMIC_DEBUG — runtime-selectable pr_debug() messages
  • CONFIG_KGDB — kernel debugger over serial or network
  • CONFIG_LOCKDEP — lock dependency tracking (detects deadlocks)
  • CONFIG_KASAN — kernel address sanitizer (detects memory corruption)

Configuration for common use cases

Server

A minimal server kernel avoids desktop drivers and focuses on throughput and stability:
# Start from a distro config
cp /boot/config-$(uname -r) .config
make olddefconfig

# Disable debug overhead
./scripts/config --file .config \
  -d DEBUG_INFO -d DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT \
  -d DEBUG_INFO_DWARF4 -d DEBUG_INFO_DWARF5 \
  -e CONFIG_DEBUG_INFO_NONE

make olddefconfig

Desktop

Desktop builds benefit from full preemption and audio/video drivers:
# Use localmodconfig to capture currently used drivers
yes "" | make localmodconfig

# Verify these are enabled
./scripts/config -e CONFIG_PREEMPT -e CONFIG_HZ_1000
make olddefconfig

Embedded / minimal

For embedded targets, start with allnoconfig and enable only what you need:
make allnoconfig
# Then enable required features via menuconfig or scripts/config
make menuconfig
Use KCONFIG_ALLCONFIG=minimal.config make allnoconfig to start from an allnoconfig base while forcing specific symbols on. This is useful for scripted cross-compilation workflows.

Build docs developers (and LLMs) love