Kernel/IKCONFIG Support

From Gentoo Wiki
< Kernel
Jump to: navigation, search

Configuration and usage of In-kernel Config (IKCONFIG) support for kernel beginners.


In-kernel .config support, also known as IKCONFIG, allows you to build a copy of the configuration the kernel was built with inside the kernel itself. This allows you to inspect the configuration of the kernel while it is running, without having to worry whether you've changed or cleaned the source directory after it was built.

Why is it important?

This can assist with debugging things like if a particular driver was compiled when the kernel was built, whether a networking option was enabled, or any other configuration option when you built the kernel, and is often asked for when looking for support on the forums or IRC channels.

Some poeple advise against enabling IKCONFIG support as it contains specific information about what features are (or are not) built in to the running kernel, and can pose a security risk if someone with malicious intent gains access to it

Enabling IKCONFIG Support

Kernel .config support can be enabled either built in to the kernel, or as a module. If built in to the kernel, there will always be a /proc/config.gz file to read the configuration from. If preferred, it can be built as a module so that the configuration is only available when you have loaded the module.

General Setup  --->
    <*/M> Kernel .config support
        [*] Enable access to .config through /proc/config.gz

Accessing IKCONFIG

If you built IKCONFIG support as a module, then before you can use it you will need to load the module in to the kernel. This can be done by running the following command:

root #modprobe configs

You should now be able to see the file /proc/config.gz. This is a compressed copy of the entire kernel configuration at build time.

When you're finished looking at the configuration, you can unload the module with

root #modprobe -r configs

The module should now have been unloaded and the /proc/config.gz file removed.


In case you hadn't guessed from the filename extension, the configuration file that is now in your /proc directory is a compressed copy of your kernel configuration, which means that in order to read it, it needs to be decompressed. There are two ways to go about doing this.

Quick queries

If you just need to check one or two options, then the easiest way to read the file is to grep it through the decompressor to find what you're looking for.

user $zgrep IKCONFIG /proc/config.gz

Full file

Alternatively, if you want a more in-depth look at the configuration of the running kernel, you will need to copy the compressed file from where it is and decompress it.

user $cp /proc/config.gz /home/user/config.gz
user $gunzip /home/user/config.gz
user $nano /home/user/config

Optional: Load configs module on boot

If you build your kernel with IKCONFIG support as a module, and want that module loaded when you system boots, you will need to add it to the list of auto-loaded modules for your system.


FILE /etc/conf.d/modules


FILE /etc/modules-load.d/configs