Saving, Reusing Your Kernel Configuration Files

The kernel configuration is saved in the /usr/src/linux/.config file. There's a backup for it in /boot/config-<version>, it's good to keep it as a reference. But also save your own configurations for different kernels, as this is just a matter of giving different names to configuration files.

One possibility is to name configuration files after the kernel version. Say you modified your kernel version as shown the section called “Configuring The Kernel”, then you can do:

$ cp .config /root/config-2.4.22-foo

If you decide to upgrade to 2.4.24 (for example), you will be able to reuse this file, as the differences between the configuration of these two kernels will be very small. Just use the backup copy:

$ cp /root/config-2.4.22-foo .config

But copying back the file doesn't mean that the kernel is ready to be compiled just yet. You have to invoke make menuconfig (or whatever else you chose to use) again, because some files needed in order for the compilation to succeed are created and/or modified by these commands.

However, apart from the chore of going through all the menus again, you can possibly miss some interesting new option(s). You can avoid this by using make oldconfig. It has two advantages:

  1. it's fast;

  2. if a new option appears in the kernel and wasn't present in your configuration file, it will stop and wait for you to enter your choice.

Tip

After you have copied your .config to the root home, as proposed above, run make mrproper. It will ensure nothing remains from the old configuration and you will get a clean kernel.

Next, time for compilation.