Kernel Setup

There are a number of excellent HOWTOs out there for kernel building ( check /usr/src/HOWTO/Kernel-HOWTO ).

The kernel is set up pretty well out of the box, but for sometimes you will need to make a few changes and recompile. At the very least, you may not use a joystick, soundcard, or ISDN, , so why not disable the capability and make the kernel cleaner?  Don't be intimidated by this process. It is not as hard as it sounds.  Advanced users often have to recompile kernels to get new utilities to work.  Kernel upgrades generally require a config and build, but your Linux vendor may provide an rpm for easy upgrade.

First install the source tree. The easiest way to do this is select the kernel source when you first install Red Hat. The option is under "Select Individual Packages" then click the kernel box.

You can also load your install CD with the RPM directory, mount the cd

mount /dev/cdrom /mnt/cdrom

An ls of the kernel rpms on my RedHat 6.2 distro provides :

kernel-2.2.14-5.0.i386.rpm # The pre-compiled kernel for 386+
kernel-pcmcia-cs-2.2.14-5.0.i386.rpm # Pcmcia kernel
kernel-2.2.14-5.0.i586.rpm # The pre-compiled kernel for 586+
kernel-smp-2.2.14-5.0.i386.rpm # The pre-compiled kernel for multi processor support 386+
kernel-2.2.14-5.0.i686.rpm# The pre-compiled kernel for 686+
kernel-smp-2.2.14-5.0.i586.rpm # The pre-compiled kernel for multi processor support 586+
kernel-BOOT-2.2.14-5.0.i386.rpm
kernel-smp-2.2.14-5.0.i686.rpm # The pre-compiled kernel for multi processor support 686+
kernel-doc-2.2.14-5.0.i386.rpm # Kernel doc
kernel-source-2.2.14-5.0.i386.rpm # Kernel source
kernel-headers-2.2.14-5.0.i386.rpm # Kernel headers
kernel-utils-2.2.14-5.0.i386.rpm # Utilities
kernel-ibcs-2.2.14-5.0.i386.rpm # IBCS
kernelcfg-0.5-5.i386.rpm # Kernel configuration utilities

The files in bold (the last 6) are required for a new kernel build.

Now that you have the source installed.....

cd usr/src/linux/
make menuconfig (or you may use make config or make xconfig0


You will be presented with pseudo GUI menu that gives you various options on how the kernel should be built.  Some options you may change when building a router are:

Be careful what you disable - if you don't know what it is, there is a help file associated with the option.

When the config is done, run...

make dep
make modules
make modules_install

The final step will take between 30 and 120 minutes. It is the big compile.....with...

make bzImage

There will now be a new kernel in /usr/src/linux/arch/i386/boot/ called bzImage

Copy the new kernel to the boot directory as follows:

cp /usr/src/linux/arch/i386/boot/zImage /boot/linux-newkernel

You can use any name you want for the new kernel. DO NOT overwrite the old kernel (probably called vmlinuz-2.x.x.-xx)

In /usr/src/linux is a new System.map file.  Move that one to /boot/system.map-newkernelname, then create a new symlink in /boot from System.map to the new file.  'ln -s system.map-newkernelname System.map.

Now edit /etc/lilo.conf to include the new kernel and rename the line for the old kernel. The easiest way to do this, is just copy the lines that reference the old kernel, then edit them to reflect the name you gave your new kernel. Now call the new kernel linux, and the old kernel linux-2.0.36. This will load your new kernel by default, but keep the old one available just in case. Confused? Here is an example of /etc/lilo.conf:

boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
default=linux2000

image=/boot/linux-newkernel
label=linux2000
read-only
root=/dev/hda1

image=/boot/vmlinuz-2.2.12-20
label=linux
read-only
root=/dev/hda1

now run lilo and reboot.

When your system restarts, you will get the LILO: prompt as usual. Hit the [TAB] key. You should have 2 kernels listed. Type in the alias for either one (or just let it load if you want to use the new one).