[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:

cd 

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/

Type:

chmod 755 ./scripts/extract-ikconfig

Run:

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

or,

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.

 

Source:

http://superuser.com/questions/287371/obtain-kernel-config-from-currently-running-linux-system

Attached Files
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Name
Email
Security Code Security Code
Related Articles RSS Feed
[How To] Remove a disk from a LVM volume group
Viewed 2432 times since Thu, May 4, 2017
MENU