# How can I get the running kernel's .config

## serrix

Hi there,

I oh so cleverly cleaned my /usr/src/linux/ dir, so I dont have my last built config.

I also don't have .config support enabled in the old kernel - how can i recompile my new kernel with the old config?

Thanks in advance,

Cheers,

Serrix

----------

## d2_racing

I think that you cannot...sorry  :Sad: 

----------

## CooSee

 *serrix wrote:*   

> Hi there,
> 
> I oh so cleverly cleaned my /usr/src/linux/ dir, so I dont have my last built config.
> 
> I also don't have .config support enabled in the old kernel - how can i recompile my new kernel with the old config?
> ...

 

hallo,

mount /dev/YOUR_BOOT_DEVICE /boot

and you see something like this '  config-2.6.22-gentoo-r10 '   :Shocked: 

just copy the ' config-2.6.22-gentoo-r10 ' to /usr/src/linux/.config

CooSee ' Ya

----------

## d2_racing

Since he use make menuconfig, maybe he doesn't copy is .config in /boot.

This .config doesn't appear by magic in /boot for my concern when you compile your kernel.

----------

## serrix

Your right, all i have in /boot/ is the kernel (bzImage) itself...

Any other ideas? Thanks for the ones already given too.

----------

## serrix

hmmm, it SEEMS to have worked, just by loading the old kernel and doing a make oldconfig from /usr/src/linux.

Thanks for your help, i'll let you know if i'm wrong and it didn't work but so far it looks good  :Smile: 

----------

## serrix

Yep, i was wrong  :Sad: 

----------

## serrix

Thanks for your help, i've re-done my kernel manually.

Cheers,

Serrix

----------

## d2_racing

And after doing it, you make a copy in /boot, like config-2.6.22-gentoo-r8.config

With that, you will  have a copy of your .config.

----------

## neiljw

 *d2_racing wrote:*   

> Since he use make menuconfig, maybe he doesn't copy is .config in /boot.
> 
> This .config doesn't appear by magic in /boot for my concern when you compile your kernel.

 

It does if you use make install.  :Razz: 

I find the best command to update the kernel is:

```
make && make modules_install install
```

----------

## d2_racing

the command : 

```

make && make modules_install install

```

Will create a generique bzImage I think...So for my concern, I prefer to use kernel-2.6.22-gentoo-r8 as the name for my bzImage for exemple.

Maybe I'm wrong...

----------

## neiljw

 *d2_racing wrote:*   

> the command : 
> 
> ```
> 
> make && make modules_install install
> ...

 

You are wrong.

Just in case you still have doubts, here's my /boot:

```
file:///boot/dos

file:///boot/grub

file:///boot/lost+found

file:///boot/config

file:///boot/config-2.6.22-gentoo-r5

file:///boot/config-2.6.22-gentoo-r6

file:///boot/config-2.6.22-gentoo-r6.old

file:///boot/config-2.6.22-gentoo-r7

file:///boot/config-2.6.22-gentoo-r7.old

file:///boot/config-2.6.22-gentoo-r8

file:///boot/config-2.6.22-gentoo-r8.old

file:///boot/config-2.6.23-gentoo

file:///boot/config-2.6.23-gentoo-r1

file:///boot/config-2.6.23-gentoo-r1.old

file:///boot/config-2.6.23-gentoo-r2

file:///boot/config-2.6.23-gentoo-r3

file:///boot/config-2.6.24-rc3-zen3

file:///boot/config.old

file:///boot/fbsplash-emergence

file:///boot/fbsplash-livecd

file:///boot/System.map

file:///boot/System.map-2.6.22-gentoo-r5

file:///boot/System.map-2.6.22-gentoo-r6

file:///boot/System.map-2.6.22-gentoo-r6.old

file:///boot/System.map-2.6.22-gentoo-r7

file:///boot/System.map-2.6.22-gentoo-r7.old

file:///boot/System.map-2.6.22-gentoo-r8

file:///boot/System.map-2.6.22-gentoo-r8.old

file:///boot/System.map-2.6.23-gentoo

file:///boot/System.map-2.6.23-gentoo-r1

file:///boot/System.map-2.6.23-gentoo-r1.old

file:///boot/System.map-2.6.23-gentoo-r2

file:///boot/System.map-2.6.23-gentoo-r3

file:///boot/System.map-2.6.24-rc3-zen3

file:///boot/System.map.old

file:///boot/vmlinuz

