LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   cannot make a custom kernel work (https://www.linuxquestions.org/questions/linux-general-1/cannot-make-a-custom-kernel-work-332393/)

dannyk1 06-11-2005 12:22 AM

cannot make a custom kernel work
 
I have been trying for a few days now to compile a custom kernel but can never get the new one to boot.

On a system running FC3, and after reading plenty of contradicting howto's I have tried about 8 times now but getting nowhere.

When I run make xconfig and load the file config-2.6.9-1.667smp from the /boot dir, even when I make no changes, or just a few like including ex3 support I get
kernel panic cannot find root file system

My understanding is that the config-2.6.9-1.667smp file should be what fedora uses for this system so it should be the same as the standard kernel. So why is it when I look at this config it doesn't even have ex3 support included in the kernel?

Any hints on how to make a working kernel would be great..

ps ..
My grub conf is

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/hda3
# initrd /initrd-version.img
#boot=/dev/hda
default=0
timeout=10
splashimage=(hd0,0)/grub/splash.xpm.gz

title Fedora Core (2.6.9-1.667smp)
root (hd0,0)
kernel /vmlinuz-2.6.9-1.667smp ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.9-1.667smp.img
title Fedora Core-up (2.6.9-1.667)
root (hd0,0)
kernel /vmlinuz-2.6.9-1.667 ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.9-1.667.img


title Custom Kernel 2.6.11
root (hd0,0)
kernel /vmlinuz-2.6.11 ro root=LABEL=/

Simon Bridge 06-11-2005 04:59 AM

(Painful isn't it - it's a rite of passage.)

OK - you havn't pointed GRUB to the new initial ram-disk. (That's the initrd line in the original GRUB.conf) ... you need this to access the root filesystem in GRUB

see "man mkinitrd" .

(Did you copy a file called vmlinuz-2.6.11 into /boot? Just checking.)

Congratulations - after this you will be halfway to guru-hood :)

[begin general discussion]
I know what you mean about the conflicting instructions out there. I do not know where these guys are coming from - they seem pretty genuine - but their instructions never work by themselves. Occasionally there is a clear HOWTO ... but usually specific to a particular architecture which is never yours.

I discovered, from many sets, that the procedure is actually quite simple - provided you are not trying to be fancy or use weird configurations (i.e. Grub is in MBR and root is in an IDE drive, there is a separate boot partition ... etc).

You've done it -

make xconfig
(painstakingly pick through the options - and save to a file before you finish)
(this is the hardest part ... it will need to be repeated several times before you get it right. Even then, monts down the track you'll try to run something and find out that you forgot to compile the module.)
... then something like ...

make (could be "make install")
make modules
make modules install

copy (or move) the kernel image into /boot (It's often right at the bottom of the source tree.)
mkinitrd <new version>

edit grub.conf
copy the old entry to a new location
change the title name
change version numbers to correspond to the kernel image and the initial ramdisk

This sound familiar?
(If you did anything different, say so, and it'll help other folk following in your footsteps.)

BTW: if you miss a module in xconfig - you can rerun xconfig, then do make modules - make modules install again without needing to recompile the kernel. The only time you have to recompile the entire kernel is if the "m" option is not available (or this dosn't work ...)

Now I had to dig all this out of about a dozen locations and over 30 A4 pages of 8-point text.


dannyk1 06-11-2005 08:22 PM

Thanks for the response.

I copied the existing initrd from the old kernel and finally got it to boot!

Do I need to make a new one to suit my kernel?

Its strange that of all the Howtos I have read, not one has mentioned the ramdisk bit.. Or how to make one.

ps ..

More importantly, when do I achieve guru-hood :)
(Just kidding).

cedar 06-11-2005 08:40 PM

if you add make install after make modules_install it automatically adds an entry in grub for the new kernel and copies the kernel image to /boot

can't say anything about initial ramdisk as I've never used it in a custom kernel

one more step to guru-hood :D

Simon Bridge 06-12-2005 05:01 AM

cedar: you're using LILO or you do not use a boot partition? (see man mkinitrd for details of why it is needed.)

dannyk1: I'd have said you'll want a new one to suite your kernel - avoids possible trouble later. It's purpose is to load a minimum driver set for GRUB to reach your root partition and generlly check things out. The newer kernel will have better drivers - that's all. As you've figured out, you don't need the latest drivers to get things going, and when the new kernel image has booted, the initrd drivers are no longer loaded anyway.

Well done.
The rest is experience ... you've just taken a big step ... and reputation.
Next project - set up a LAN.
But first - you deserve a stiff drink.

cedar 06-12-2005 07:20 AM

I use grub, but not a separate boot partition. That would explain why I never needed it before.


All times are GMT -5. The time now is 09:50 PM.