LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-08-2008, 04:54 PM   #1
bogzab
Member
 
Registered: Mar 2006
Location: Dyserth, Wales
Distribution: Slackware 13.37, Slackware 14.0
Posts: 270

Rep: Reputation: 31
Re-compiling the Slackware kernel


I need to re-compile the Slack-12 kernel (2.6.21.5-smp) with some different options (to do with getting standby / suspend / hibernate functionality working on my laptop).

My question is not so much to do with the kernel itself but the need to put copies of the relevant kernel .config and System.map files into the /boot directory. I have in the past followed the advice in http://shilo.is-a-geek.com/kernel14.html which suggests copying these files from the /usr/src/linux-xxxx directories where you build the kernel and remaking the symlinks so that System.map in /boot points to the new System.map-xxxx and .config points to the new .config-xxxx.

My question is : if you adopt this method and provide a new lilo start-up option for the new kernel, then the old kernel will not have the correct System.map and .config files referenced in /boot. Does that matter? What use is made of these files ?

Thanks for any light shed.
 
Old 04-08-2008, 05:01 PM   #2
duryodhan
Senior Member
 
Registered: Oct 2006
Distribution: Slackware 12 Kernel 2.6.24 - probably upgraded by now
Posts: 1,054

Rep: Reputation: 46
short answer : forget the system.map and .config file ... it will work fine without them

Other than that , you don't need to recompile the kernel in /usr/src/* ... you should infact compile it as a normal user , say in your ~ or something.
 
Old 04-08-2008, 05:16 PM   #3
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,298

Rep: Reputation: 722Reputation: 722Reputation: 722Reputation: 722Reputation: 722Reputation: 722Reputation: 722
duryodhan gives good advice -- I always compile my kernel in a special directory in my home directory (~/kernels, if you must know), and as a normal user. The ONLY steps you need to run as root are `make modules_install` and copying stuff to /boot. That way I know it's basically impossible to mess up my system when building a kernel.

It should also be noted that you may wish to compile a kernel newer than 2.6.21.5 if you are compiling a kernel anyway -- suspend/hibernate has REALLY improved since then. On a side note, I copy System.map to /boot and symlink it, but have forgotten in the past and my system has never had any ill effects. I only recently started copying my .config to /boot just in case I accidentally delete it in my ~/kernels directory, but it's really not necessary -- even if you do accidentally delete it, all that is required is running `zcat /proc/config.gz > /boot/config-kernelversion` and it will recreate it for you (assuming you've enabled /proc/config.gz support in the kernel -- it is enabled in the default Slackware kernels already).
 
Old 04-08-2008, 05:25 PM   #4
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Lubuntu
Posts: 19,176
Blog Entries: 4

Rep: Reputation: 430Reputation: 430Reputation: 430Reputation: 430Reputation: 430
I usually follow the advice in Alien Bob's dokuwiki, it's never steered me wrong.
 
Old 04-08-2008, 05:33 PM   #5
mike_mck2
LQ Newbie
 
Registered: Feb 2008
Location: Texas
Distribution: Slackware
Posts: 16

Rep: Reputation: 0
I could never get a recompiled kernel to work without relinking the System.map and vmlinuz files.

In fact, I ended up downloading the Installkernel script and just using make install in the kernel directory to simplify everything.
 
Old 04-08-2008, 08:47 PM   #6
digger95
Member
 
Registered: Oct 2007
Location: Indiana, PA
Distribution: Slackware 14
Posts: 330

Rep: Reputation: 45
Bogzab just a quick comment...

As long as you are compiling a new kernel you might just think of upgrading as well. There were some acpi issues with 2.6.21.5 that were resolved with later kernels (at least on my machine). I'm using the generic 2.6.24.4 kernel now and couldn't be happier. Didn't even recompile it. Just downloaded and installed the kernel and kernel modules packages from -current, made an initrd, edited lilo.conf, and off I went. My standby, hibernate, etc. all work flawlessly now.

Dig
 
Old 04-09-2008, 01:46 AM   #7
bogzab
Member
 
Registered: Mar 2006
Location: Dyserth, Wales
Distribution: Slackware 13.37, Slackware 14.0
Posts: 270

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by digger95 View Post
Bogzab just a quick comment...

Just downloaded and installed the kernel and kernel modules packages from -current, made an initrd, edited lilo.conf, and off I went. My standby, hibernate, etc. all work flawlessly now.

Dig
Thanks (all) for the advice which seems to be to upgrade - already got the 2.6.24 sources and will build this. The only step that sounds unfamiliar in the above is "made an initrd" - any pointers as to how you do this? Looking forward to flawless standby & hibernations...
 
Old 04-09-2008, 03:17 AM   #8
digger95
Member
 
Registered: Oct 2007
Location: Indiana, PA
Distribution: Slackware 14
Posts: 330

