LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   kernel compilation; applying patch (https://www.linuxquestions.org/questions/linux-software-2/kernel-compilation%3B-applying-patch-74083/)

h/w 07-19-2003 11:03 AM

kernel compilation; applying patch
 
i had a coupla questions.
ok, so im tryin to apply the 2.4.22pre6 patch.

i currently am on the 2.4.20-13.8 kernel.

1. do i need to install the 2.4.21 (which is the
latest stable release), to apply the patch.
if not, i get an error while applying the patch.

2. i tried compiling the 2.4.21 kernel, and when i
reboot it, it gives me an error saying "unable to
mount root".
do u know what could have gone wrong while i was
compiling it? i had done a :
a. make oldconfig
b. make dep
c. make modules
d. make modules_install
e. cp arch/i386/boot/bzImage /boot/vmlinuz-2.4.0
f. cp System.map /boot/System.map-2.4.0
g. mkinitrd /boot/initrd-2.4.21.img 2.4.21

then edited the /etc/grub.conf to have this:
title Red Hat Linux (2.4.21)
root (hd0,2)
kernel /boot/vmlinuz-2.4.21 ro root=LABEL=/
hdc=ide-scsi
initrd /boot/initrd-2.4.21.img


can anyone tell me where and what could have gone wrong above? or if there is more for me to do?

thank you very much for your time. :-)

jailbait 07-19-2003 11:16 AM

1. do i need to install the 2.4.21 (which is the
latest stable release), to apply the patch.
if not, i get an error while applying the patch.

Yes

2. i tried compiling the 2.4.21 kernel, and when i
reboot it, it gives me an error saying "unable to
mount root".

One possible solution: Check to make sure that you included ramdisk support in the kernel.

h/w 07-19-2003 11:20 AM

hi, thnx for ur prompt reply.
ok, now when i do a "make oldconfig", i assumed it would keep the config from my existing kernel, and proceed.
so, i kept hitting enter at most prompts thinking it would be ok.

jailbait 07-19-2003 12:24 PM

I think that the first "oldconfig" must be introduced from outside the makefile. Thereafter it uses the previous oldconfig.

h/w 07-22-2003 12:33 AM

hey - thnx again.
ok, this is what i did exactly!

in my /usr/src dir :
a. bzip2 -dc /tmp/rajesh/linux-2.4.21.tar.bz2 | tar xvf -
b. bzip2 -dc /tmp/rajesh/patch-2.4.22-pre7.bz2 | patch -p1
c. cp ../linux-2.4/.config .
d. make oldconfig
e. make dep
f. make modules
g. make bzImage
h. make modules_install
i. cp arch/i386/boot/bzImage /boot/vmlinuz-2.4.21
j. cp System.map /boot/System.map-2.4.21
k. mkinitrd /boot/initrd-2.4.21.img 2.4.21

