kbuild.txt 8.3 KB
Newer Older
M
Michal Marek 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14
Output files

modules.order
--------------------------------------------------
This file records the order in which modules appear in Makefiles. This
is used by modprobe to deterministically resolve aliases that match
multiple modules.

modules.builtin
--------------------------------------------------
This file lists all modules that are built into the kernel. This is used
by modprobe to not fail when trying to load something builtin.


15 16 17 18 19
Environment variables

KCPPFLAGS
--------------------------------------------------
Additional options to pass when preprocessing. The preprocessing options
R
Randy Dunlap 已提交
20
will be used in all cases where kbuild does preprocessing including
21 22 23 24
building C files and assembler files.

KAFLAGS
--------------------------------------------------
25 26 27 28
Additional options to the assembler (for built-in and modules).

AFLAGS_MODULE
--------------------------------------------------
L
Lucas De Marchi 已提交
29
Additional module specific options to use for $(AS).
30

31 32
AFLAGS_KERNEL
--------------------------------------------------
L
Lucas De Marchi 已提交
33
Additional options for $(AS) when used for assembler
34
code for code that is compiled as built-in.
35 36 37

KCFLAGS
--------------------------------------------------
38 39
Additional options to the C compiler (for built-in and modules).

40 41
CFLAGS_KERNEL
--------------------------------------------------
L
Lucas De Marchi 已提交
42
Additional options for $(CC) when used to compile
43 44
code that is compiled as built-in.

45 46
CFLAGS_MODULE
--------------------------------------------------
L
Lucas De Marchi 已提交
47
Additional module specific options to use for $(CC).
48 49 50 51

LDFLAGS_MODULE
--------------------------------------------------
Additional options used for $(LD) when linking modules.
52 53 54

KBUILD_VERBOSE
--------------------------------------------------
R
Randy Dunlap 已提交
55
Set the kbuild verbosity. Can be assigned same values as "V=...".
56 57 58 59 60 61 62 63 64
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
65 66
2) Environment variable KBUILD_EXTMOD
3) Environment variable SUBDIRS
67 68 69 70 71 72
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.
73
The output directory can also be specified using "O=...".
R
Randy Dunlap 已提交
74
Setting "O=..." takes precedence over KBUILD_OUTPUT.
75

76 77 78 79 80 81 82 83
KBUILD_DEBARCH
--------------------------------------------------
For the deb-pkg target, allows overriding the normal heuristics deployed by
deb-pkg. Normally deb-pkg attempts to guess the right architecture based on
the UTS_MACHINE variable, and on some architectures also the kernel config.
The value of KBUILD_DEBARCH is assumed (not checked) to be a valid Debian
architecture.

84 85 86 87 88
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 已提交
89
But some architectures such as x86 and sparc have aliases.
90
x86: i386 for 32 bit, x86_64 for 64 bit
91
sh: sh for 32 bit, sh64 for 64 bit
92
sparc: sparc32 for 32 bit, sparc64 for 64 bit
93 94 95 96 97 98

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

99
CROSS_COMPILE is also used for ccache in some setups.
100 101 102 103 104 105 106 107 108 109 110

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 已提交
111
images. Default is /boot, but you can set it to other values.
112

113 114 115 116 117 118 119 120 121 122 123
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)

124
The implementation of "make install" is architecture specific
125 126 127 128
and it may differ from the above.

INSTALLKERNEL is provided to enable the possibility to
specify a custom installer when cross compiling a kernel.
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149

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,
150
INSTALL_MOD_STRIP value will be used as the options to the strip command.
151 152 153

INSTALL_FW_PATH
--------------------------------------------------
R
Randy Dunlap 已提交
154
INSTALL_FW_PATH specifies where to install the firmware blobs.
155 156 157 158 159 160 161 162
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 已提交
163
INSTALL_HDR_PATH specifies where to install user space headers when
164 165 166 167 168 169 170 171 172 173
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.

174 175 176 177 178
KBUILD_SIGN_PIN
--------------------------------------------------
This variable allows a passphrase or PIN to be passed to the sign-file
utility when signing kernel modules, if the private key requires such.

179 180
KBUILD_MODPOST_WARN
--------------------------------------------------
R
Randy Dunlap 已提交
181 182 183
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.
184

R
Randy Dunlap 已提交
185
KBUILD_MODPOST_NOFINAL
186 187
--------------------------------------------------
KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
R
Randy Dunlap 已提交
188
This is solely useful to speed up test compiles.
189 190 191

KBUILD_EXTRA_SYMBOLS
--------------------------------------------------
R
Randy Dunlap 已提交
192
For modules that use symbols from other modules.
193
See more details in modules.txt.
194 195 196

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

    $ make ALLSOURCE_ARCHS="x86 mips arm" tags
201 202 203 204

To get all available archs you can also specify all. E.g.:

    $ make ALLSOURCE_ARCHS=all tags
B
Borislav Petkov 已提交
205 206 207 208 209

KBUILD_ENABLE_EXTRA_GCC_CHECKS
--------------------------------------------------
If enabled over the make command line with "W=1", it turns on additional
gcc -W... options for more extensive build-time checking.
210 211 212 213

KBUILD_BUILD_TIMESTAMP
--------------------------------------------------
Setting this to a date string overrides the timestamp used in the
214 215
UTS_VERSION definition (uname -v in the running kernel). The value has to
be a string that can be passed to date -d. The default value
216 217 218 219 220 221 222
is the output of the date command at one point during build.

KBUILD_BUILD_USER, KBUILD_BUILD_HOST
--------------------------------------------------
These two variables allow to override the user@host string displayed during
boot and in /proc/version. The default value is the output of the commands
whoami and host, respectively.
223 224 225 226 227 228 229 230 231 232 233 234 235

KBUILD_LDS
--------------------------------------------------
The linker script with full path. Assigned by the top-level Makefile.

KBUILD_VMLINUX_INIT
--------------------------------------------------
All object files for the init (first) part of vmlinux.
Files specified with KBUILD_VMLINUX_INIT are linked first.

KBUILD_VMLINUX_MAIN
--------------------------------------------------
All object files for the main part of vmlinux.
236 237 238 239 240 241

KBUILD_VMLINUX_LIBS
--------------------------------------------------
All .a "lib" files for vmlinux.
KBUILD_VMLINUX_INIT, KBUILD_VMLINUX_MAIN, and KBUILD_VMLINUX_LIBS together
specify all the object files used to link vmlinux.