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