Explore Linux kernel configurations with kconfigs

April 3, 2024 | 5 minute read
Text Size 100%:

One of the strengths of the Linux kernel is its configurability. From servers to desktops, Android phones to automotive applications, and Mars rovers to embedded home devices, you can find a Linux kernel that’s been configured to suit its industry. The downside of this flexibility is complexity: Linux kernel developers must write architecture-indpendent code that scales from embedded systems to huge servers, taking into account dozens of configuration possibilities for any given feature.

In this blog, we share kconfigs, a new tool which makes it easier for developers to manage the diversity of kernel configurations across the Linux world.

Linux kernel configurations

The Linux kernel may comprise tens of millions of lines of code, but surprisingly little of it is actually used at any given time. Before the kernel can be compiled, it must first be configured, by selecting a value for each one of thousands of individual variables, each controlling things like:

  • Should a major subsystem be enabled or disabled?
  • Should a driver be built-in to the kernel, available as a dynamically loaded module, or disabled?
  • Which implementation of an API should be used?
  • Should an optional behavior or feature be included or excluded?
  • What value should be used for a core functionality of the kernel? (e.g. the timer frequency, CONFIG_HZ)

Maintainers of Linux distributions, like Oracle Linux, spend a good deal of time determining the best configuration for their users. Configurations used for server & desktop distributions differ from those used by Android (for example) or for more specialized applications.

Because each distribution is different, the variation of kernel configurations is staggering. Kernel developers need to write code that will compile and work on all combinations of these configurations, but they should care most deeply about the commonly used configurations. Further, when debugging the kernel, knowing what configuration was in use allows you to make better assumptions and resolve bugs quicker. Until now, there hasn’t been a simple place to view and reference the common kernel configurations used by Linux distributions.

Introducing kconfigs

We’ve created a project called kconfigs that aims to make it simpler for people to browse kernel configurations used by Linux distributions. You can use it by visiting the web page, ideally on a desktop browser for the best viewing (Javascript is required to load the page). The interface provides a table with Linux distributions as rows, and configurations as columns. Simply enter a configuration name in the text box (without the CONFIG_ prefix) and hit Enter, or click “Add Config”. You can add multiple configurations to the table as well:

Preview showing multiple selected configurations
Preview showing multiple selected configurations

To remove configurations from the table, click the red “X” in the column header. You can also click the configuration name to view information about it in the Linux Kernel Driver Database (LKDDB), a site which contains (among other things) all the kernel configurations, their descriptions, and the versions in which they appear.

As you update the configuration table, the URL updates. You can copy the URL and send it to other people, or include the URL in a patch. Following the URL will bring users to the exact same table.

Kconfigs is pre-configured with a small set of common Linux distributions: Fedora, Debian, Ubuntu, Arch, CentOS and Oracle Linux, for both x86_64 and aarch64 architectures. In addition, Android Generic Kernel Images are included. Finally, near the bottom of the table are entries entitled “Upstream Default”. These are produced by taking the latest linux-stable code for each supported release, and running make defconfig for the given architecture. It’s important to note that running make defconfig will produce slightly different results depending on the build environment (due to differences in compiler versions & other build tools). So these upstream defaults are a bit arbitrary, and you may want to double-check them based on your own build environment.

With this tool, it’s much easier to explore configurations to see what’s commonly in use today. For example, you could explore to see which slab allocators are in use (spoiler: it’s all SLUB), or see which timer frequency is used by different distributions.

Downloading configurations directly

Many developers prefer to avoid web pages where possible, and some questions are better answered by a quick grep! If you prefer to simply download the configuration files directly and analyze them yourself, you can do that instead. Just clone the gh-pages branch of the kconfigs repository, and view each configuration within the out/ directory:

git clone -b gh-pages https://github.com/oracle/kconfigs
cd kconfigs
grep -r IKCONFIG_PROC out/

Extending kconfigs with new distributions

We know that not every distribution is reflected in these tables, and we’re happy to accept contributions for new distributions. For distributions based on Pacman, Dpkg, or RPM, you probably just need to add a configuration file, and the distribution’s package signing public key. For other package managers or kernel types, you’ll need to write some code to fetch and extract kernel configurations. In either case, you can find the information you need to get started in the contributing guide.

How it works

The kernel configuration is usually an input file that a distribution maintains. When a kernel is built, the build system generates a final config file from that input. Normally, Linux distributors will put the resulting file in the kernel package, so it can be installed to a location like /boot/config-$(uname -r) or /lib/modules/$(uname -r)/config. Kconfigs can just extract this file directly from the package and move on.

In some cases, (e.g. Arch Linux kernels, as well as Android), there’s no configuration file alongside or within the kernel package. In these cases, we rely on CONFIG_IKCONFIG. When this setting is enabled, a compressed copy of the configuration is stored in the kernel image itself. The kernel source code contains a script called extract-ikconfig which can retrieve the config from the image. Thankfully, IKCONFIG is enabled on Android and Arch kernels, so we can use this approach in kconfigs.

Between these two choices, we’re able to get the exact configuration for each kernel package!


We hope kconfigs proves to be a useful reference for developers. Please try it out. We’re happy to hear any feedback in the Github issue tracker.

Stephen Brennan

Previous Post

XFS: Tracking space on a realtime device

Chandan Babu | 7 min read

Next Post

Introduction to Netfilter

Mohith Kumar Thummaluru | 11 min read