Chapter 16. Compiling and installing new kernels

Table of Contents
16.1. Where to find kernel sources
16.2. Unpacking sources, patching the kernel (if necessary)
16.3. Configuring the kernel
16.4. Saving, reusing your kernel configuration files
16.5. Compiling the kernel and modules, installing modules
16.6. Installing the new kernel
16.6.1. Updating grub
16.6.2. Updating LILO

Along with filesystem mounting and building from sources, compiling the kernel is undoubtedly the subject which causes the most problems for beginners. Compiling a new kernel is not generally necessary, since the kernel installed by Mandrake Linux contains support for a significant number of devices (in fact, more devices than you will ever need or even think of), as well as a set of trusted patches and so on. But...

It may be that you want to do it, for no other reason than to see "what it does". Apart from making your PC and your coffee machine work a bit harder than usual, not a lot. The reasons for why you should want to compile your own kernel range from deactivating an option to rebuilding a brand new experimental kernel. Anyway, the aim of this chapter is to ensure that your coffee machine still works after compilation.

There are other valid reasons for recompiling the kernel. For example, you have read that the kernel you are using has a security bug, bug which is fixed in a more recent version, or a new kernel includes support for a device you need. Of course in these cases you have the choice of waiting for binary upgrades, but updating the kernel sources and recompiling the new kernel yourself makes for a faster solution.

Whatever you do, stock up with coffee.

16.1. Where to find kernel sources

The main kernel source host site is ftp.kernel.org, but there are a large number of mirrors, all named ftp.xx.kernel.org, where xx represents the ISO country code. Following the official announcement of the availability of the kernel, you should allow at least two hours for all the mirrors to be updated.

On all of these FTP servers, the kernel sources are in the directory /pub/linux/kernel. Next, go to the directory with the series that interests you: it will undoubtedly be v2.4. Nothing prevents you from trying version 2.5 kernels, but remember that these are experimental kernels. The file containing the kernel sources is called linux-<kernel.version>.tar.gz, e.g. linux-2.4.8.tar.gz.

There are also patches for application to kernel sources to upgrade it incrementally: thus, if you already have kernel sources version 2.4.8 and want to upgrade to kernel 2.4.10, you do not need to download the whole 2.4.10 source, you can simply download the patches patch-2.4.9.gz and patch-2.4.10.gz. As a general rule, this is a good idea, since sources currently take up more than 24 MB.


Tux on Star from MandrakeSoft Linux is a registered trademark of Linus Torvalds. All other trademarks and copyrights are the property of their respective owners.
Unless otherwise stated, all the content of these pages and all images are Copyright MandrakeSoft S.A. and MandrakeSoft Inc. 2001.
http://www.mandrakelinux.com/