2003-12-12, 12:53 AM
This is NOT for 2.6.X. There is a README in /usr/src/linux that contains these instructions in much more detail. I am using using the 2.4.24 kernel as an example. If you have not already done so, download your kernel source and install it in /usr/src.
1. cd /usr/src/linux (if /usr/src/linux doesnt exist, create a link from /usr/src/linux-2.4.24 to /usr/src/linux with the command ln -s /usr/src/linux-2.4.24 /usr/src/linux )
2. make distclean (this sets the source package back to the default)
3. edit your makefile. change the EXTRAVERSION = on the forth line to an extension that will identify this new kernel build. ex. "EXTRAVERSION = -custom-1". if you are using pico or nano as your editor, be sure to include the "-w" option to turn off line wrap or you will trash your makefile.
If this is a stock kernel and you have never built a kernel before, Redhat supplies config files that match their precompiled kernels in /usr/src/linux/config. Pick the one that matches your hardware and copy the provided config into /usr/src/linux/.config. If you are not using Redhat, your going to have to wing it. :-)
4. make mrproper menuconfig use the menuconfig to set the options you want in your kernel. If you are reading this as a guide, then you are probably not very experienced in building kernels. A suggestion would be to make small changes, compile and install the kernel and make sure it works before you start making major changes.
5. make bzImage modules modules_install This will take some time to complete. Have a cup of coffee.
6. cp /usr/src/linux/arch/i386/boot/bzImage /boot/bzImage-2.4.24-custom-1
7. cp /usr/src/linux/System.map /boot/System.map-2.4.24-custom-1
8. cp /usr/src/linux/.config /boot/config-2.4.24-custom-1 This is not required, but it is sometimes handy to be able to get back to the config you used to create a kernel. This puts it in a safe place and its name matches it to the kernel you just built.
cd /boot
9. mkinitrd initrd-2.4.24-custom-1 2.4.24-custom-1
10 edit /boot/grub/grub.conf (remember to use "-w" if you are using nano or pico)
create a new entry for your new kernel.
title=2.4.24-custom-1
root (hd0,0)
kernel (hd0,0)/bzImage-2.4.24-custom-1 ro root=/dev/hda6
initrd (hd0,0)/initrd-2.4.24-custom-1
NOTE: in this case, my /boot partition is /dev/hda1 and my / (root) partition is /dev/hda6. Yours is probably different. Look at the other entries in your grub.conf and make the entries look the same.
g'luck