Building Linux Kernel fast
at Sunday, May 25, 2008
While building the Linux Kernel in a multiprocessor environment, running "make" will enable single compiler to use single processor. Linux Kernel build system provides a way (through an option to the Makefile) which enable faster building by making use of multiple processors in a multiprocessor system.
Use the "-j" option along with a number specifying the number of parallel compilations. Choose the number based on the number of processors in the system you are compiling the Kernel. The best option is to use this number as double the number of processors.
For example, in a system with 8 processors, use 16.
$ make -j 16
If you run "make" along with "-j" but without passing anything to it, the Kernel build system will create a new thread for each subdirectory in the Kernel source tree. Since there are many subdirectories within Kernel source, using this option can result in the system to go hang which defeats our intention of using "-j" option. So, it is recommended to use an optimal number along with "-j" option while building the Kernel.




