Small point to begin with: if you are recompiling a kernel with exactly the same version as the one already present on your system, the old modules must be deleted first. For example, if you are recompiling 2.4.10, you must delete the directory /lib/modules/2.4.10.
Compiling the kernel and modules, and then installing modules is done in a single line:
make dep bzImage modules modules_install |
A little vocabulary: dep, bzImage, etc., as well as oldconfig and others which we used above, are called targets. If you specify several targets to make as shown above, they will be executed in their order of appearance. But if one target fails, make won't go any further[1].
Let us look at the different targets and see what they do:
dep: this computes the dependencies between the different source files. It is necessary to do so each time you change your configuration, otherwise some files may not be built and the compilation will fail.
bzImage: this builds the kernel. Note that this target is only valid for Intel processors, and so is zImage. The difference between bzImage and zImage is that the former will generate a kernel which will be loaded high into memory. This target also generates the System.map for this kernel. We will see later what this file is used for.
modules: as its name says, this target will generate modules for the kernel you have just built. If you have chosen not to have modules, this target will do nothing.
modules_install: this will install modules. By default, modules will be installed in the directory /lib/modules/<kernel-version>. This target also computes module dependencies (unlike in 2.2.x).
Everything is now compiled and the modules are installed. But this is not enough: you also need to install the kernel in a place where your bootloader (be it LILO or grub) can find it. This is what the next section is about.
[1] | In this case, if it fails, it means that there is a bug in the kernel... If this is the case, please report it to us! |