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