LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-29-2003, 12:23 PM   #1
Kroenecker
Member
 
Registered: May 2003
Location: The States
Distribution: Gentoo
Posts: 245

Rep: Reputation: 30
New Kernel Compile


This is what I have done:

untar the kernel source in /usr/src/
tar xzvf (new-kernel)

delete the softlink rm /usr/src/linux

create a new link to my new kernel source ln -s /usr/src/kernel linux

make mrproper ==> This deletes the file .config! So if you want to compile using your old info then dont run this.

make menuconfig

make dep

make bzImage

make clean (I think it is appropriate here)

make modules

make modules_install

I copied the resulting ..../arch/i386/boot/bzImage to /boot/vmlinuz-2.4.22-new

cp /arch/i386/boot/bzImage /boot/vmlinuz-2.4.22-new

I copied the System.map to /boot/System.map-new

cp System.map /boot/System.map-new

I also have System.map-old and vmlinuz-2.4.22-old in /boot/

Finally I am using LILO.



Now my questions are (primarily out of curiosity)...

1) How do the two kernels distinguish what modules they need to be using in /lib/modules? Is there something that happens during the compile that points the kernel to the proper file in /lib/modules? In that case I cant really move those files around or rename them.

2) What does System.map do and why, if it is important, do I only have to specify only one of them in LILO? Wouldnt this somehow cause problems for me to use System.map-new when booting into vmlinuz-2.4.22-old?

Well I just found out: you should make a softlink System.map --> System.map-(using.this.one) to avoid errors when booting. What I read didnt give specifics though about whether or not the old/new conflict from 2) is a big deal or not....


3) After I compiled my new kernel, I began to get error messages about being unable to (not sure about terminology) run certain modules. I never had that happen before the compile. Why would something like this happen?

I am very picky about doing things incorrectly and having those errors pop up are particularly annoying. My guess is that System.map must indicate something about modules. I am scouring the internet until I find out. If you know something, though, please let me know.

Thanks.

Last edited by Kroenecker; 11-30-2003 at 08:33 PM.
 
Old 11-29-2003, 01:11 PM   #2
urka58
Member
 
Registered: Nov 2003
Distribution: slackware 14
Posts: 542

Rep: Reputation: 33
1) It doesn't . You should modify first the uncompressed new 2.4.22 Makefile. @ line EXTRAVERSION= adding something like myker or whatever you like in order to create a new /lib/modules/2.4.22myker directory containing the modules required for the fresh compiled kernel.
2) It is not very important as it tell the kernel what is your configuration that will slighty differ from the previous one. Anyway put in /boot the new System.map.
The old kernel will properly work with the new System.map as well.
3) This should be due to @1) reasons
Ciao
 
Old 11-29-2003, 01:23 PM   #3
Kroenecker
Member
 
Registered: May 2003
Location: The States
Distribution: Gentoo
Posts: 245

Original Poster
Rep: Reputation: 30
Hey urka58,

Thanks for the reply! Yeah, I used the EXTRAVERSION line to make sure that I would not install over my old modules. I guess what I am curious about is how are those modules accessed by the kernel that I boot? If I boot to vmlinuz-old how does it know to access /lib/modules/linux-old instead of /lib/modules/linux-new?

(Those arent the names of my modules directories of course

And as far as the system.map is concerned, yeah, I can boot into either kernel even if System.map --> System.map-new

I just want to know if there is a way to make sure that LILO calls the proper System.map for the proper kernel. That is all
 
Old 11-29-2003, 01:37 PM   #4
urka58
Member
 
Registered: Nov 2003
Distribution: slackware 14
Posts: 542

Rep: Reputation: 33
The kernel does it automatically.(sorry for the stupid response)
Look @ this
http://www-106.ibm.com/developerwork.../tutorials.jsp
there are a lot of nice explanations.
About System.map you the kernel chhose automatically his one if you leave the old System.map in /boot directory,
I guess it will not work to make new System.Map to point the old one or viceversa
Ciao
 
Old 11-29-2003, 01:44 PM   #5
spurious
Member
 
Registered: Apr 2003
Location: Vancouver, BC
Distribution: Slackware, Ubuntu
Posts: 558

Rep: Reputation: 31
Thanks for asking this question; I've been trying my hand at recompiling my kernel (first time), and am getting problems with the modules too.

1) I think that the modules path is defined by the kernel version string. For example, before you make bzImage, try editing the /usr/src/linux/Makefile. At the top of the file, you will see a set of variables: VERSION, PATCHLEVEL, SUBLEVEL, and EXTRAVERSION. The first three define the numeric version of your kernel (e.g. 2.4.22). The EXTRAVERSION variable is for any custom string that you want to add to the kernel version; you can add your own here, such as "-custom-031129".

When you make bzImage, the kernel's version, as indicated by the command `uname -r` will be VERSION.PATCHLEVEL.SUBLEVEL+EXTRAVERSION e.g. 2.4.22-custom-031129.

