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