06/03/2002

How To Recompile/Upgrade The Kernel

Kernel modification can be tricky so be sure to take your time. 

The kernel upgrade was done on a Slackware 8.0 box upgrading from 2.4.16 to 2.4.18.

Download the kernel version you want from ftp.kernel.org/pub/linux/kernel/v2.4
2.4.18 is the current stable version.

Important
=========

Check to see what modules you have installed prior to beginning, use 'lsmod' to show all currently running modules,
there may be afew listed for your NIC, sound, etc. Make note of them you will need this information later. 
Failure to list any devices, may cause the machine to not work correctly.

Preparing For Install
=====================

Untar the kernel source this will create a linux directory in your download location.

1. tar -zxvf linux-2.4.18.tar.gz
2. mv linux linux-2.4.18 (renames the linux directory to the kernel version)
3. mv linux-2.4.18 /usr/src
4. ls -l (displays a symbolic link between linux and your kernel directory.

root@malice/usr/src: ls -l
total 12
lrwxrwxrwx    1 root     root            12 Apr  5 16:25 linux -> linux-2.4.16/
drwxr-xr-x   14 root     root          4096 May  7 21:02 linux-2.4.16/
root@malice/usr/src:

5. rm linux (deletes the symbolic link)
6. ln -s linux-2.4.18 linux (creates a new symbolic link, for the new source)
7. ls -l (confirm the link is created)

root@malice/usr/src: ls -l
total 16
lrwxrwxrwx    1 root     root            12 Jun  3 17:39 linux -> linux-2.4.18/
drwxr-xr-x   14 root     root          4096 May  7 21:02 linux-2.4.16/
drwxr-xr-x   14 root     root          4096 Jun  3 17:38 linux-2.4.18/
root@malice/usr/src:

8. cd linux
9. make menuconfig (after a few seconds the main menu is displayed)

Go through each option and choose your settings, if your not sure of what to pick use the help feature by pressing 'h'
Options that are loaded into the kernel are marked with '*' modules are marked with 'M', if its not used its left blank;
to select or de-select an option use the 'spacebar'.

Be careful, I recommend only adding what you need until you get the hang of things, trust me its a pain fixing things later.
Its best practice to have minimal options installed in the kernel, when possible use a module.  This keeps the kernel
from getting too big.

10. make dep clean bzImage (This will compile the kernel, it can take a while)
11. make modules
12. make modules_install
13. mv /vmlinuz /vmlinuz.old
14. mv /boot/System.map /boot/System.map.old
15. cat arch/i386/boot/bzImage > /vmlinuz
16. cp System.map /boot/System.map

root@malice/: ls
bin/   dev/  home/   lost+found/   root/  tmp/  var/     vmlinuz.old
boot/  cdrom/  etc/  lib/      mnt/     opt/  proc/   sbin/  usr/  vmlinuz
root@malice/: ls /boot/
System.map      boot-menu.b  boot.0300  boot_message.txt      chain.b  map
System.map.old  boot-text.b  boot.b@    boot_message.txt.bak  config   os2_d.b
root@malice/:

17. vi /etc/lilo.conf (create new entry for the kernel)

# Linux bootable partition config begins

image = /vmlinuz
root = /dev/hda1
label = new
read-only

image = /vmlinuz.old
root = /dev/hda1
label = Linux
read-only

# Linux bootable partition config ends

18. lilo

root@malice/: lilo
Added new *
Added Linux
root@malice/:

19. reboot

If everything went ok your machine should have rebooted successfully, if not reboot and choose the old image from 
the lilo menu, and retrace your steps.

Post Upgrade
============

20. uname -a (confirm kernel upgrade)

root@malice~: uname -a
Linux malice 2.4.18 #1 SMP Mon Jun 3 18:31:13 EDT 2002 i686 unknown
root@malice~:

21. check to make sure your interfaces and devices work, use lsmod to view your installed modules.

If a module is missing, try loading it by using 'modprobe module-name' if it is not installed you will need to run 
'make menuconfig' and choose the module(s), after saving and quiting.  Run 'make modules' and 'make modules_install' 
to install the modules, you may have to refer to the help feature on the 'Kernel Main Menu' to find the exact 
module name.

Good Luck

[email protected]