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.22, you must delete the /lib/modules/2.4.22 directory.
Compiling the kernel and modules, and then installing modules, is done with the following lines:
make dep make clean bzImage modules make modules_install 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[34].
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. This target also generates the System.map for this kernel. We will see later what this file is used for;
modules: 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 /lib/modules/<kernel-version> directory. This target also computes module dependencies (unlike in 2.2.x);
install: this last target will finally copy the kernel and modules to the right places and modify the boot loader's configurations in order for the new kernel to be available at boot time. Do not use it if you prefer to perform a manual installation as described in the section called “Installing The New Kernel Manually”.
It is important to respect the target order modules_install install so that modules actually get installed before.
At this point, everything is now compiled and correctly installed, ready to be tested! Just reboot your machine and choose the new kernel in the boot menu. Note that the old kernel remains available so that you can use it if you experience problems with the new one. However, you can choose to manually install the kernel and change the boot menus by hand. We will explain that in the next section.
[34] In this case, if it fails, it means that there is a bug in the kernel... If this is the case, please report it!