Previous Next Table of Contents

3. Kernel

Firstly save your old kernel source, and be careful NOT to install the new source over the old. One way is to rename the top dir to something else, eg linux-1.2.13-old. Make sure that the directory /usr/src/linux DOESN'T EXIST.

You should ftp a recent kernel, untar it, and rename the directory, to something like /usr/src/linux-2.0.0. Create a symbolic link so that it appears to be /usr/src/linux

        cd /usr/src
        ls -l
        rm linux
        tar -zxf /tmp/linux-2.0.tgz
        mv linux linux-2.0.0
        ln -s linux-2.0.0 linux
        less linux/README
You should also check that the links from else-where are correctly set. Once done, they will still be valid next time. Use ls and ln so that:
        /usr/include/linux      -> /usr/src/linux/include/linux
        /usr/include/asm        -> /usr/src/linux/include/asm-i386
You should browse linux/README and linux/Documentation/*

3.1 /etc/lilo.conf

You should have the choice of which kernel to boot, and which root partition to boot with. You will need to edit /etc/lilo.conf for every new kernel version. When you run make zlilo, or make install, the last action will be to call lilo to install it as bootable. Make sure that all the necessary partitions are mounted! See Issue-One for more details.

You should run it first to see that it isn't broken.

Note that modules can have their parameters in /etc/conf.modules, and not the LILO line (or parameters in /etc/lilo.conf).

3.2 Kernel - Configure

The kernel is made of several drivers, and components. You decide which components go into your system, and what flags are needed for them. You do this by running make config, or make menuconfig, or make xconfig. I did make menuconfig, which offers a nice menu interface, and runs on a plain console.

Every option has a help text (taken from Documentaion/Configure.help) which may help.

Basically you should include the absolutely necessary drivers, needed to run the hard disk during boot time. You should also set standard options, such as SYSV-IPC and networking. For you they are essential, but someone somewhere sees them as optional, and Linus supports that.

Other drivers, which you could then load from the hard disk (or network, or cdrom, or floppy, ... ) should then be flagged as modules, and will be built seperately. Most drivers can be configured as modules.

Getting to grips with the configure options isn't easy, and familiarity helps. eg it is hard to find the NE2000 driver option, unless you know that it appears under "Other ISA Cards", and that selecting that option has no effect, other then making more options available on the screen.

When you are more familiar with Linux, you will probably want to recompile with a new parameter set, to play with a particular driver. Or maybe you forgot to compile the LP support, and you want it as a module. Chances are, that by then there will be a new kernel version available, and you may wish to fetch it, or the patches.

Some development kernels ARE development ones, so beware. But don't do what many distributors do, and put it off until everything has changed.

The result of running menuconfig is /usr/src/linux/.config. It may be worth saving this file for comparing it when compiling the next release.

3.3 Kernel - Compile

        make dep
        make zlilo # or make install
        make modules
        make modules_install
        depmod -a 2.0.0 # or depmod between reboots
Building the modules will take a while. It may be a bit quicker, if you exit X11, and all large applications, to make more memory available to the cache.

3.4 /sbin/installkernel

If you have configured lilo to use /vmlinuz, you don't have to do this, but I prefer to archive my kernels and keep access to older versions. I also have a disk bigger than 1024 cylinders, so I use a seperate partition for all the boot files (/dev/hda4). This is described in Issue-One.

Having the installkernel script, allows you to run make install, instead of make zlilo. Remember to chmod 755 it.

#!/bin/sh
# /sbin/installkernel

        DIR1=${4:-/hda4/boot_raven}

        [ -f $DIR1/vmlinuz    ] && mv $DIR1/vmlinuz    $DIR1/vmlinuz.old
        [ -f $DIR1/System.map ] && mv $DIR1/System.map $DIR1/System.old

        cat $2 > $DIR1/vmlinuz-$1
        cat $2 > $DIR1/vmlinuz
# OR #  cat $2 > $DIR1/vmlinuz-$1 # or both!
        cp  $3   $DIR1/System.map-$1
        cp  $3   $DIR1/System.map

        lilo

If you rebuit the kernel, but there was an error in your /etc/lilo.conf, simply fix the error, and run lilo again. It is the last command run, so if it fails there is no need to run make install again. However, doing so won't take as long as most things have already been done.


Previous Next Table of Contents