file:///boot/vmlinuz-2.6.22-gentoo-r5

file:///boot/vmlinuz-2.6.22-gentoo-r6

file:///boot/vmlinuz-2.6.22-gentoo-r6.old

file:///boot/vmlinuz-2.6.22-gentoo-r7

file:///boot/vmlinuz-2.6.22-gentoo-r7.old

file:///boot/vmlinuz-2.6.22-gentoo-r8

file:///boot/vmlinuz-2.6.22-gentoo-r8.old

file:///boot/vmlinuz-2.6.23-gentoo

file:///boot/vmlinuz-2.6.23-gentoo-r1

file:///boot/vmlinuz-2.6.23-gentoo-r1.old

file:///boot/vmlinuz-2.6.23-gentoo-r2

file:///boot/vmlinuz-2.6.23-gentoo-r3

file:///boot/vmlinuz-2.6.24-rc3-zen3

file:///boot/vmlinuz.old

```

The "vmlinuz" and "vmlinuz.old" are symlinks to the current and previous kernels.

----------

## your_WooDness

Hi,

you can also use the file /proc/config.gz. This should be your running kernel's config. gunzip it, alter the access rights if needed and copy it to /usr/src/linux/

----------

## CooSee

hallo,

i always do :

make && make modules_install && cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.22-gentoo-r10-2 && cp .config /boot/config-2.6.22-gentoo-r10-2

when compile the kernel

CooSee ' Ya

----------

## neiljw

 *CooSee wrote:*   

> hallo,
> 
> i always do :
> 
> make && make modules_install && cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.22-gentoo-r10-2 && cp .config /boot/config-2.6.22-gentoo-r10-2
> ...

 

Why when you have to change that for every different kernel AND edit /boot/grub/grub.conf.? Also, your old kernel gets overwritten if you are simply modifying the existing kernel - which can be a real pain if it fails to boot. Give me make install anyday. It handles the lot for you.

----------

## CooSee

 *neiljw wrote:*   

>  *CooSee wrote:*   hallo,
> 
> i always do :
> 
> make && make modules_install && cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.22-gentoo-r10-2 && cp .config /boot/config-2.6.22-gentoo-r10-2
> ...

 

hallo,

i forgot to write, that i always took different names for the kernel that i compile ( in the Makefile too ), like ' 2.6.22-gentoo-r10 ' ,

' 2.6.22-gentoo-r10-1 ' and so on...

thats because i try different Kernel, like ' zen-sources ' and many others

sorry for my bad english   :Rolling Eyes: 

CooSee ' Ya

----------

## neiljw

 *CooSee wrote:*   

> i forgot to write, that i always took different names for the kernel that i compile ( in the Makefile too ), like ' 2.6.22-gentoo-r10 ' ,
> 
> ' 2.6.22-gentoo-r10-1 ' and so on...

 

Precisely the reason to let "make install" do it and save yourself a lot of typing and possible typos.

 *Quote:*   

> thats because i try different Kernel, like ' zen-sources ' and many others

 

Take another look at my /boot listing above. Apart from frequent updates to gentoo-sources, you will see zen-sources in there too. (Ouch, I didn't want to remember zen-sources - they broke my computer.  :Sad: ) 

 *Quote:*   

> sorry for my bad english  

 

There is plenty of worse English around and some of it from native English speakers.  :Wink: 

----------

## d2_racing

Yeah Neiljw, you are right.

When I compile my box I use this :

```

cp arch/i386/boot/bzImage /boot/kernel-2.6.xx-gentoo-rx && cp .config /boot/config-2.6.xx-gentoo-rx-.config && cp System.map /boot

Add an entry in /boot/grub/grub.conf to test something and after that I make some clean up.

```

----------

## Anarcho

```
zcat /proc/config.gz > /usr/src/linux/.config
```

----------

## Mantaar

 *Anarcho wrote:*   

> 
> 
> ```
> zcat /proc/config.gz > /usr/src/linux/.config
> ```
> ...

 

That will only work if you have kernel-config file support compiled into the kernel itself. The option is

```

  │ Symbol: IKCONFIG [=y]                                                                     

  │ Prompt: Kernel .config support                                                            

  │   Defined at init/Kconfig:237                                                             

  │   Location:                                                                               

  │     -> General setup                                                                      

```

You should generally say 'yes' here as it does not cost too much and it will probably save you a hell of a lot of time in case you loose your original .config

----------

