Home » Linux Kernel » Kernel Booting and Porting » How to obtain kernel config.gz of Running Linux / Android Device ?

How to obtain kernel config.gz of Running Linux / Android Device ?

If we want to check what is the default kernel configuration our device is using, the Linux kernel has a provision to extract the “.config” file used by running device from “/proc/config.gz” .

But there is a catch : To make sure “/proc/config.gz” is present, the kernel which is running on device has to be enabled with option “CONFIG_IKCONFIG” when the kernel is compiled,

this option is available in kernel at,

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

Now, assuming we have a device where above option is enabled, we will show how this file can be obtained from running device.

On Linux Device

From terminal, Copy /proc/config.gz to some accessible directory from which we can copy it to our Linux laptop / desktop like,

$ cp /proc/config.gz /media/sdcard

Now, connect this device to host machine (laptop/desktop) and copy to Host.

On Android

On Android, we can use adb to pull the file directly from device to host as,

$ adb pull /proc/config.gz 

Extracting this config.gz

Now, whether you copy from Android or Linux, config.gz is same for both, so we can use below command to extract this config.gz and get this default kernel configuration as,

$ gunzip config.gz

Above command will create new file as, “config” …

this is the final result of kernel default configuration used by the running device you are using.

Leave a Comment