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. Saving, Reusing Your Kernel Configuration Files
14.5. Compiling Kernel And Modules, Installing The Beast
14.6. Installing The New Kernel Manually
14.6.1. Updating Grub
14.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, 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.

14.1. Where to Find Kernel Sources

You can basically get the sources from two places:

  1. Official Mandrake Linux Kernel. In the SRPMS directory of any of the Cooker mirrors, you will find the following packages:

    kernel-2.4.??.?mdk-?-?mdk.src.rpm

    The kernel sources for compiling the kernel used in the distribution. It is highly modified for more additional functionalities.

    kernel-linus2.4-2.4.??-?mdk.src.rpm

    The stock kernel as published by the maintainer of GNU/Linux kernel.

    If you choose this option (recommended), just download the source RPM, install it (as root) and jump to Configuring The Kernel.

  2. The Official Linux Kernel Repository. 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 /pub/linux/kernel directory. Next, go to the directory with the series that interests you: it will undoubtedly be v2.4. Nothing prevents you from trying the 2.5 version, but remember that these are experimental kernels. The file containing the kernel sources is called linux-<kernel.version>.tar.bz2, e.g. linux-2.4.8.tar.bz2.

    You can also apply patches to kernel sources in order to upgrade them 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.bz2 and patch-2.4.10.bz2. As a general rule, this is a good idea, since sources currently take up more than 23 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. 2002.
http://www.mandrakelinux.com/