Compiling Kernel And Modules, Installing The Beast

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:

Warning

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.

Note

The old zImage target is now obsolete, it is deprecated, and you shouldn't use it anymore.



[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!