# KC10: Reusing config when upgrading

## IWBCMAN

KC10. I'm upgrading my kernel sources. Can I use my old configuration? If so, how?

If you wish to maintain as much of your old kernel configuration as possible when installing your new kernel, copy /usr/src/linux/.config to your new kernel tree (1), then switch to the base source directory (2) then delete the symlink pointing to linux (3) and re-link linux to your new kernel tree (4), now enter your new linux directory (5) and run make oldconfig (6) - this attempts to preserve existing kernel configurations - you will be prompted to make choices regarding new kernel options (and if you don't know whether or not to enable some option, simply pressing <return> usually selects "No". Once you have completed this step, then you should run make menuconfig (or make xconfig) (7) and then carefully look over the sections involved in selecting file systems, printer setup, usb setup and possible scsi emulation-the time spent here can save much time and many needed re-compiles later. After you have finished configuring the kernel, you must compile and install your new kernel. (8-17) (in step format:)

[1] cp /usr/src/linux/.config /usr/src/linux-2.x.xx-yyyyyy/.config

[2] cd /usr/src

[3] rm linux

[4] ln -s linux-2.x.xx-yyyyyy linux

[5] cd /usr/src/linux

[6] make oldconfig

[7] make menuconfig or make xconfig

[8] 2.4.x:make dep clean bzImage modules modules_install

2.6.y:make && make modules_install

[9] mount /boot (where /boot is an entry in your /etc/fstab, which should [normally not be mounted during normal use)

[10] mv /boot/bzImage /boot/bzImage.old

[11] cp /usr/src/linux/arch/i386/boot/bzImage /boot/bzImage

[12]  edit /boot/grub/menu.lst and add an entry for your new kernel and replace the reference to bzImage in your previous kernel entry to point to the deprecated kernel file (bzImage.old)

[13] if you are using nvidia- emerge nivdia-kernel

[14] 2.4.x only: if you are using alsa - emerge alsa-driver

[15] edit /etc/modules.autoload.d/kernel-2.{4,6} to reflect any changes in modules to be auto loaded 

[16] unmount /boot (ie. umount /boot)

[17] shutdown -hr now

and voila you new kernel entry should appear in the grub menu waiting to be tried....

I know it's a bit long-but sometimes being pedantic is helpful !!!

EDIT (rac) some cleanup.  Thanks to rbacon2 and Sesshomaru for contributions to this entry.

2004-10-26: 2.6 changes  --kallamej

----------

