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