Skip to Main Content
Linux Kernel in a Nutshell
book

Linux Kernel in a Nutshell

by Greg Kroah-Hartman
December 2006
Intermediate to advanced content levelIntermediate to advanced
202 pages
8h 29m
English
O'Reilly Media, Inc.
Content preview from Linux Kernel in a Nutshell

Advanced building options

The kernel build system allows you to do many more things than just build the full kernel and modules. Chapter 10 includes the full list of options that the kernel build system provides. In this section, we will discuss some of these advanced build options. To see a full description of how to use other advanced build options, refer to the in-kernel documentation on the build system, which can be found in the Documentation/kbuild/ directory of the sources.

Building faster on multiprocessor machines

The kernel build system works very well as a task that can be split up into little pieces and given to different processors. By doing this, you can use the full power of a multiprocessor machine and reduce the kernel build time considerably.

To build the kernel in a multithreaded way, use the -j option to the make program. It is best to give a number to the -j option that corresponds to twice the number of processors in the system. So, for a machine with 2 processors present, use:

$ make -j4

and for a machine with four processors, use:

$ make -j8

If you do not pass a numerical value to the -j option

$ make -j

the build system will create a new thread for every subdirectory in the kernel tree, which can easily cause your machine to become unresponsive and take a much longer time to complete the build. Because of this, it is recommended that you always pass a number to the -j option.

Building only a portion of the kernel

When doing kernel development, sometimes you wish ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Linux Kernel Debugging

Linux Kernel Debugging

Kaiwan N. Billimoria

Publisher Resources

ISBN: 0596100795Supplemental ContentErrata