LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   How to restore out-of-box kernel settings if my kernel compile fails? (https://www.linuxquestions.org/questions/slackware-14/how-to-restore-out-of-box-kernel-settings-if-my-kernel-compile-fails-436191/)

brgr88 04-17-2006 07:40 PM

How to restore out-of-box kernel settings if my kernel compile fails?
 
In the SlackBook, chapter 4, it covers compiling a new kernel, something I've never been able to do before and still be able to boot my system -- this time, I'm determined to get it right.

The first step it tells me is to backup /usr/src/linux/.config, then these steps:
1. make mrproper
2. make config
3. make dep
4. make clean
5. make bzImage
6. make modules
7. (some cp/mv commands)
8. make modules_install

My question is, if I screw up a kernel compile with these instructions, can I just restore the backed up copy of .config and then redo those steps starting at #3 to put me back where I started from, which is basically Slackware out-of-the-box?

I'm asssuming that steps 1 & 2 clear out the .config file and make a new one, so that if I skip them and restore the out-of-box copy of .config, I'll be able to proceed with #3 to restore all the modules back to the way they were? After that I'll go back to try & figure out what went wrong...

Thanks!

dcdbutler 04-17-2006 08:10 PM

You may find this guide helpful for compiling the kernel. This is the one I followed.

Always keep at least one backup kernel in case you can't boot into the one you're compiling. This is explained in the guide in the section about editing lilo.conf. That way you can play around with kernel compiling and be sure of being able to reboot onto your backup kernel if not the new one.

Good luck

masonm 04-17-2006 08:13 PM

Always keep a backup copy of your working kernel. If the new one fails you can boot to the working one.

brgr88 04-17-2006 08:30 PM

dcdbutler & masonm, thanks for the advice; however, I'm not necessarily trying to upgrade, but just know how to get everything back to the way it was and I'm thinking that restoring the original .config and re-compiling from there would do it. That's basically what I'm curious about.

geomatt 04-17-2006 08:49 PM

You can perfectly well have 2 or 3 or more kernels on your system at once. Just configure lilo to offer you a choice, as per the instructions referenced by the others who responded. That way if you try to boot into the new kernel, and it fails, you can reboot into the working kernel without needing to recompile it. It stays built as long as you do not overwrite it. If you just give it another name and then add a new entry into lilo.conf and enable the boot prompt, you can choose which kernel to boot. And save the .config file somewhere else in case you want to retweak from the original starting point. You can also always access the current configuration by running "zcat /proc/config.gz"


-geo

dennisk 04-17-2006 11:14 PM

Either way you want a known good kernel to boot to, just in case something goes wrong. See the sticky "This is how I do it all" for details on doing this.

Dennisk

BobNutfield 04-18-2006 01:15 AM

Hi, I just went through the same routine and I just wanted to emphasize one point that geomatt has already told you (the instructions in some place are not totally clear on this.) When you get to the step that you cp/mv arch/i386/boot/bzImage /boot/?, make sure you are naming your new kernel something different than the working kernel you want to keep in reserve. Some instructions tell you to copy to /boot/vmlinuz and if that is the name of the current working kernel, it is going to be overwritten.

Hope that helps,

Bob

Alien_Hominid 04-18-2006 06:01 AM

brgr88, yes, you are right, except if you compile 2.6 kernel, you shouldn't run make dep.

ioerror 04-18-2006 06:51 AM

Quote:

cp/mv arch/i386/boot/bzImage /boot/?
There's no need to do this manually anymore, 2.6 has the kernelinstall script feature through which you can automatically add the version onto the name while installing (I use this to create a package rather than installing the kernel manually).

Also, you shouldn't really use /usr/src/linux, but rather /usr/src/linux-<version>. The source dir will be symlinked via /lib/modules/<version>/build anyway, so third party modules etc can always find the src.


All times are GMT -5. The time now is 08:04 AM.