If you remove your prior /lib/modules/2.4.22 directory (and back it up), then do make modules, make modules_install, the new modules path will be named after the new kernel's version (probably through the use of `uname -r`) e.g. /lib/modules/2.4.22-custom-031129.

2 & 3) I don't know what System.map does, but I'd be interested to find out. I've read it, it's a plain text file, but pretty cryptic.

I am also getting errors with modules compiled after a kernel recompile, but l think it has to do with conflicts with prior module dependencies. Still working on this.

You might find kernelnewbies.org helpful.
 
Old 11-29-2003, 01:58 PM   #6
Kroenecker
Member
 
Registered: May 2003
Location: The States
Distribution: Gentoo
Posts: 245

Original Poster
Rep: Reputation: 30
Well I just found this and it gives a couple hints at the end

from http://www.skybuilders.com/products/...wToKernel.html

Specifically, one should run the following after finishing all kernel compiling and copying files around etc...

depmod

mkinitrd

Well, maybe depmod will solve our problems? That is my guess.

As for mkinitrd I have seen some people complain about not being able to reboot when they have installed, say, their root partition in the ext3 format. I think that stuff like that will be taken care of by mkinitrd.

So if anyone has that problem use

mkinitrd /boot/initrd-2.4.19.img 2.4.19

"initrd-2.4.19.img is the name of the image that you are creating. You can give the name you want to that file but you will have to specify the same name on lilo.conf or grub.conf (see below). 2.4.19 is the name of the kernel found from /lib/modules that you need to use to build the initrd image."
courtesy of this website:

http://www.linuxadvisory.com/article15-page4.html

Take a look at the link so that you can see how to edit lilo or grub to use the new initrd file

Well spurious and urka58, if I figure anything else out I'll post again!
 
Old 11-30-2003, 08:15 PM   #7
Kroenecker
Member
 
Registered: May 2003
Location: The States
Distribution: Gentoo
Posts: 245

Original Poster
Rep: Reputation: 30
Hey Spurious,

I have found that (and maybe youve found this too by now) by editing modules.conf you can eliminate the errors like char-major not found. Last night I was having errors about something to do with LVM and although I havent fixed them yet, the proper settings in modules.conf will definitely do the trick. Unfortunately I am still a little bit shady about what to write The following is from a post that I found online:

> On Sun, 28 Oct 2001 03:07:19 -0500, Sparhawk said:
> > INIT: version 2.82 booting
> > Bringing up the loopback interface.modprobe: modprobe: Can't locate
> > module net-pf-9 [ OK ]
>
> You need to put
> alias net-pf-9 off
> in you /etc/modules.conf file
> It some kind of networking module, unfortunaly I don't recall what it's
good
> for. If you don't know what it is, you can safely disable it with the line
> above.
>
> > Setting clock.modprobe: modprobe: Can't locate module char-major-10-135
> > [ OK ]
>
> You should put
> alias char-major-10-135 rtc
> in /etc/modules.conf
> It's because you compiled Real Time Clock support as a module in the
kernel.
> Also make sure you have
> crw-r--r-- 1 root root 10, 135 Aug 2 20:39 /dev/rtc
>
> or similar for /dev/rtc

One has to run depmod -a (not sure what -a is for...just havent looked at the man page yet) after doing this to make sure everything is in synk.

Anyway, this isn't specific to my problem but the general idea applies.

Later

Last edited by Kroenecker; 11-30-2003 at 08:18 PM.
 
Old 12-01-2003, 11:12 AM   #8
spurious
Member
 
Registered: Apr 2003
Location: Vancouver, BC
Distribution: Slackware, Ubuntu
Posts: 558

Rep: Reputation: 31
Thanks for the advice about depmod; I'm staying away from initrd because I keep getting kernel panics with it, even when I compile filesystem support directly into the kernel instead of modules.
 
Old 12-21-2003, 12:15 AM   #9
Kroenecker
Member
 
Registered: May 2003
Location: The States
Distribution: Gentoo
Posts: 245

Original Poster
Rep: Reputation: 30
Yo Spurious,

Well I finally found a place where we can answer our questions about the System.map file.

Enjoy

www.dirac.org/p/linux/system.map/

It is an easy read. I am glad to finally understand what that file is used for! Just a detail freak I guess.
 
  


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
upgraded kernel, won't let me compile kernel once Suspend2 patches are applied microsoft/linux Linux - Laptop and Netbook 3 10-02-2005 03:37 PM
I want to compile 2.6 kernel and keep everything from 2.4 intact (dual kernel system) sina_kish Linux - Software 7 02-02-2005 10:01 AM
Kernel Problems. Howto Compile a new kernel from 4.2 with backwards compatibility ? ShoCkwave Linux - General 2 06-19-2004 07:02 AM
can i compile just one kernel module whithout recompiling the whole kernel? edman007 Linux - Software 3 02-17-2004 04:05 PM
Kernel 2.4.23 compile causes kernel panics on ATA RAID-1 (mirror) array Raptor Ramjet Slackware 3 12-18-2003 02:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:23 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration