# [Solved] Getting .config from kernel image

## tskuzzy

Hi, I seem to have lost my .config file for my current kernel. I remember seeing an option when building my kernel to include the config file inside it. How can I extract the config file from the kernel image?Last edited by tskuzzy on Tue Aug 11, 2009 12:46 am; edited 1 time in total

----------

## Hu

Supposedly, scripts/extract-ikconfig can do this.

----------

## cach0rr0

just to add to what Hu mentioned

If your currently running kernel was built with the option you speak of (which ill add to this post when i have a chance to look it up)  you should be able to access it through /proc

```

zcat /proc/config.gz

```

I've not looked at the dealy Hu said, no idea what it does - but it's probably worth looking into as well

I can't believe i dont remember that option offhand...I think it's something like "Access to .config through /proc", something very self-explanatory like that.

----------

## cach0rr0

funny that, found it, but...

```

Symbol: IKCONFIG_PROC [=y]                                                                   │  

  │ Prompt: Enable access to .config through /proc/config.gz                                     │  

  │   Defined at init/Kconfig:411                                                                │  

  │   Depends on: IKCONFIG && PROC_FS                                                            │  

  │   Location:                                                                                  │  

  │     -> General setup                                                                         │  

  │       -> Kernel .config support (IKCONFIG [=y])

```

the bit Hu mentions is in /usr/src/linux/scripts

/usr/src/linux/scripts/extract-ikconfig 

Apparently, unless I'm reading wrong, you can pass that script a bzImage and it'll attempt to massage a .config out of it - no need for the kernel to be running, you just pass the bzImage directly to the script, and if the bzImage was built with support for the feature I note above, it'll pull the config out. 

Neat. Always learn something from Hu.

----------

## tskuzzy

Ah thank you! I knew it was there somewhere!  :Razz: 

And nice solution as well Hu! Linux is such a learning experience  :Very Happy: 

----------

