Home|Cudeso|Linux|*NIX / BSD|Misc|
 

Install a new kernel

Contents

1. Introduction

3. What is the kernel?

3. Useful resources

4. Backup

5. Download

6. Extracting

7. Making

8. Installing





1. Introduction

This document is not intended as a "total" guide for installing a new kernel for GNU/Linux. It's only a brief description that's covering the way I install my kernels. Without any doubts, there will be some pitfalls and if you find any errors, please contact me.

2. What is the kernel?

A kernel is the center of your GNU/Linux-machine. Without it GNU/Linux won't boot. I quote Brian Ward on http://linuxdocs.org/HOWTOs/Kernel-HOWTO.html
The Unix kernel acts as a mediator for your programs and your hardware. First, it does (or arranges for) the memory management for all of the running programs (processes), and makes sure that they all get a fair (or unfair, if you please) share of the processor's cycles. In addition, it provides a nice, fairly portable interface for programs to talk to your hardware.
You see...it's quite essential to have one if you want to use GNU/Linux.

So, why would you upgrade your existing kernel? There are several reasons. Maybe you want to use a new hardware-device that isn't supported in your present kernel or there are known security issues that are solved or just because you like to have your system up-to-date. I wanted to use the new kernels 2.4.x for the iptables support. There were some machines where I was still using ipchains and after reading the descriptions for iptables I felt the need to migrate.

The steps described in this document are mainly for ix86-machines with Red Hat Linux allthough they can be used on other systems or distributions with minor changes.

3. Useful resources

Al lot of the this material is "collected" together from various other resources.
Kernel Howto - http://linuxdocs.org/HOWTOs/Kernel-HOWTO.html

4. Backup

A word for the wise..backups aren't invented for losers. One of the first lessons in system-administration would be to take regular back-ups. I've written a document that covers some of the basics. You can find it at http://linux.cudeso.be/linuxdoc/backuprestore.php.

5. Download

First of all (this make quite sense) you should download a new kernel. Check out http://www.kernel.org/pub/linux/kernel/ to get your newest kernel. The latest kernel releases are v2.4.x. I suggest strongly you download a new kernel in this v2.4.x-version. This new release contains the excellent iptables for securing your system.

6. Extracting

Okay...you've downloaded the newest-kernel. Now move this file to /usr/src/ This can easily been done by
mv linux-2.4.xx.tar.gz /usr/src
Next thing is to extract all files. First navigate to the right directory and extract all files
cd /usr/src/
tar zxvf linux-2.4.xx.tar.gz
There will now be a directory linux that contains all source-files for your new kernel and you should navigate to this directory
cd /usr/src/linux/

7. Making

First thing I do after extracting the package is make clean. You could also issue a make mrproper if you want to remove all your old files but I'd rather love only the make clean.
make clean
The next step is the most difficult one and you should really take your time to get trough this. It's make menuconfig. By this you can configure your kernel the way you want it to function. Take a look at all the options (sometimes they are really hidden) and make sure you know what hardware is in your machine.
make menuconfig
Don't forget to set the Loadable module support. It's one of many things that gave me head-aches at first. Without this it would be quite hard (let's even say, impossible) to load extra modules that you would need for several - new - devices like NIC's, sound-cards. Maybe it would also be a good idea to enable the IPv6-support.

I'll cover the different sections more in depth when I find the time After you have exited the menuconfig (and off course saved your configuration) there will pop-up a nice message telling you to run make dep. So what's keeping you from doing so?
make dep
This will take quite some time. So please be patient.

Next one, and this is really making your kernel-image is, will take even more time. When I ran it on a P-133 with 49MB RAM it took about 2,5 hours!
make bzImage
After a long, sleapy break and several coffees, the Linux-prompt will pop again. Now it's time to make the dependencies for the different modules you've enabled. The time it takes will depend on how many modules you've enabled but normally this will take not very long.
make modules
make modules_install

8. Installing

After the creation of the new image, it's time to place it in the right directory.
cp arch/i386/boot/bzImage /boot (answer Yes to overwrite)
cp System.map /boot (answer Yes to overwrite)
The last thing we need to do is change LILO so that the new kernel can be booted by LILO.
Open /etc/lilo.conf with your favorite browser.
vi /etc/lilo.conf
There should be at least one entry for your present kernel. Don't delete this one, just add another one for your new kernel. Below you can see an example of my lilo-file.
Example of /etc/lilo.conf
 boot=/dev/hda
 map=/boot/map
 install=/boot/boot.b
 prompt
 timeout=50
 linear
 default=linux

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

 image=/boot/vmlinuz-2.4.1-0
    label=linux_2_4_1
    read-only
    root=/dev/hda1

 image=/boot/vmlinuz-2.2.14-5.0
    label=linux_2_2_14
    read-only
    root=/dev/hda1
After you have made the modifications, save your file.

Now, you need to tell lilo to read his new configuration by
lilo -v
And that would be all (I hope).
Reboot your machine and see wether LILO boots the right image. Good luck!!
Copyleft 2002-2007 - cudeso.bewebmaster@cudeso.betop