The 2.6 kernel, among other things, provides many enhancements to the kernel build infrastructure, or "kbuild system." Among the features that have been added, the 2.6 kernel now allows all of the files created by the kernel to be output to a arbitrary seperate location. This has several advantages over the old method:
This last fact is important, as previously portage would need to be given
temporary write access to a directory on the live filesystem in order to compile
external modules against a 2.6 kernel source tree. If you chose not to
use koutput for 2.6 kernels, most kernel modules will fail, due to this
restriction. To allow portage to write to
# config-kernel --allow-writable yes
At any later time you can revert this decision by using config-kernel again.
# config-kernel --allow-writable no
2.6 kernels determine where to output their files based on two environmental variables, KBUILD_OUTPUT and O. KBUILD_OUTPUT should be set environmentally, and can then be overriden on the command line by specifying a new O value. e.g.:
# cd /usr/src/linux> # export KBUILD_OUTPUT="/var/tmp/kernel-output/2.6.4" # mkdir /var/tmp/kernel-output/2.6.4Set our output location, and make sure that directory exists # make menuconfigThe generated .config ends up in # make O=/home/joe/kernels/2.6.4 menuconfig/var/tmp/kernel-output/2.6.4 The generated .config now ends up in /home/joe/kernels/2.6.4
Gentoo's tool config-kernel provides a mechanism for automating some of this processes. Using config-kernel, you can define a prefix for where kernels that get installed by portage will output their files to.
# config-kernel --output-dir=/home/joe/kernels
The above command will make all new kernels installed send their output by
default to
# config-kernel --output-dir=default
User can also convert already installed 2.6 kernels to the new method using config-kernel. Beware that this will cause all your previously generated files to be erased, since make mrproper must be run during this process.
# config-kernel --make-koutput=/usr/src/linux-2.6.3
The above command converts the kernel found in
After configuring a kernel to use a different output directory, the changes go largly unnoticed when configuring and isntalling a kernel. A few key files change locations that you should be aware of though. The main files to be concered with are .config, and the generated bzImage after compiling a kernel. Below is a table showing the original and new locations for some key files. We assume the kernel is a 2.6.4 kernel outputting to the Gentoo default of
Old file location | New file location |
---|---|