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