• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1======
2Kbuild
3======
4
5
6Output files
7============
8
9modules.order
10-------------
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
16---------------
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
20modules.builtin.modinfo
21-----------------------
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
25modules.builtin.ranges
26----------------------
27This file contains address offset ranges (per ELF section) for all modules
28that are built into the kernel. Together with System.map, it can be used
29to associate module names with symbols.
30
31Environment variables
32=====================
33
34KCPPFLAGS
35---------
36Additional options to pass when preprocessing. The preprocessing options
37will be used in all cases where kbuild does preprocessing including
38building C files and assembler files.
39
40KCPPFLAGS_COMPAT
41----------------
42Additional options to pass to $(CC_COMPAT) when preprocessing C and assembler
43files.
44
45KAFLAGS
46-------
47Additional options to the assembler (for built-in and modules).
48
49AFLAGS_MODULE
50-------------
51Additional assembler options for modules.
52
53AFLAGS_KERNEL
54-------------
55Additional assembler options for built-in.
56
57KCFLAGS
58-------
59Additional options to the C compiler (for built-in and modules).
60
61KRUSTFLAGS
62----------
63Additional options to the Rust compiler (for built-in and modules).
64
65CFLAGS_KERNEL
66-------------
67Additional options for $(CC) when used to compile
68code that is compiled as built-in.
69
70CFLAGS_MODULE
71-------------
72Additional module specific options to use for $(CC).
73
74RUSTFLAGS_KERNEL
75----------------
76Additional options for $(RUSTC) when used to compile
77code that is compiled as built-in.
78
79RUSTFLAGS_MODULE
80----------------
81Additional module specific options to use for $(RUSTC).
82
83LDFLAGS_MODULE
84--------------
85Additional options used for $(LD) when linking modules.
86
87HOSTCFLAGS
88----------
89Additional flags to be passed to $(HOSTCC) when building host programs.
90
91HOSTCXXFLAGS
92------------
93Additional flags to be passed to $(HOSTCXX) when building host programs.
94
95HOSTRUSTFLAGS
96-------------
97Additional flags to be passed to $(HOSTRUSTC) when building host programs.
98
99PROCMACROLDFLAGS
100----------------
101Flags to be passed when linking Rust proc macros. Since proc macros are loaded
102by rustc at build time, they must be linked in a way that is compatible with
103the rustc toolchain being used.
104
105For instance, it can be useful when rustc uses a different C library than
106the one the user wants to use for host programs.
107
108If unset, it defaults to the flags passed when linking host programs.
109
110HOSTLDFLAGS
111-----------
112Additional flags to be passed when linking host programs.
113
114HOSTLDLIBS
115----------
116Additional libraries to link against when building host programs.
117
118.. _userkbuildflags:
119
120USERCFLAGS
121----------
122Additional options used for $(CC) when compiling userprogs.
123
124USERLDFLAGS
125-----------
126Additional options used for $(LD) when linking userprogs. userprogs are linked
127with CC, so $(USERLDFLAGS) should include "-Wl," prefix as applicable.
128
129KBUILD_KCONFIG
130--------------
131Set the top-level Kconfig file to the value of this environment
132variable.  The default name is "Kconfig".
133
134KBUILD_VERBOSE
135--------------
136Set the kbuild verbosity. Can be assigned same values as "V=...".
137
138See make help for the full list.
139
140Setting "V=..." takes precedence over KBUILD_VERBOSE.
141
142KBUILD_EXTMOD
143-------------
144Set the directory to look for the kernel source when building external
145modules.
146
147Setting "M=..." takes precedence over KBUILD_EXTMOD.
148
149KBUILD_OUTPUT
150-------------
151Specify the output directory when building the kernel.
152
153This variable can also be used to point to the kernel output directory when
154building external modules against a pre-built kernel in a separate build
155directory. Please note that this does NOT specify the output directory for the
156external modules themselves.
157
158The output directory can also be specified using "O=...".
159
160Setting "O=..." takes precedence over KBUILD_OUTPUT.
161
162KBUILD_EXTRA_WARN
163-----------------
164Specify the extra build checks. The same value can be assigned by passing
165W=... from the command line.
166
167See `make help` for the list of the supported values.
168
169Setting "W=..." takes precedence over KBUILD_EXTRA_WARN.
170
171KBUILD_DEBARCH
172--------------
173For the deb-pkg target, allows overriding the normal heuristics deployed by
174deb-pkg. Normally deb-pkg attempts to guess the right architecture based on
175the UTS_MACHINE variable, and on some architectures also the kernel config.
176The value of KBUILD_DEBARCH is assumed (not checked) to be a valid Debian
177architecture.
178
179KDOCFLAGS
180---------
181Specify extra (warning/error) flags for kernel-doc checks during the build,
182see scripts/kernel-doc for which flags are supported. Note that this doesn't
183(currently) apply to documentation builds.
184
185ARCH
186----
187Set ARCH to the architecture to be built.
188
189In most cases the name of the architecture is the same as the
190directory name found in the arch/ directory.
191
192But some architectures such as x86 and sparc have aliases.
193
194- x86: i386 for 32 bit, x86_64 for 64 bit
195- parisc: parisc64 for 64 bit
196- sparc: sparc32 for 32 bit, sparc64 for 64 bit
197
198CROSS_COMPILE
199-------------
200Specify an optional fixed part of the binutils filename.
201CROSS_COMPILE can be a part of the filename or the full path.
202
203CROSS_COMPILE is also used for ccache in some setups.
204
205CF
206--
207Additional options for sparse.
208
209CF is often used on the command-line like this::
210
211    make CF=-Wbitwise C=2
212
213INSTALL_PATH
214------------
215INSTALL_PATH specifies where to place the updated kernel and system map
216images. Default is /boot, but you can set it to other values.
217
218INSTALLKERNEL
219-------------
220Install script called when using "make install".
221The default name is "installkernel".
222
223The script will be called with the following arguments:
224
225   - $1 - kernel version
226   - $2 - kernel image file
227   - $3 - kernel map file
228   - $4 - default install path (use root directory if blank)
229
230The implementation of "make install" is architecture specific
231and it may differ from the above.
232
233INSTALLKERNEL is provided to enable the possibility to
234specify a custom installer when cross compiling a kernel.
235
236MODLIB
237------
238Specify where to install modules.
239The default value is::
240
241     $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
242
243The value can be overridden in which case the default value is ignored.
244
245INSTALL_MOD_PATH
246----------------
247INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
248relocations required by build roots.  This is not defined in the
249makefile but the argument can be passed to make if needed.
250
251INSTALL_MOD_STRIP
252-----------------
253INSTALL_MOD_STRIP, if defined, will cause modules to be
254stripped after they are installed.  If INSTALL_MOD_STRIP is '1', then
255the default option --strip-debug will be used.  Otherwise,
256INSTALL_MOD_STRIP value will be used as the options to the strip command.
257
258INSTALL_HDR_PATH
259----------------
260INSTALL_HDR_PATH specifies where to install user space headers when
261executing "make headers_*".
262
263The default value is::
264
265    $(objtree)/usr
266
267$(objtree) is the directory where output files are saved.
268The output directory is often set using "O=..." on the commandline.
269
270The value can be overridden in which case the default value is ignored.
271
272INSTALL_DTBS_PATH
273-----------------
274INSTALL_DTBS_PATH specifies where to install device tree blobs for
275relocations required by build roots.  This is not defined in the
276makefile but the argument can be passed to make if needed.
277
278KBUILD_ABS_SRCTREE
279--------------------------------------------------
280Kbuild uses a relative path to point to the tree when possible. For instance,
281when building in the source tree, the source tree path is '.'
282
283Setting this flag requests Kbuild to use absolute path to the source tree.
284There are some useful cases to do so, like when generating tag files with
285absolute path entries etc.
286
287KBUILD_SIGN_PIN
288---------------
289This variable allows a passphrase or PIN to be passed to the sign-file
290utility when signing kernel modules, if the private key requires such.
291
292KBUILD_MODPOST_WARN
293-------------------
294KBUILD_MODPOST_WARN can be set to avoid errors in case of undefined
295symbols in the final module linking stage. It changes such errors
296into warnings.
297
298KBUILD_MODPOST_NOFINAL
299----------------------
300KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
301This is solely useful to speed up test compiles.
302
303KBUILD_EXTRA_SYMBOLS
304--------------------
305For modules that use symbols from other modules.
306See more details in modules.rst.
307
308ALLSOURCE_ARCHS
309---------------
310For tags/TAGS/cscope targets, you can specify more than one arch
311to be included in the databases, separated by blank space. E.g.::
312
313    $ make ALLSOURCE_ARCHS="x86 mips arm" tags
314
315To get all available archs you can also specify all. E.g.::
316
317    $ make ALLSOURCE_ARCHS=all tags
318
319IGNORE_DIRS
320-----------
321For tags/TAGS/cscope targets, you can choose which directories won't
322be included in the databases, separated by blank space. E.g.::
323
324    $ make IGNORE_DIRS="drivers/gpu/drm/radeon tools" cscope
325
326KBUILD_BUILD_TIMESTAMP
327----------------------
328Setting this to a date string overrides the timestamp used in the
329UTS_VERSION definition (uname -v in the running kernel). The value has to
330be a string that can be passed to date -d. The default value
331is the output of the date command at one point during build.
332
333KBUILD_BUILD_USER, KBUILD_BUILD_HOST
334------------------------------------
335These two variables allow to override the user@host string displayed during
336boot and in /proc/version. The default value is the output of the commands
337whoami and host, respectively.
338
339LLVM
340----
341If this variable is set to 1, Kbuild will use Clang and LLVM utilities instead
342of GCC and GNU binutils to build the kernel.
343