this is what i "observed" during the above steps:
[a-f] : went through with no problems
g : i got some warnng like :
tools/build -b bbootsect bsetup compressed/bvmlinux.out CURRENT > bzImage
Root device is (3, 3)
Boot sector 512 bytes.
Setup is 2540 bytes.
System is 1393 kB
warning: kernel is too big for standalone boot from floppy
make[1]: Leaving directory `/usr/src/linux-2.4.21/arch/i386/boot'

i dont know if that is to make any difference.

[h-k] : went ok.

now, when i go into the /boot dir, i see :
a. vmlinuz-2.4.21
b. System.map-2.4.21
c. initrd-2.4.21.img

i notice that the initrd-2.4.21.img file is about half the size of the initrd of the previous kernels.

then i edit the /etc/grub.conf to be:
title Red Hat Linux (2.4.21)
root (hd0,2)
kernel /boot/vmlinuz-2.4.21 ro root=LABEL=/ hdc=ide-scsi
initrd /boot/initrd-2.4.21.img
title Red Hat Linux (2.4.20-13.8)
root (hd0,2)
kernel /boot/vmlinuz-2.4.20-13.8 ro root=LABEL=/ hdc=ide-scsi
initrd /boot/initrd-2.4.20-13.8.img


and i reboot.
ok, so it initializes the devices and then goes into a kernel panic saying it cannot mount root filesystem.

my questions are:
1. does that warning i see after 'make bzImage' make any difference?
2. when i do the 'make oldconfig', and it asks the questions, can i keep hitting 'enter' thinking i have moved the old .config into this dir before running make, and it would keep that config?
3. how do i check to see if ramdisk support is included? and shouldnt it be a moot point if im using the old .config?
4. when i reboot, and see the kernel panic, is there anyway i can restart without pulling the plug out?
5. and is there anything i should do in /sbin/grub? (im just guessing)

been thro everything online and all the docs, but i cant seem to find much on troubleshooting this. most of them are just docs on how to do it!

any help is highly appreciated! thanks again!

wrc1944 07-22-2003 04:41 AM

If you get through with only warnings, your generally OK- if things are really amiss, it will error out.
I've found it best not to compile kernels as root in /usr/src.
What I do is this:

1.Download 2.4.21.bz2 to it's own directory in /home, and extract it there.

2. Cd to the linux-2.4.21 directory,do make mrproper, then put the .bz2 patch inside the linux-2.4.21 directory, and in a console, still as user, issue:

bzip2 -dc patchxxxx.bz2 | patch -p1

Check the toplevel Makefile extraversion line- it should reflect the patch version- if not, call it = -whatever, to differentiate it from any other kernel on the system.


3. Then you can make xconfig, and load your saved config file into xconfig, and make any edits you need. (Don't do make oldconfig- it's easier to load a copied config file, and then edit in xconfig). If you need ramdisk support, just set it as "y." Save, and exit xconfig.

4.Then do make dep, make clean, and make bzImage, and make modules.

5. su to root, and do make modules_install.

6. Don't do make install!
Instead, copy manually System.map and bzImage, naming them to what the kernel version is. Just make sure it isn't the same as an already installed kernel. I don't use an initrd, but I don't have any scsi drives, so it's OK.

7. Edit, and run lilo, or edit grub. Check lib/modules and /boot to be sure all is correct. reboot, and select the new kernel.

Hope this helps,
wrc1944

h/w 07-22-2003 03:04 PM

hey - thanks for the reply.
tried it, but i get the same error - kernel panic.

someone pointed this out to me :
Q: My system memory is not fully detected, or the computer hangs shortly after starting with the message "Panic: cannot mount root file system"!

A: Some boards apparently report the usable memory size incorrectly to the Linux kernel. Solution: specify the system memory size as an additional "knoppix" boot option. For example, for 128 Megabytes use

knoppix mem=128M

(Note: make certain an upper-case M is typed after the memory size!)

now, this is using knoppix.
is there an equivalent place/file i can edit to do the above on redhat8?

tia!

h/w 07-22-2003 03:05 PM

the above question was frm:
http://www.knoppix.net/docs/index.php/FaqHardware

harrygraham 07-22-2003 04:19 PM

Whenever I attempt to change a lot of kernel settings I get the same thing. For this reason I have only been able to successfully compile kernels that have just the processor type reset, and nothing else. Every time I edit the modules something messes up and I get the kernel panic you described. Probably adding a patch is similar.

The problem is that some modules are being skipped over in the compilation process. To get all the modules properly made you have to do some pretty fancy stuff (IE the nohup options etc.), which I've never been able to master.

Also, that warning about the kernel being too big to fit on a floppy doesn't really mean that it's not a good kernel.

Hope this helps.

h/w 07-22-2003 04:42 PM

thnx harry.

ok, all the settings are done during the "make xxxconfig" right?

now, no matter what i do "make old/x/...config", i get asked the same questions.

even if i do a make xconfig, and load the config file from my prev kernel version, and follow the steps, i get the error.
if i do a "make oldconfig", i get asked questions on cmd-line, and its even more annoying, cos here i am thinking it will just compile usin the config from the already running kernel.

this is soo annoying!

and umm, u wudnt know if theres an equivalent to the knoppix thingie on RH, wud ya?
:)

thnx again

harrygraham 07-22-2003 10:45 PM

Dear H/W,

Try adding this line to your lilo.config file:

append= "mem=176M"

It works on Mandrake. Maybe it will also work on RedHat.

But I do not think a small configuration problem would interfere with your kernel compiling. Maybe you should try to weather through the almost baffling Kernel-HOWTO on http://www.linux.org. It's not for the feint of heart though.

Good luck!

h/w 07-23-2003 10:23 AM

thnx, since im using grub ...
will try it out later now.

thnx again!


All times are GMT -5. The time now is 02:33 PM.