Compiler Speed-up

Linux Kernel Modules Installation HOWTO
Prev |  | Next

# 3. Compiler Speed-up

If your machine has 16 or more Megabytes of RAM, there is a useful speed-up that can be done, which is to permit the kernel to compile two or modules in parallel. This will increase the load on the machine whilst the kernel is being recompiled, but will reduce the time during which the compilation will be taking place.

Before you can use this method, you need to check the amount of RAM present in your machine, as if you set this too high, the compilation will actually slow down. Experience has shown that the optimum value depends on the amount of RAM in your system according to the following formula, at least for systems with up to 32 Megabytes of RAM, although it may be a little conservative for systems with larger amounts of RAM:

N = [RAM in Megabytes] / 8 + 1

For the benefit of those with a dislike of math, the values for the common amounts of RAM are as follows:

Table 1. Sample Table

RAM Size | Value to Use
--- | ---
16 Megs | 3
24 Megs | 4
32 Megs | 5
40 Megs | 6
48 Megs | 7
56 Megs | 8
64 Megs | 9
80 Megs | 11
96 Megs | 13
112 Megs | 15
128 Megs | 17

When you have decided on the correct number, edit the file `/usr/src/linux/Makefile` and find the line that currently reads:

    MAKE=make

Replace it with one reading:

    MAKE=make -j N

where `N` is the number determined above.

Prev | Home | Next
Pre-requisites |  | Recompiling the Kernel for Modules