Reasons for upgrading your kernel
There are several reasons for you to upgrade your kernel, you need a new device driver for your hardware, or you need to upgrade due to a bug in the kernel. Usually new kernels run faster than the old ones and are more stable and reliable.
Downloading the source
You can find out what the latest kernel source is, however, at the time of this writing, 06/02/02, the current kernel version is 2.4.19. You can download this kernel from www.kernel.org or by clicking here. If you just want to install a patch, you can get that here.
Uncompressing the source
*Note* These next few parts are for the source only.
Uncompress the file you just downloaded by typing:
‘gzip -dc linux-2.4.19.tar.gz | tar xvvf -‘
Then move the directory linux-2.4.19 to /usr/src by typing:
‘mv linux-2.4.19 /usr/src’
Change to the source directory:
‘cd /usr/src’
Do a directory list (‘ls’) to find out if there is a directory called linux, if there is remove it:
‘rm -rf linux’
Now you have to make a link called linux. In your /usr/src directory type:
‘ln -s linux-2.4.19 linux’
Now for you people who downloaded the patch, un-compress the file you downloaded: ‘gzip -d path-2.4.19.gz’
And the move it to the /usr/src directory:
‘mv patch-2.4.19 /usr/src’
Know your hardware
You should know your hardware before you upgrade your kernel, so you can install the proper modules with your kernel. If you know your system really well and know every card in it, your all set, skip to the next step, everyone else, there are a couple commands you can type:
‘lspci’ will show all the pci devices attached to your computer.
‘dmesg’ will give you alot of useful information too.
Compiling the source
Change into the /usr/src/linux directory:
‘cd /usr/src/linux’
And then type the following command:
‘make mrproper’
You will now be able to start configuring the kernel to be compiled by typing one of the following commands:
‘make config’ – Good if your using telnet over a slow connection.
‘make menuconfig’ – Good if your on the machine, or using telnet over highspeed.
‘make xconfig’ – Loads up an X11 Front-end.
‘make oldconfig’ – Lets you use a previous .config file (helpful if your only upgrading).
Now configure the kernel to suit your system, go through every menu carefully, if you get stuck just read the help. Remove everything your system doesnt need, the smaller then kernel, the faster your system will run. Once you are done configuring the kernel save and exit. Now type:
‘make dep ; make bzImage ; make modules’ ; ‘make modules_install’
Copying the boot files
As root, copy bzImage from /usr/src/linux/arch/i386/boot to /boot:
‘cp /usr/src/linux/arch/i386/boot/bzImage /boot/kernel-2.4.19’
You can name it anything you want but kernel-2.4.19 is pretty easy to remember.
Configuring LILO
Change the directory to /etc:
‘cd /etc’
And open up the lilo.conf file:
‘nano -w lilo.conf’
At the end of lilo.conf insert the next couple lines of text:
image=/boot/kernel-2.4.19
label=linux-2.4.19
read-only
root=/dev/hda1
Exit and save lilo.conf
Restart lilo:
If everything went well you should see:
Added linux *
Added linux-2.4.19
If you got that, restart your computer.
Once you have restarted
Once you have restarted, and your system is working fine, edit /etc/lilo.conf again and take out the old kernel (the blurb above the one you inserted) and then restart lilo:
‘lilo’
If there were problems during bootup, do not do this step, reboot your system using your old kernel, and goto the next step.
If there was problems
Just reboot your system into the old kernel, and remove what you added to /etc/lilo.conf, then restart lilo:
‘lilo’
If you would like to try again, go back to /usr/src:
‘cd /usr/src’
Clean up the old files:
‘make clean’
And go back into the config, from there load the config file that you saved, and check it over for mistakes.
Installing a patch
This is really easy, just 2 commands:
‘cd /usr/src’
‘patch -p0 < patch-2.4.19’