]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blame - Documentation/kbuild/kbuild.rst
Merge tag 'dma-mapping-5.11-2' of git://git.infradead.org/users/hch/dma-mapping
[mirror_ubuntu-hirsute-kernel.git] / Documentation / kbuild / kbuild.rst
CommitLineData
cd238eff
MCC
1======
2Kbuild
3======
4
5
bc081dd6 6Output files
cd238eff 7============
bc081dd6
MM
8
9modules.order
cd238eff 10-------------
bc081dd6
MM
11This file records the order in which modules appear in Makefiles. This
12is used by modprobe to deterministically resolve aliases that match
13multiple modules.
14
15modules.builtin
cd238eff 16---------------
bc081dd6
MM
17This file lists all modules that are built into the kernel. This is used
18by modprobe to not fail when trying to load something builtin.
19
898490c0 20modules.builtin.modinfo
16886949 21-----------------------
898490c0
AG
22This file contains modinfo from all modules that are built into the kernel.
23Unlike modinfo of a separate module, all fields are prefixed with module name.
24
bc081dd6 25
acc08b51 26Environment variables
cd238eff 27=====================
acc08b51
SR
28
29KCPPFLAGS
cd238eff 30---------
acc08b51 31Additional options to pass when preprocessing. The preprocessing options
df291fa9 32will be used in all cases where kbuild does preprocessing including
acc08b51
SR
33building C files and assembler files.
34
35KAFLAGS
cd238eff 36-------
6588169d
SR
37Additional options to the assembler (for built-in and modules).
38
39AFLAGS_MODULE
cd238eff 40-------------
5ef87263 41Additional assembler options for modules.
acc08b51 42
80c00ba9 43AFLAGS_KERNEL
cd238eff 44-------------
5ef87263 45Additional assembler options for built-in.
acc08b51
SR
46
47KCFLAGS
cd238eff 48-------
6588169d
SR
49Additional options to the C compiler (for built-in and modules).
50
80c00ba9 51CFLAGS_KERNEL
cd238eff 52-------------
25985edc 53Additional options for $(CC) when used to compile
80c00ba9
SR
54code that is compiled as built-in.
55
6588169d 56CFLAGS_MODULE
cd238eff 57-------------
25985edc 58Additional module specific options to use for $(CC).
6588169d
SR
59
60LDFLAGS_MODULE
cd238eff 61--------------
6588169d 62Additional options used for $(LD) when linking modules.
acc08b51 63
f92d19e0 64HOSTCFLAGS
cd238eff 65----------
f92d19e0
LA
66Additional flags to be passed to $(HOSTCC) when building host programs.
67
68HOSTCXXFLAGS
cd238eff 69------------
f92d19e0
LA
70Additional flags to be passed to $(HOSTCXX) when building host programs.
71
72HOSTLDFLAGS
cd238eff 73-----------
f92d19e0
LA
74Additional flags to be passed when linking host programs.
75
76HOSTLDLIBS
cd238eff 77----------
f92d19e0
LA
78Additional libraries to link against when building host programs.
79
00e0793f 80KBUILD_KCONFIG
cd238eff 81--------------
00e0793f
RD
82Set the top-level Kconfig file to the value of this environment
83variable. The default name is "Kconfig".
84
acc08b51 85KBUILD_VERBOSE
cd238eff 86--------------
df291fa9 87Set the kbuild verbosity. Can be assigned same values as "V=...".
cd238eff 88
acc08b51 89See make help for the full list.
cd238eff 90
acc08b51
SR
91Setting "V=..." takes precedence over KBUILD_VERBOSE.
92
93KBUILD_EXTMOD
cd238eff 94-------------
acc08b51
SR
95Set the directory to look for the kernel source when building external
96modules.
cd238eff 97
0126be38 98Setting "M=..." takes precedence over KBUILD_EXTMOD.
acc08b51
SR
99
100KBUILD_OUTPUT
cd238eff 101-------------
acc08b51 102Specify the output directory when building the kernel.
cd238eff 103
c95940f2 104The output directory can also be specified using "O=...".
cd238eff 105
df291fa9 106Setting "O=..." takes precedence over KBUILD_OUTPUT.
acc08b51 107
e27128db
MY
108KBUILD_EXTRA_WARN
109-----------------
110Specify the extra build checks. The same value can be assigned by passing
111W=... from the command line.
112
113See `make help` for the list of the supported values.
114
115Setting "W=..." takes precedence over KBUILD_EXTRA_WARN.
116
55f88ecc 117KBUILD_DEBARCH
cd238eff 118--------------
55f88ecc
AST
119For the deb-pkg target, allows overriding the normal heuristics deployed by
120deb-pkg. Normally deb-pkg attempts to guess the right architecture based on
121the UTS_MACHINE variable, and on some architectures also the kernel config.
122The value of KBUILD_DEBARCH is assumed (not checked) to be a valid Debian
123architecture.
124
acc08b51 125ARCH
cd238eff 126----
acc08b51 127Set ARCH to the architecture to be built.
cd238eff 128
acc08b51
SR
129In most cases the name of the architecture is the same as the
130directory name found in the arch/ directory.
cd238eff 131
df291fa9 132But some architectures such as x86 and sparc have aliases.
cd238eff
MCC
133
134- x86: i386 for 32 bit, x86_64 for 64 bit
135- sh: sh for 32 bit, sh64 for 64 bit
136- sparc: sparc32 for 32 bit, sparc64 for 64 bit
acc08b51
SR
137
138CROSS_COMPILE
cd238eff 139-------------
acc08b51
SR
140Specify an optional fixed part of the binutils filename.
141CROSS_COMPILE can be a part of the filename or the full path.
142
e8d400a9 143CROSS_COMPILE is also used for ccache in some setups.
acc08b51
SR
144
145CF
cd238eff 146--
acc08b51 147Additional options for sparse.
cd238eff
MCC
148
149CF is often used on the command-line like this::
acc08b51
SR
150
151 make CF=-Wbitwise C=2
152
153INSTALL_PATH
cd238eff 154------------
acc08b51 155INSTALL_PATH specifies where to place the updated kernel and system map
df291fa9 156images. Default is /boot, but you can set it to other values.
acc08b51 157
caa27b66 158INSTALLKERNEL
cd238eff 159-------------
caa27b66
SR
160Install script called when using "make install".
161The default name is "installkernel".
162
163The script will be called with the following arguments:
16886949 164
cd238eff
MCC
165 - $1 - kernel version
166 - $2 - kernel image file
167 - $3 - kernel map file
168 - $4 - default install path (use root directory if blank)
caa27b66 169
c95940f2 170The implementation of "make install" is architecture specific
caa27b66
SR
171and it may differ from the above.
172
173INSTALLKERNEL is provided to enable the possibility to
174specify a custom installer when cross compiling a kernel.
acc08b51
SR
175
176MODLIB
cd238eff 177------
acc08b51 178Specify where to install modules.
cd238eff 179The default value is::
acc08b51
SR
180
181 $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
182
183The value can be overridden in which case the default value is ignored.
184
185INSTALL_MOD_PATH
cd238eff 186----------------
acc08b51
SR
187INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
188relocations required by build roots. This is not defined in the
189makefile but the argument can be passed to make if needed.
190
191INSTALL_MOD_STRIP
cd238eff 192-----------------
acc08b51
SR
193INSTALL_MOD_STRIP, if defined, will cause modules to be
194stripped after they are installed. If INSTALL_MOD_STRIP is '1', then
195the default option --strip-debug will be used. Otherwise,
177b241d 196INSTALL_MOD_STRIP value will be used as the options to the strip command.
acc08b51 197
acc08b51 198INSTALL_HDR_PATH
cd238eff 199----------------
df291fa9 200INSTALL_HDR_PATH specifies where to install user space headers when
acc08b51 201executing "make headers_*".
cd238eff
MCC
202
203The default value is::
acc08b51
SR
204
205 $(objtree)/usr
206
207$(objtree) is the directory where output files are saved.
208The output directory is often set using "O=..." on the commandline.
209
210The value can be overridden in which case the default value is ignored.
211
95fd3f87
MY
212KBUILD_ABS_SRCTREE
213--------------------------------------------------
214Kbuild uses a relative path to point to the tree when possible. For instance,
215when building in the source tree, the source tree path is '.'
216
217Setting this flag requests Kbuild to use absolute path to the source tree.
218There are some useful cases to do so, like when generating tag files with
219absolute path entries etc.
220
af1eb291 221KBUILD_SIGN_PIN
cd238eff 222---------------
af1eb291
DW
223This variable allows a passphrase or PIN to be passed to the sign-file
224utility when signing kernel modules, if the private key requires such.
225
acc08b51 226KBUILD_MODPOST_WARN
cd238eff 227-------------------
df291fa9
RD
228KBUILD_MODPOST_WARN can be set to avoid errors in case of undefined
229symbols in the final module linking stage. It changes such errors
230into warnings.
acc08b51 231
df291fa9 232KBUILD_MODPOST_NOFINAL
cd238eff 233----------------------
acc08b51 234KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
df291fa9 235This is solely useful to speed up test compiles.
acc08b51
SR
236
237KBUILD_EXTRA_SYMBOLS
cd238eff 238--------------------
df291fa9 239For modules that use symbols from other modules.
2eebb7ab 240See more details in modules.rst.
4f628248
JS
241
242ALLSOURCE_ARCHS
cd238eff 243---------------
df291fa9 244For tags/TAGS/cscope targets, you can specify more than one arch
cd238eff 245to be included in the databases, separated by blank space. E.g.::
4f628248
JS
246
247 $ make ALLSOURCE_ARCHS="x86 mips arm" tags
bc75cc6b 248
cd238eff 249To get all available archs you can also specify all. E.g.::
bc75cc6b
JK
250
251 $ make ALLSOURCE_ARCHS=all tags
4a5838ad 252
53e6892c 253KBUILD_BUILD_TIMESTAMP
cd238eff 254----------------------
53e6892c 255Setting this to a date string overrides the timestamp used in the
a8b8017c
MM
256UTS_VERSION definition (uname -v in the running kernel). The value has to
257be a string that can be passed to date -d. The default value
53e6892c
MM
258is the output of the date command at one point during build.
259
260KBUILD_BUILD_USER, KBUILD_BUILD_HOST
cd238eff 261------------------------------------
53e6892c
MM
262These two variables allow to override the user@host string displayed during
263boot and in /proc/version. The default value is the output of the commands
264whoami and host, respectively.
a0d1c951
MY
265
266LLVM
267----
268If this variable is set to 1, Kbuild will use Clang and LLVM utilities instead
269of GCC and GNU binutils to build the kernel.