RedHat has its own little quirks, and if one wants to recompile their kernel, they have to do a few things.
NOTE: This is for the 2.4 kernel. I haven't used RH in awhile now, but there are enough people still using it with the 2.4 kernel so that I'll leave this up here.
This is not a complete kernel howto. It only covers a few quirks of RH 7.1. RedHat has its own kernel howto on its site. This article is now so dated that it really shouldn't be used.
I have two machines--one is a newer, more expensive one, the other is a fairly low quality machine. On the good machine, I simply downloaded the latest kernel from www.kernel.org, unpacked it, went into the newly created /usr/src/linux directory, did make mrproper and started fresh without problems. However, when I tried this on the lower end machine, I ran into a lot of things not working. Therefore, with a sigh, I figured I better start with my old configuration and take it from there.
So, first I downloaded the source for kernel 2.4.9 from kernel.org (NOT from RH--they're well known for having mangled kernels) and put it into /usr/src---I just chose to save it there. Then, I unpacked it. It's a bz2 file so
tar -jxvf linux-2.4.9.tar.bz2
This created a linux directory (there hadn't been one there before.)
RH doesn't have a /usr/src/linux directory. Instead, they have a /usr/src/linux-2.4 directory. That's actually a link to whatever kernel was installed when you first put it in, but at any rate, in their own kernel howto, they suggest that you work from there.
If one examines the directory, you find no .config file. Instead, there is a subdirectory called configs, which has a number of different .config files, i386, i586, Athlon, etc. So, firstly, I went into the linux-2.4 directory and tried a make menuconfig. I saw, however, that several things weren't what I had. Therefore, I gave up on their defaults.
Upon boot, it was saying that I was booting on an i586. That machine has an Athlon K6 so, I chose Athlon config. I copied it over to /usr/src/linux/.config, overwriting the .config file that was already in there.
cp linux-2.4/configs/kernel-2.4.2-athlon.config /usr/src/linux/.config
When it asks if I want to overwrite the current .config file, I answer yes. Now, I didn't do make mrproper---I figure I can make a few changes to the current configuration and still have everything working, but I don't want to start perfectly fresh--remember, my whole reason for doing this is that I was having trouble getting my configruation to work properly, so I go to the configuration.
One can also use make xconfig which gives a graphical interface, or make oldconfig which would, theoretically, simply duplicate what you have already. I stay away from make config because I don't think you can go back and correct yourself when you've made a mistake.
When that's done
make dep; make clean; make bzImage
This of course, takes awhile, especially on this older machine. I stop there because I want to be sure that I don't have any errors (yet.)
make modules; make modules_install
The way the RH kernel is setup, it's got a LOT of modules--this takes quite awhile. Still no errors, so that's good.
cp arch/i386/boot/bzImage /boot/vmlinuz-2.4.9 I've now put the new bzImage in my /boot directory, so that I can try it. I use Grub, so I edit that to allow me to boot it.
title RedHat New
kernel/boot/vmlinuz-2.4.9 ro root=/dev/hda2
With Grub, that's all you have to do. If you're using lilo, then you would add
(Of course, one would change their grub or lilo to reflect the actual partition. In my case, it's the second primary partition, so in lilo terms it's hda2 and in grub terms (hd0,1).
If using lilo, you now have to update it.
Reboot, and with luck all goes smoothly.
One important point here. Even if all you plan to do is upgrade your kernel version, be careful. For example, if it says booting on an i586 and you just copy over the linux-2.4/configs i586 configuration and do make oldconfig, it will usually hang afte saying, ok uncompressing the kernel. The reason for this is that the default is a PIII processor. So even if you're just planning to make your old configuration with the new kernel, double check the processor section first.
Again, this is not a detailed kernel howto, it's only to help those who might be a bit confused with RH's variations.