kbuild.txt 5.0 KB
Newer Older
1 2 3 4 5
Environment variables

KCPPFLAGS
--------------------------------------------------
Additional options to pass when preprocessing. The preprocessing options
R
Randy Dunlap 已提交
6
will be used in all cases where kbuild does preprocessing including
7 8 9 10 11 12 13 14 15 16 17 18
building C files and assembler files.

KAFLAGS
--------------------------------------------------
Additional options to the assembler.

KCFLAGS
--------------------------------------------------
Additional options to the C compiler.

KBUILD_VERBOSE
--------------------------------------------------
R
Randy Dunlap 已提交
19
Set the kbuild verbosity. Can be assigned same values as "V=...".
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
See make help for the full list.
Setting "V=..." takes precedence over KBUILD_VERBOSE.

KBUILD_EXTMOD
--------------------------------------------------
Set the directory to look for the kernel source when building external
modules.
The directory can be specified in several ways:
1) Use "M=..." on the command line
2) Environmnet variable KBUILD_EXTMOD
3) Environmnet variable SUBDIRS
The possibilities are listed in the order they take precedence.
Using "M=..." will always override the others.

KBUILD_OUTPUT
--------------------------------------------------
Specify the output directory when building the kernel.
The output directory can also be specificed using "O=...".
R
Randy Dunlap 已提交
38
Setting "O=..." takes precedence over KBUILD_OUTPUT.
39 40 41 42 43 44

ARCH
--------------------------------------------------
Set ARCH to the architecture to be built.
In most cases the name of the architecture is the same as the
directory name found in the arch/ directory.
R
Randy Dunlap 已提交
45
But some architectures such as x86 and sparc have aliases.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
x86: i386 for 32 bit, x86_64 for 64 bit
sparc: sparc for 32 bit, sparc64 for 64 bit

CROSS_COMPILE
--------------------------------------------------
Specify an optional fixed part of the binutils filename.
CROSS_COMPILE can be a part of the filename or the full path.

CROSS_COMPILE is also used for ccache is some setups.

CF
--------------------------------------------------
Additional options for sparse.
CF is often used on the command-line like this:

    make CF=-Wbitwise C=2

INSTALL_PATH
--------------------------------------------------
INSTALL_PATH specifies where to place the updated kernel and system map
R
Randy Dunlap 已提交
66
images. Default is /boot, but you can set it to other values.
67

68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
INSTALLKERNEL
--------------------------------------------------
Install script called when using "make install".
The default name is "installkernel".

The script will be called with the following arguments:
    $1 - kernel version
    $2 - kernel image file
    $3 - kernel map file
    $4 - default install path (use root directory if blank)

The implmentation of "make install" is architecture specific
and it may differ from the above.

INSTALLKERNEL is provided to enable the possibility to
specify a custom installer when cross compiling a kernel.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108

MODLIB
--------------------------------------------------
Specify where to install modules.
The default value is:

     $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)

The value can be overridden in which case the default value is ignored.

INSTALL_MOD_PATH
--------------------------------------------------
INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
relocations required by build roots.  This is not defined in the
makefile but the argument can be passed to make if needed.

INSTALL_MOD_STRIP
--------------------------------------------------
INSTALL_MOD_STRIP, if defined, will cause modules to be
stripped after they are installed.  If INSTALL_MOD_STRIP is '1', then
the default option --strip-debug will be used.  Otherwise,
INSTALL_MOD_STRIP will used as the options to the strip command.

INSTALL_FW_PATH
--------------------------------------------------
R
Randy Dunlap 已提交
109
INSTALL_FW_PATH specifies where to install the firmware blobs.
110 111 112 113 114 115 116 117
The default value is:

    $(INSTALL_MOD_PATH)/lib/firmware

The value can be overridden in which case the default value is ignored.

INSTALL_HDR_PATH
--------------------------------------------------
R
Randy Dunlap 已提交
118
INSTALL_HDR_PATH specifies where to install user space headers when
119 120 121 122 123 124 125 126 127 128 129 130
executing "make headers_*".
The default value is:

    $(objtree)/usr

$(objtree) is the directory where output files are saved.
The output directory is often set using "O=..." on the commandline.

The value can be overridden in which case the default value is ignored.

KBUILD_MODPOST_WARN
--------------------------------------------------
R
Randy Dunlap 已提交
131 132 133
KBUILD_MODPOST_WARN can be set to avoid errors in case of undefined
symbols in the final module linking stage. It changes such errors
into warnings.
134

R
Randy Dunlap 已提交
135
KBUILD_MODPOST_NOFINAL
136 137
--------------------------------------------------
KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
R
Randy Dunlap 已提交
138
This is solely useful to speed up test compiles.
139 140 141

KBUILD_EXTRA_SYMBOLS
--------------------------------------------------
R
Randy Dunlap 已提交
142
For modules that use symbols from other modules.
143
See more details in modules.txt.
144 145 146

ALLSOURCE_ARCHS
--------------------------------------------------
R
Randy Dunlap 已提交
147 148
For tags/TAGS/cscope targets, you can specify more than one arch
to be included in the databases, separated by blank space. E.g.:
149 150

    $ make ALLSOURCE_ARCHS="x86 mips arm" tags