First download the new kernel from
Kernel.org or from their
ftp site.
Usually I download to
/usr/src/ so I could work from there. Now untar the newly downloaded kernel source by typing:
tar -zxvf linux-2.4.6.tar.gz
Replace
linux.2.4.6.tar.gz with the version of the kernel you just downloaded. Change into the directory created, usually
linux. At this time, it is always good to read the
README file first. Next step is to make sure that there are no stale
.o files and dependencies lying around so run:
Once that is done, make sure you check the
./Documentation/Changes and have the minimal requirements before you begin compiling the kernel.
Once you have meet all the minimal requirements start the configuration by typing either one of these:
- make config - This is the typical configuration and requires the bash shell to work
- make menuconfig - This is a text based with color menus, radiolists & dialogs
- make xconfig - This is the graphical configuration tool for X Windows
- make oldconfig - default all questions based on the contents of your existing ./.config file.
All this is detailed in the
README file so be sure to read it.
Now that you have configured the options to build your new kernel, be sure to set up all the dependencies correctly by typing:
The second section cleans up the source tree from any previous compilations.
The next step is to start compiling and building the new kernel. To do this, issue the following command:
This part can take some time depending on your computer. During this time, you could read some more of the documentation in the
Documentation directory.
If you specified the use of
modules during the configuration, then you will need to issue the next line, if you did not specify the use of modules then you can safely skip this step:
make modules && make modules_install
This will compile and build all the modules that you specified during the configuration and copy them to the
/lib/modules directory so you could load them when necessary. Now to install the new kernel all you have to do is copy it from
./arch/i386/boot/ to
/boot/. You would also have to copy the new
System.map as well. To do this type:
cp arch/i386/boot/bzImage /boot
cp System.map /boot
Now you will need to update the module dependencies tree, a small file that tells the kernel which modules depends on which to work. To do this type:
All that is left is to update LILO or GRUB to tell it to boot the new kernel.
For those with SCSI hard disks, you will need to create initial ramdisk images for preloading modules. To do this, type:
mkinitrd /boot/initrd-2.4.6.img 2.4.6
Replace
initrd-2.4.6.img with the name you would like to use for your initrd image and replace
2.4.6 with the kernel version you are using. Remember to include a line in LILO or GRUB to boot the image. With LILO add:
initrd=/boot/initrd-2.4.6.img
Remember to replace
initrd-2.4.6.img with the filename of your own initial ramdisk image. As I have not used GRUB before, I do not know how to do this so you will have to read the GRUB documentation.
Full documentation can be found
here.