Chapter 14. Compiling and installing new kernels

Table of Contents
14.1. Where to find kernel sources
14.2. Unpacking sources, patching the kernel (if necessary)
14.3. Configuring the kernel
14.4. Compiling the kernel and modules, installing modules
14.5. Installing the new kernel
14.5.1. Updating GRUB
14.5.2. Updating LILO

Along with filesystem mounting and source compilation, 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 Linux-Mandrake contains support for a significant number of devices, as well as a bunch of 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. Reasons for why you should want to compile your own kernel range from deactivating an option to rebuild an all new experimental kernel. Anyway, the aim of this chapter is that your coffee machine should still work 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, a bug which is corrected 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.

14.1. Where to find kernel sources

The main kernel source host site is ftp.kernel.org, but it has a large number of mirrors, all named ftp.xx.kernel.org, where xx represents the country's ISO code. Following the official announcement of the availability of the kernel, you should allow two hours for all the mirrors to get updated.

On all these FTP servers, the sources are in the directory /pub/linux/kernel. Next, go to the directory with the series that interests you: it will undoubtedly be v2.2. There is nothing to prevent you trying version 2.3 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.2.15.tar.gz.

There are also patches for application to kernel sources to upgrade it incrementally: thus, if you already have kernel sources version 2.2.15 and want to update to kernel 2.2.17, you do not need to download the large source file, but you can simply download the patches patch-2.2.16.gz and patch-2.2.17.gz. As a general rule, this is a good idea, since sources currently take up more than 12 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. 2000.
http://www.linux-mandrake.com/