Search notes:

Linux kernel compilation

Also referred to as «building the Linux kernel».

Config options

UEFI needs these config options.

Default configuration

The kernel includes a default configuration.
The default configuration is presented the first time menuconfig is run on a source tree.

Specifying an alternate config file

By default, the make system uses ./.config as build configuration file.
An alternate file can be chosen by setting the environment variable KCONFIG_CONFIG to the path of a config file or specyfing the alternate config file directly like so:
make KCONFIG_CONFIG=test.config

Specifying a separate build directory

By default, the generated files go into the same tree as the kernel sources. Invoking make with O=/path/to/output/dir allows to specify an alternative destination
cd /usr/src/linux-4.X
make O=/home/name/build/kernel menuconfig
make O=/home/name/build/kernel
sudo make O=/home/name/build/kernel modules_install install

Verbosity level

make V=1 prints detailed compile and link commands.
make V=2 also prints why a target is rebuilt.

TODO

The compiled kernel should be placed under arch/x86/boot/bzImage.
scripts/config (in the Kernel source tree) allows to manipulate options in a .config file from the command line.

See also

Documentation/admin-guide/README.rst

Index