Kernal Issues

Why Recompile the Kernel?

You may need to recompile the kernel in order to support new hardware. You also may wish to optomize your kernel for a particular purpose.

What You need to begin?

You will need the source code for the kernel. Make sure you install both the headers and the source.

rpm -ivh binutils*.rpm

rpm -ivh cpp*.rpm

rpm -ivh dev86*.rpm

rpm -ivh gcc*.rpm

rpm -ivh glibc-devel

rpm -ivh kernel-headers.*.rpm

rpm -ivh kernel-source.*.rpm

rpm -ivh make

rpm -ivh ncurses

rpm -ivh ncurses-devel

Note: Red-Hat's kernel source is slightly different than the code you will find at kernel.org. Unless you have some compelling reason not to, you should use Red Hat's version.

Building the Kernel

cd /usr/src/linux-2.4

If you check, linux-2.4 should be a symbolic link to the newest version of the kernel source code. For example, on my machine, it it a link to linux-2.4.9-31.

make mrproper

This command gets rid of anything that may have been left over from pevious builds of the kernel.

# Now you have a choice of configuration programs to use. make oldconfig: This sets up the default settings that Red Hat shipped with.

# make xconfig: This brings up a menu in X-Widows that allows you to set kernel configuration parameters.

# make menuconfig: This brings up a text menu-based configuration program

# make config: This will ask you a series of questions.

I usually start with make "old config" and then do a "make xconfig".

What should I change when configuring the Kernel?

Under "Processor Type and Features", you wil find the "Processor Family" menu. By selecting the correct processor for your machine, you can optomize the kernel for your machine. Under "File Systems", make sure to enable any file systems that you want recognized. For example, on a dual-boot machine, you may wish to enable NTFS. There are a lot of possabilities here. Look around.

What do I do after configuring the Kernel?

make dep

this sets up all the dependencies correctly

make clean

This cleans up the source directory.

Setting up the EXTRAVERSION flag

Edit the Makefile. You will find a line that says something like this:

EXTRAVERSION = -31

Change it to read something like this:

EXTRAVERSION = -31-randy

This will be the name for our new kernel. If you named the kernel exactly the same thing as the kernel you currently boot up with, you would risk screwing up your current configuration. Hence you should name it something unique.

Building the Kernel

make bzImage

This builds the actual kernel. It is found in /usr/src/linux-2.4/arch/i386/boot/bzImage

make modules

This creates all the Kernel modules

make modules_install This installs the modules.

Mkinitrd

If you want to boot from a SCSI adapter, and you have SCSI in a module, then you need to make a new initrd file for your kernel.

mkinitrd 2.4.9-31-randy

How do I install the Kernel?

cp /usr/src/linux-2.4/arch/i386/boot/bzImage /boot/vmlinuz-2.4.9-31-randy

If you are using GRUB, add the following lines:

title Red Hat Linux (2.4.9-31-randy)

root (hd0,1)

kernel /vmlinuz-2.4.9-31-randy ro root=/dev/hda6

initrd /initrd-2.4.9-31-randy.img

If you have LILO, then add the following lines, substituting the correct value for you root partition:

image=/boot/vmlinuz-2.4.9-31-randy

label=linux-2.4.9-31-randy

initrd=/boot/initrd-2.4.9-31-randy.img

read-only

root=/dev/hda6

Removing or Uninstalling Kernel

First check the available kernal

yum list kernel-*

Then remove the kernel

yum -y remove kernel-2.6.16-1.2122_FC5

Otherwise, yum -y remove kernel-2.6.16-* also should do it.

yum -y remove kernel-2.6.20-1.2320.fc5smp