# Preserving kernel config with new sources [Solved]

## Faraclas

Every time I get new kernel sources, the configurations from my old sources don't seem to follow it.  One example is the WiFi driver (ath9k) which is always missing from new kernel sources when I try to configure them.  After reading some documentation, it seems the config should be portable, but I guess I am missing something.

I am using genkernel.  

This documenation http://wiki.gentoo.org/wiki/Genkernel#Preserving_the_working_files states

 *Quote:*   

> Note
> 
> There is no need to run make oldconfig with genkernel even if the sources are changed from kernel-genkernel-ARCH-version-gentoo-rx to kernel-genkernel-ARCH-version-gentoo-r(x+1) or from kernel-genkernel-ARCH-version-gentoo to kernel-genkernel-ARCH-(version+1)-gentoo because make menuconfig will try to load the previous configuration into the menu as much as possible. Nevertheless, reviewing each option and new sections carefully is recommended.

 

However, with the new sources installed, I tried to run

```
genkernel --menuconfig all
```

(cause that is the only way I know how to use genkernel) but I got an error message that no .config file was found.

So then I looked at this documentation:  http://wiki.gentoo.org/wiki/Kernel/Upgrade#make_silentoldconfig

I copied the .config from the old source into the new /usr/src/linux (I verified the symlink points to the new sources correctly) and then ran

```
root #cd /usr/src/linux

root #make silentoldconfig

root# genkernel --menuconfig all
```

This built the new kernel but the config options (as mentioned above) were not the same as the old kernel.

What am I doing wrong?Last edited by Faraclas on Thu Feb 19, 2015 5:29 pm; edited 1 time in total

----------

## John R. Graham

genkernel has its own canned configurations which it uses unless you include --oldconfig on the command line. You can make this setting permanent with the OLDCONFIG option in /etc/genkernel.conf. I also like setting CLEAN=no in there.

- John

----------

## Faraclas

Thanks for the info.  I opened up my /etc/genkernel.conf and it looks like these things were already set.  Here is the beginning of the file.

```
# Configuration file for genkernel

# This file is sourced by genkernel at startup and determines which options

# we will be using to compile our kernel.  The order of precidence is simple,

# with the internal settings being least important, configuration file

# settings next, and command line options being most important.

# =========Common Command Line Option Defaults=========

# Should we install to $BOOTDIR?  Default is "no" because genkernel is used in

# catalyst and stage building.

#INSTALL="yes"

# Run 'make oldconfig' before compiling this kernel?

OLDCONFIG="yes"

# Run 'make menuconfig' before compiling this kernel?

MENUCONFIG="no"

# Run 'make nconfig' (ncurses 'menuconfig') before compiling this kernel?

NCONFIG="no"

# Note, that two previous lines are mutual exclusive (logically), while

# MENUCONFIG has a higher priority if both them is enabled.

# Run 'make clean' before compilation?

# If set to NO, implies MRPROPER WILL NOT be run

# Also, if clean is NO, it won't copy over any configuration

# file, it will use what's there.

CLEAN="yes"
```

----------

## John R. Graham

Read your own post.  :Wink: 

```
# Also, if clean is NO, it won't copy over any configuration

# file, it will use what's there.

CLEAN="yes"
```

- John

----------

## szatox

you might also want to copy /etc/kernels/<your last kernel config> as /usr/src/linux/.conf

----------

## Faraclas

Thanks again.

Changed CLEAN=no and will try the copy from /etc/kernels/<> on the next go 'round.

----------

## Faraclas

I just pulled the latest gentoo sources and this method indeed worked great. thanks again for the help!

----------

## vasettoo

I am using a different approach - to be on the safe side I use config file(s) from /etc/kernels directory with genkernel:

```
genkernel --menuconfig --kernel-config=/etc/kernels/<"choose kernel config here"> all
```

This way compiling can be done on previous config options for ease.

----------

