-   Linux - General (
-   -   Newbie Kernel re-compile disaster (

Neorio 10-20-2003 09:43 PM

Newbie Kernel re-compile disaster
I tried getting Kernel 2.4.22 source onto Red Hat 9 but I seemed to have wrecked the system completely. The Kernel HOWTO needs a rewrite I think... obviously it's still not idiot proof. :(

I went and unpacked the source into the /usr/src directory. I then went and make the kernel according to instructions. Went and made a bzImage and copied it to /boot, and then adjusted grub so that it would boot.
Also I had to copy kernel .config files... but with the RedHat kernel, I couldn't find these anywhere. So I just ignored them hoping the new kernel would reconfigure itself.

Also, I noticed that a initrd file needed to be set in GRUB, but I have no idea how to go about making such a file. The HOWTO wanted me to copy a "linuxrc" file into a directory, but a search of the system didn't find me one of these files anywhere.... so I just kept the initrd from the old kernel.

When I tried booting in, the kernal just hung.... it got stuck somwhere around the agp...something-or-other section... but with no error message.
So then I tried booting back into the 2.4.20-22 kernel again, only to have the kernel panic, complete with flashing keyboard lights.

How do you make the initrd file anyway?
Also, when I started xconfig for selecting what goes into the kernel... does it select appropriate modules by default?



Scruff 10-21-2003 12:32 AM

I can probably answer a few of your questions. I am no kernel expert, but i have managed the last 10 (or so) attempts successfully.

I don't use grub either. But, when I do a kernel compile I rename the original kernel to something like vmlinux.old (same with and change the appropriate lines in LILO so that I have an extra boot choice to get to the old kernel just in case. I do this before I even begin. Then, I use make menuconfig because its a little easier to get through all the kernel options IMHO. It includes an option to load a config file, which might be the thing to do since, no: a new kernel will not select appropriate modules by default. You can choose to load your old config which prob works ok, and go through and eliminate everything you know you don't need, and add the things you do. The config file you would copy to boot should be located in the /usr/src/ directory that you compiled the kernel in.

I am not real sure about your other questions. Never had to deal with making initrd in Slackware.

A few commands you might like to know, that will help you find things are $whereis "file" (no quotes), $locate "file" (might have to do updatedb first as root), and: $find.

If you don't know of the exact name, you can use something like $whereis afile* and it will find anything starting with afile. You could use it like: $locate *.jpg and it would find all jpgs on your system. Get the idea? ;)

Good luck!

Neorio 10-21-2003 12:57 AM

OK, here's my second attempt... (currently doing the make bzImage rounds)

OK... it appears my kernal configs were screwed up from last time, hence the crash. Some important modules got skipped on config it seems...
Found the config files for Red Hat 9 (hidden away on it's own directory). I had no idea that those config files had anything to do with how the kernal gets configured *slaps head* so I loaded the old configs I found into the xconfig setup. Seems there's a lot of stuff in there. I had to change the processor type to PIII as well, plus I ripped out some of the USB, ISDN, Sound, Ham-Radio modules as I won't need them. BTW, this PC is a server with SCSI HDs only... and the SCSI drivers are treated as modules in the kernal. Hope this works..................

About this initrd file.... in GRUB, I'm wondering if I can skip it alltogether? I'm hoping.........

Since I have 3 SCSI hard disks that need starting on boot up, I wonder how one writed the linuxrc file?

Scruff 10-21-2003 01:04 AM

Sounds like your on the right track :)

/etc/fstab is where you can find/edit your disk mount options.

lupin_the_3rd 10-21-2003 09:31 AM

You don't need the initrd... just make sure grub is pointing to your root partition and not /=LABEL.... you could also copy your old kernel config (since you know it works) from /boot to /usr/src/linux-2.4.22/... and use it as a starting point.

Neorio 10-23-2003 01:52 AM

Solved it... after many hours of frustration.

All my problems were in the kernel configuration.

First, I started off modularising most of the bits of the kernel... AGP, SCSI etc.

Screwed up another kernel reboot when I forgot to add ext3 support! so I built that in to the kernel.
Then I used mkinitrd command to make the initrd file.

One thing the whole experience tells me, is that you REALLY need to know your hardware when you rebuild kernels. One little mishap in kernel compilation with a missing part or module.... and your system does a kernel panic with lots of crytic errors which take you ages to decrypt.

zLinuxz 10-23-2003 02:38 AM

something that Linux teaches any person who is serious about learning Linux, is that it develops a deep appreciation and understanding for your machine and how it works. And that is one of the millions of reasons why I love Linux, :)
Glad to hear that you learnt how to compile your kernel!!!

I still remember how that felt when I first understood and learnt how to do it as well. I used to be so afraid of simply hearing "you need to recompile your kernel", hehe, that used to be death to me. But now I just love recompiling my kernel all the time, hehhe.



Neorio 10-23-2003 03:52 AM

Yeah, I learnt a lot alright... after recompiling the kernal at least ten times over two days, I can now do 'nohup make bzImage &' in my sleep.

Also learnt which modules do what, and how I can toy with specific details of the system. By leaving out the odd driver somewhere, a Windows CD ends up with short filenames, and a missing file system means the system won't boot at all! And I had no idea that the APM had anything to do which sync-ing the hardware clock.

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