[How To] Extract the config file from an existing kernel

Extracting the config file from an existing kernel

If you want to extract the config file from existing linux image, zImage or bzImage, do the following (only applies if was built with the IKCONFIG option):

Download the files with the linux sources:


mkdir krn

cd krn/

wget ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7260-linux/sources/tskernel-2.6.21-ts-src.tar.gz

Unpack the linux kernel sources:

tar xvfz tskernel-2.6.21-ts-src.tar.gz

Go into the directory of the kernel sources:

cd linux-2.6.21-ts/


chmod 755 ./scripts/extract-ikconfig


./scripts/extract-ikconfig /tmp/zImage > /tmp/config

Where /tmp/zImage is a kernel file you want to extract the config file from, and /tmp/config where the extracted configuration file will be placed.


For an actual running kernel, one way to get the config file this is to

cat /proc/config.gz | gunzip > running.config


zcat /proc/config.gz > running.config

Then running.config will contain the configuration of the running linux kernel.

However this is only possible if your running linux kernel was configured to have /proc/config.gz. The configuration for this is found in

  • General setup
    • [*] Kernel .config support
      • [*] Enable access to .config through /proc/config.gz

Most distributions do not have this configuration set. They provide kernel config files in their kernel packages and is usually found in /boot/ directory.




Attached Files
There are no attachments for this article.
There are no comments for this article. Be the first to post a comment.
Security Code Security Code
Related Articles RSS Feed
[Issue] SSH session slow to start
Viewed 1316 times since Tue, Sep 23, 2014
[How To] Remove a disk from a LVM volume group
Viewed 2801 times since Thu, May 4, 2017