Rep: Reputation: 45
Quote:
Originally Posted by bogzab View Post
The only step that sounds unfamiliar in the above is "made an initrd" - any pointers as to how you do this?
Simple answer: You likely won't need to. I used the generic kernel as-is (no recompile), and by doing so I needed to create an initrd (initial ramdisk) to load modules the root filesystem requires. There is a readme in /boot that explains this. But since you are compiling your own kernel from source, you should not need to do this. I'm new to this though, so if someone has a better explanation than mine please correct me.
 
Old 04-09-2008, 02:16 PM   #9
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Ruhr Area, Germany
Distribution: Slackware64 14.0
Posts: 1,525

Rep: Reputation: 94
Quote:
Originally Posted by bogzab View Post
The only step that sounds unfamiliar in the above is "made an initrd" - any pointers as to how you do this? Looking forward to flawless standby & hibernations...
See also alienbob's script that eases this task a lot: http://www.linuxquestions.org/questi...-issue-633412/
 
Old 04-09-2008, 10:20 PM   #10
duryodhan
Senior Member
 
Registered: Oct 2006
Distribution: Slackware 12 Kernel 2.6.24 - probably upgraded by now
Posts: 1,054

Rep: Reputation: 46
In general, if you compile in your root fs (Y instead of M) you don't need an initrd and can save yourself a lot of pain.
 
Old 04-09-2008, 10:47 PM   #11
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,298

Rep: Reputation: 722Reputation: 722Reputation: 722Reputation: 722Reputation: 722Reputation: 722Reputation: 722
Creating an initrd (initial RAMdisk) is only necessary if the kernel modules for the filesystem used by your root (/) partition are not built in to the kernel and are built as modules. The / partitions must be able to be read in order to boot up your system, and so the correct filesystem module must be loaded into RAM. If you compile your own kernel, you should just include the filesystems in the kernel instead of as modules (ie[*] instead of [m]) and you won't need an initrd. However, if you use the generic kernel that ships with Slackware (or if you build your root filesystem as a module in your kernel) you will need to build an initrd. Instructions for how to do so are located in /boot/README.initrd, which is a symlink to usr/doc/mkinitrd-1.1.2/README.initrd. Alien Bob's script, as titopoquito mentioned, is a useful way to determine which command you should use to generate an initrd for your particular setup. It isn't proven to work 100% of the time (as far as I know it's new...but it's possible that I just haven't heard about it until recently), but I haven't heard of a case where it generates an incorrect command. It should be noted that, even if your other partitions use other filesystems different than your / partition, you can still include them as modules in your kernel and not built-in to save space (eg. if you use FAT32-formatted USB keys once in a while, but not all the time, the module will only be loaded when you use the USB key and it won't take up space in RAM when you're not using a USB key); it will automatically load the correct modules itself (provided that you have built autoloading of modules into your kernel). Only the root filesystem must be compiled into the kernel to avoid using an initrd.

Good luck.

[edit]Looks like duryodhan beat me to it by a mile. Oh well. [/edit]

Last edited by T3slider; 04-09-2008 at 10:49 PM.
 
Old 04-10-2008, 04:27 PM   #12
bogzab
Member
 
Registered: Mar 2006
Location: Dyserth, Wales
Distribution: Slackware 13.37, Slackware 14.0
Posts: 270

Original Poster
Rep: Reputation: 31
Many thanks to all who helped with this query. Result : Kernel 2.4.24.4 built, initrd stuff done and suspend function working. Also understand a bit more about the boot process than I did. Just some funny stuff about how the KDE module (Klaptop) controls the power states, but no doubt not too hard to work it out. Thanks again.
 
Old 04-10-2008, 06:53 PM   #13
digger95
Member
 
Registered: Oct 2007
Location: Indiana, PA
Distribution: Slackware 14
Posts: 330

Rep: Reputation: 45
Hey that's really cool that you got everything worked out. Thanks for reporting back to let us know how it went for you. I compiled my first kernel just a couple weeks after switching to Slackware and well... let's just say my results were mixed. LoL. Great learning experience though. Sounds like you did a better job than me! I think you'll like the new kernel. It may take some tweaking, but you'll find the acpi implementation in 2.6.24.4 to be much better than in previous kernels.
 
  


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
slackware 10.2 compiling kernel sharathg786 Slackware 3 07-31-2006 05:08 PM
slackware 10.2: compiling the kernel? sharathg786 Slackware 2 07-31-2006 09:14 AM
Errors Compiling Kernel 2.6 on Slackware 10.2 - Old kernel headers required? Dave S. Slackware 8 03-04-2006 01:15 AM
Compiling new kernel with Slackware 10 madhatter2 Linux - Newbie 2 07-29-2004 05:08 PM
Compiling kernel 2.6.4 on Slackware 9.1 ProtoformX Linux - General 1 03-13-2004 11:41 AM


All times are GMT -5. The time now is 05:39 PM.

Main Menu
Advertisement
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