# Kernel recompile: does it save previous changes? [SOLVED]

## Steve S.

Ok, this should be an easy answer for one of you kernel compiling super-stars: if I recompile the kernel, do I have to start from scratch with menuconfig or does it keep the previous settings I've done with menuconfig?

I've got my Gentoo box set up exactly like I want, except I got no sound.  Alsaconf says there are no cards and all the set up instructions I see say that I gotta recompile with alsa support (thought I did that, but oh, well).  I can recompile, no problem, just don't want to go back through all the settings I did the last time and have to recall what they were and get them set up again.  Hoping that I can just go in, change the alsa settings, compile, then get out.

Please advise and, if I don't need to recompile, what do I need to do to get sound working?Last edited by Steve S. on Thu Mar 11, 2010 1:46 am; edited 1 time in total

----------

## Naib

recompiling a kernel will use (if present) the .config file in the kernel src directory

kernel upgrading can be pre-seeded with old settings as well

----------

## pdr

After running "make menuconfig" you have a new file /usr/src/linux/.config - this is all your kernel config settings. So - yes, they are remembered.

And if you upgrade the kernel you can do the usual (remove the current /usr/src/linux symlink and point it to the new kernel's directory) but then copy that old .config file into the new kernel's directory and run "make oldconfig" - it will an settings you had before that still apply, and ask you about any new items in the new kernel.

----------

## Steve S.

 *Naib wrote:*   

> recompiling a kernel will use (if present) the .config file in the kernel src directory
> 
> kernel upgrading can be pre-seeded with old settings as well

 

Wow; love how quick you guys are with an answer on this forum.

Thanks, Naib, but just for full clarification: if that file is present, I can just sneak in, make sure alsa is set up, recompile and I will still have my previous settings along with the newly configured alsa, right?

----------

## Mike Hunt

You still need to run make oldconfig on the old .config file to be sure to catch other changes in the new kernel version.

See /usr/src/linux/README -> CONFIGURING the kernel:

----------

## Steve S.

Thanks to Naib, Mike and pdr: the quick responses are very appreciated.

Ok, I'll check out the README and go through the steps you have all outlined.

As per correct forum protocol, I'll post back the results and call this thread solved or not, etc.

I plan on recompiling tonight, so hopefully all will be well when I post back later...

----------

## Steve S.

I know it is poor form to reply to myself, but I been doing some further reading.

According to this:

 *Quote:*   

> 
> 
> A much safer upgrading method is to copy your config as previously shown, and then simply run make menuconfig. This avoids the problems of make oldconfig mentioned previously, as make menuconfig will load up your previous configuration as much as possible into the menu. Now all you have to do is go through each option and look for new sections, removals, and so on. By using menuconfig, you gain context for all the new changes, and can easily view the new choices and review help screens much easier. You can even use this for upgrades such as 2.6.8 to 2.6.9; just make sure you read through the options carefully. Once you've finished, compile and install your kernel as normal.
> 
> 

 

I know that is referring to upgrading, but I think the concept applies, yes?  So I plan on running

```

make menuconfig

```

with the old (only by a couple of days) sources using the old config file and that should keep the changes and allow me to make the alsa mod then run

```

make

```

and I should be good to go, eliminating the need to run oldconfig.

If that is incorrect, please advise, otherwise I will run that tonight and go from there.  Any feedback at all is, of course, very greatly appreciated, as this whole compiling thing is something unique to me with this install of Gentoo, even after my first install of Gentoo 5 + years ago and many linux's since.

----------

## Mike Hunt

Yes, make menuconfig is a much more efficient way to do it.

The make oldconfig option is a shortcut that works quite well, but a full make menuconfig is essential from time to time.

Generally the unwritten rule of thumb is to do make oldconfig for minor version updates, i.e. from -r6 to -r7

and run make menuconfig for major version updates.

----------

## Steve S.

 *Mike Hunt wrote:*   

> Yes, make menuconfig is a much more efficient way to do it.
> 
> The make oldconfig option is a shortcut that works quite well, but a full make menuconfig is essential from time to time.
> 
> Generally the unwritten rule of thumb is to do make oldconfig for minor version updates, i.e. from -r6 to -r7
> ...

 

But since I am not doing an upgrade but instead just adding one modification, menuconfig should still be good, right?  Logically it looks like that will work fine...I'll run make menuconfig after the old config file has been copied over (isn't it already in the correct place?) and just check to see if some of the mod's I did last time are selected or not, then get alsa going then run make and it should be all good, in theory.  Again, please correct me if I'm wrong...

----------

## Steve S.

Again, I know it is poor form, but I have a different yet related question: do I need to be using the livecd to run a kernel recompile?

I was assuming up to this point to use the instructions from here and run the livecd then chroot in then run make menuconfig as previously discussed.

But I hate assuming, so I am just going to ask to make certain that is necessary.  If it isn't and I can simply log in as root and take care of this, it certainly would make my life easier, but I didn't know if there would be complications in doing it that way rather by using the livecd...

...sorry for all the questions, but this whole recompiling things makes me nervous, especially since I did some work getting this wireless xfce gentoobox all set up thus far...

----------

## Mike Hunt

Well yes, obviously I misunderstood what you wanted to do. I was thinking it was about compiling a new kernel version update from new sources.

Changes to the current version are done via make menuconfig. 

Remember to mount your /boot (if applicable) before copying over the new kernel.

----------

## cwr

Generally not a bad idea, if you like the kernel configuration, to save

the .config file as eg: config.32-r1.ok so that you can copy it back

and re-use it if things go wrong.

Will

----------

## Mike Hunt

You can configure, compile and install a new kernel and it's modules on the currently running system. No need to reboot a CD.

----------

## NathanZachary

Moved from Installing Gentoo to Kernel & Hardware, as kernel recompilations typically happen after the Gentoo base system is installed.  :Smile: 

----------

## Steve S.

Thanks to all, especially for you patience.

...and thanks for moving.  

I'll post back with results...  :Cool: 

----------

## Steve S.

Recompiled, nothin' to it, thanks to info from this thread.  Very well done, all...I'm listening to stuff right now, so we are wired for sound!  Thanks and call this solved...  :Cool: 

----------

