LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 04-17-2006, 07:40 PM   #1
brgr88
Member
 
Registered: Apr 2006
Distribution: Slackware 14
Posts: 46

Rep: Reputation: 15
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!
 
Old 04-17-2006, 08:10 PM   #2
dcdbutler
Member
 
Registered: Jan 2005
Location: Boston
Distribution: slackware
Posts: 502

Rep: Reputation: 30
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

Last edited by dcdbutler; 04-17-2006 at 08:11 PM.
 
Old 04-17-2006, 08:13 PM   #3
masonm
Senior Member
 
Registered: Mar 2003
Location: Following the white rabbit
Distribution: Slackware64 13.37 Android 4.0
Posts: 2,248

Rep: Reputation: 46
Always keep a backup copy of your working kernel. If the new one fails you can boot to the working one.
 
Old 04-17-2006, 08:30 PM   #4
brgr88
Member
 
Registered: Apr 2006
Distribution: Slackware 14
Posts: 46

Original Poster
Rep: Reputation: 15
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.
 
Old 04-17-2006, 08:49 PM   #5
geomatt
Member
 
Registered: Mar 2004
Location: PA
Distribution: Slackware 12.0
Posts: 315

Rep: Reputation: 30
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

Last edited by geomatt; 04-17-2006 at 08:52 PM.
 
Old 04-17-2006, 11:14 PM   #6
dennisk
Member
 
Registered: May 2004
Location: Southwestern USA
Distribution: CentOS
Posts: 279

Rep: Reputation: 30
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
 
Old 04-18-2006, 01:15 AM   #7
BobNutfield
Senior Member
 
Registered: Dec 2005
Location: United Kingdom
Distribution: Fedora , Ubuntu, Slackware-Current
Posts: 1,477

Rep: Reputation: 51
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
 
Old 04-18-2006, 06:01 AM   #8
Alien_Hominid
Senior Member
 
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
brgr88, yes, you are right, except if you compile 2.6 kernel, you shouldn't run make dep.
 
Old 04-18-2006, 06:51 AM   #9
ioerror
Member
 
Registered: Sep 2005
Location: Old Blighty
Distribution: Slackware, NetBSD
Posts: 536

Rep: Reputation: 30
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Kernel compile fails with make-kpkg, not with make cspos Debian 37 11-09-2005 09:11 AM
10.1 install kernel and kernel-source different - build fails Feebles Mandriva 2 06-10-2005 06:58 PM
kernel compile on x86_64 fails acidjuice Linux - Software 1 05-06-2005 04:30 PM
Mandrake 10 off. 2.6.3 kernel fails to compile... why???? Samppa72 Mandriva 1 07-23-2004 08:55 PM
New Debian kernel fails to compile rickenbacherus Linux - Software 1 07-19-2003 08:56 AM


All times are GMT -5. The time now is 08:54 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration