blob: 727520b3d7b10b627b5311370d7cd443695626d7 [file] [log] [blame]
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -03001======
2Kbuild
3======
4
5
Michal Marekbc081dd2009-12-07 16:38:33 +01006Output files
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -03007============
Michal Marekbc081dd2009-12-07 16:38:33 +01008
9modules.order
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -030010-------------
Michal Marekbc081dd2009-12-07 16:38:33 +010011This file records the order in which modules appear in Makefiles. This
12is used by modprobe to deterministically resolve aliases that match
13multiple modules.
14
15modules.builtin
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -030016---------------
Michal Marekbc081dd2009-12-07 16:38:33 +010017This file lists all modules that are built into the kernel. This is used
18by modprobe to not fail when trying to load something builtin.
19
Alexey Gladkov898490c2019-04-29 18:11:14 +020020modules.builtin.modinfo
21--------------------------------------------------
22This file contains modinfo from all modules that are built into the kernel.
23Unlike modinfo of a separate module, all fields are prefixed with module name.
24
Michal Marekbc081dd2009-12-07 16:38:33 +010025
Sam Ravnborgacc08b52008-12-29 13:45:52 +010026Environment variables
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -030027=====================
Sam Ravnborgacc08b52008-12-29 13:45:52 +010028
29KCPPFLAGS
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -030030---------
Sam Ravnborgacc08b52008-12-29 13:45:52 +010031Additional options to pass when preprocessing. The preprocessing options
Randy Dunlapdf291fa2009-01-08 10:59:34 -080032will be used in all cases where kbuild does preprocessing including
Sam Ravnborgacc08b52008-12-29 13:45:52 +010033building C files and assembler files.
34
35KAFLAGS
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -030036-------
Sam Ravnborg65881692010-07-28 17:33:09 +020037Additional options to the assembler (for built-in and modules).
38
39AFLAGS_MODULE
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -030040-------------
Masahiro Yamada5ef87262019-07-13 11:45:58 +090041Additional assembler options for modules.
Sam Ravnborgacc08b52008-12-29 13:45:52 +010042
Sam Ravnborg80c00ba2010-07-28 19:11:27 +020043AFLAGS_KERNEL
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -030044-------------
Masahiro Yamada5ef87262019-07-13 11:45:58 +090045Additional assembler options for built-in.
Sam Ravnborgacc08b52008-12-29 13:45:52 +010046
47KCFLAGS
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -030048-------
Sam Ravnborg65881692010-07-28 17:33:09 +020049Additional options to the C compiler (for built-in and modules).
50
Sam Ravnborg80c00ba2010-07-28 19:11:27 +020051CFLAGS_KERNEL
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -030052-------------
Lucas De Marchi25985ed2011-03-30 22:57:33 -030053Additional options for $(CC) when used to compile
Sam Ravnborg80c00ba2010-07-28 19:11:27 +020054code that is compiled as built-in.
55
Sam Ravnborg65881692010-07-28 17:33:09 +020056CFLAGS_MODULE
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -030057-------------
Lucas De Marchi25985ed2011-03-30 22:57:33 -030058Additional module specific options to use for $(CC).
Sam Ravnborg65881692010-07-28 17:33:09 +020059
60LDFLAGS_MODULE
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -030061--------------
Sam Ravnborg65881692010-07-28 17:33:09 +020062Additional options used for $(LD) when linking modules.
Sam Ravnborgacc08b52008-12-29 13:45:52 +010063
Laura Abbottf92d19e2018-07-09 17:46:02 -070064HOSTCFLAGS
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -030065----------
Laura Abbottf92d19e2018-07-09 17:46:02 -070066Additional flags to be passed to $(HOSTCC) when building host programs.
67
68HOSTCXXFLAGS
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -030069------------
Laura Abbottf92d19e2018-07-09 17:46:02 -070070Additional flags to be passed to $(HOSTCXX) when building host programs.
71
72HOSTLDFLAGS
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -030073-----------
Laura Abbottf92d19e2018-07-09 17:46:02 -070074Additional flags to be passed when linking host programs.
75
76HOSTLDLIBS
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -030077----------
Laura Abbottf92d19e2018-07-09 17:46:02 -070078Additional libraries to link against when building host programs.
79
Randy Dunlap00e07932018-07-04 19:47:39 -070080KBUILD_KCONFIG
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -030081--------------
Randy Dunlap00e07932018-07-04 19:47:39 -070082Set the top-level Kconfig file to the value of this environment
83variable. The default name is "Kconfig".
84
Sam Ravnborgacc08b52008-12-29 13:45:52 +010085KBUILD_VERBOSE
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -030086--------------
Randy Dunlapdf291fa2009-01-08 10:59:34 -080087Set the kbuild verbosity. Can be assigned same values as "V=...".
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -030088
Sam Ravnborgacc08b52008-12-29 13:45:52 +010089See make help for the full list.
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -030090
Sam Ravnborgacc08b52008-12-29 13:45:52 +010091Setting "V=..." takes precedence over KBUILD_VERBOSE.
92
93KBUILD_EXTMOD
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -030094-------------
Sam Ravnborgacc08b52008-12-29 13:45:52 +010095Set the directory to look for the kernel source when building external
96modules.
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -030097
Masahiro Yamada0126be32018-11-21 00:04:18 +090098Setting "M=..." takes precedence over KBUILD_EXTMOD.
Sam Ravnborgacc08b52008-12-29 13:45:52 +010099
100KBUILD_OUTPUT
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300101-------------
Sam Ravnborgacc08b52008-12-29 13:45:52 +0100102Specify the output directory when building the kernel.
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300103
Nicolas Kaiserc95940f2010-08-05 11:23:11 -0700104The output directory can also be specified using "O=...".
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300105
Randy Dunlapdf291fa2009-01-08 10:59:34 -0800106Setting "O=..." takes precedence over KBUILD_OUTPUT.
Sam Ravnborgacc08b52008-12-29 13:45:52 +0100107
Asbjoern Sloth Toennesen55f88ec2010-12-12 17:39:40 +0000108KBUILD_DEBARCH
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300109--------------
Asbjoern Sloth Toennesen55f88ec2010-12-12 17:39:40 +0000110For the deb-pkg target, allows overriding the normal heuristics deployed by
111deb-pkg. Normally deb-pkg attempts to guess the right architecture based on
112the UTS_MACHINE variable, and on some architectures also the kernel config.
113The value of KBUILD_DEBARCH is assumed (not checked) to be a valid Debian
114architecture.
115
Sam Ravnborgacc08b52008-12-29 13:45:52 +0100116ARCH
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300117----
Sam Ravnborgacc08b52008-12-29 13:45:52 +0100118Set ARCH to the architecture to be built.
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300119
Sam Ravnborgacc08b52008-12-29 13:45:52 +0100120In most cases the name of the architecture is the same as the
121directory name found in the arch/ directory.
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300122
Randy Dunlapdf291fa2009-01-08 10:59:34 -0800123But some architectures such as x86 and sparc have aliases.
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300124
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
Sam Ravnborgacc08b52008-12-29 13:45:52 +0100128
129CROSS_COMPILE
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300130-------------
Sam Ravnborgacc08b52008-12-29 13:45:52 +0100131Specify an optional fixed part of the binutils filename.
132CROSS_COMPILE can be a part of the filename or the full path.
133
Kirill Smelkove8d400a2010-02-17 11:45:33 +0300134CROSS_COMPILE is also used for ccache in some setups.
Sam Ravnborgacc08b52008-12-29 13:45:52 +0100135
136CF
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300137--
Sam Ravnborgacc08b52008-12-29 13:45:52 +0100138Additional options for sparse.
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300139
140CF is often used on the command-line like this::
Sam Ravnborgacc08b52008-12-29 13:45:52 +0100141
142 make CF=-Wbitwise C=2
143
144INSTALL_PATH
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300145------------
Sam Ravnborgacc08b52008-12-29 13:45:52 +0100146INSTALL_PATH specifies where to place the updated kernel and system map
Randy Dunlapdf291fa2009-01-08 10:59:34 -0800147images. Default is /boot, but you can set it to other values.
Sam Ravnborgacc08b52008-12-29 13:45:52 +0100148
Sam Ravnborgcaa27b62009-07-20 21:37:11 +0200149INSTALLKERNEL
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300150-------------
Sam Ravnborgcaa27b62009-07-20 21:37:11 +0200151Install script called when using "make install".
152The default name is "installkernel".
153
154The script will be called with the following arguments:
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300155 - $1 - kernel version
156 - $2 - kernel image file
157 - $3 - kernel map file
158 - $4 - default install path (use root directory if blank)
Sam Ravnborgcaa27b62009-07-20 21:37:11 +0200159
Nicolas Kaiserc95940f2010-08-05 11:23:11 -0700160The implementation of "make install" is architecture specific
Sam Ravnborgcaa27b62009-07-20 21:37:11 +0200161and it may differ from the above.
162
163INSTALLKERNEL is provided to enable the possibility to
164specify a custom installer when cross compiling a kernel.
Sam Ravnborgacc08b52008-12-29 13:45:52 +0100165
166MODLIB
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300167------
Sam Ravnborgacc08b52008-12-29 13:45:52 +0100168Specify where to install modules.
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300169The default value is::
Sam Ravnborgacc08b52008-12-29 13:45:52 +0100170
171 $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
172
173The value can be overridden in which case the default value is ignored.
174
175INSTALL_MOD_PATH
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300176----------------
Sam Ravnborgacc08b52008-12-29 13:45:52 +0100177INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
178relocations required by build roots. This is not defined in the
179makefile but the argument can be passed to make if needed.
180
181INSTALL_MOD_STRIP
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300182-----------------
Sam Ravnborgacc08b52008-12-29 13:45:52 +0100183INSTALL_MOD_STRIP, if defined, will cause modules to be
184stripped after they are installed. If INSTALL_MOD_STRIP is '1', then
185the default option --strip-debug will be used. Otherwise,
Gilles Espinasse177b2412011-01-09 08:59:49 +0100186INSTALL_MOD_STRIP value will be used as the options to the strip command.
Sam Ravnborgacc08b52008-12-29 13:45:52 +0100187
Sam Ravnborgacc08b52008-12-29 13:45:52 +0100188INSTALL_HDR_PATH
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300189----------------
Randy Dunlapdf291fa2009-01-08 10:59:34 -0800190INSTALL_HDR_PATH specifies where to install user space headers when
Sam Ravnborgacc08b52008-12-29 13:45:52 +0100191executing "make headers_*".
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300192
193The default value is::
Sam Ravnborgacc08b52008-12-29 13:45:52 +0100194
195 $(objtree)/usr
196
197$(objtree) is the directory where output files are saved.
198The output directory is often set using "O=..." on the commandline.
199
200The value can be overridden in which case the default value is ignored.
201
Linus Torvalds39ceda52019-07-12 16:03:16 -0700202KBUILD_ABS_SRCTREE
203--------------------------------------------------
204Kbuild uses a relative path to point to the tree when possible. For instance,
205when building in the source tree, the source tree path is '.'
206
207Setting this flag requests Kbuild to use absolute path to the source tree.
208There are some useful cases to do so, like when generating tag files with
209absolute path entries etc.
210
David Woodhouseaf1eb292015-07-20 21:16:28 +0100211KBUILD_SIGN_PIN
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300212---------------
David Woodhouseaf1eb292015-07-20 21:16:28 +0100213This variable allows a passphrase or PIN to be passed to the sign-file
214utility when signing kernel modules, if the private key requires such.
215
Sam Ravnborgacc08b52008-12-29 13:45:52 +0100216KBUILD_MODPOST_WARN
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300217-------------------
Randy Dunlapdf291fa2009-01-08 10:59:34 -0800218KBUILD_MODPOST_WARN can be set to avoid errors in case of undefined
219symbols in the final module linking stage. It changes such errors
220into warnings.
Sam Ravnborgacc08b52008-12-29 13:45:52 +0100221
Randy Dunlapdf291fa2009-01-08 10:59:34 -0800222KBUILD_MODPOST_NOFINAL
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300223----------------------
Sam Ravnborgacc08b52008-12-29 13:45:52 +0100224KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
Randy Dunlapdf291fa2009-01-08 10:59:34 -0800225This is solely useful to speed up test compiles.
Sam Ravnborgacc08b52008-12-29 13:45:52 +0100226
227KBUILD_EXTRA_SYMBOLS
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300228--------------------
Randy Dunlapdf291fa2009-01-08 10:59:34 -0800229For modules that use symbols from other modules.
Sam Ravnborgacc08b52008-12-29 13:45:52 +0100230See more details in modules.txt.
Jike Song4f628242009-01-05 14:57:03 +0800231
232ALLSOURCE_ARCHS
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300233---------------
Randy Dunlapdf291fa2009-01-08 10:59:34 -0800234For tags/TAGS/cscope targets, you can specify more than one arch
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300235to be included in the databases, separated by blank space. E.g.::
Jike Song4f628242009-01-05 14:57:03 +0800236
237 $ make ALLSOURCE_ARCHS="x86 mips arm" tags
John Kacurbc75cc62010-03-02 16:57:52 +0100238
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300239To get all available archs you can also specify all. E.g.::
John Kacurbc75cc62010-03-02 16:57:52 +0100240
241 $ make ALLSOURCE_ARCHS=all tags
Borislav Petkov4a5838a2011-03-01 09:35:29 +0100242
243KBUILD_ENABLE_EXTRA_GCC_CHECKS
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300244------------------------------
Borislav Petkov4a5838a2011-03-01 09:35:29 +0100245If enabled over the make command line with "W=1", it turns on additional
246gcc -W... options for more extensive build-time checking.
Michal Marek53e68922011-04-05 14:32:30 +0200247
248KBUILD_BUILD_TIMESTAMP
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300249----------------------
Michal Marek53e68922011-04-05 14:32:30 +0200250Setting this to a date string overrides the timestamp used in the
Michal Mareka8b80172011-03-31 23:16:42 +0200251UTS_VERSION definition (uname -v in the running kernel). The value has to
252be a string that can be passed to date -d. The default value
Michal Marek53e68922011-04-05 14:32:30 +0200253is the output of the date command at one point during build.
254
255KBUILD_BUILD_USER, KBUILD_BUILD_HOST
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300256------------------------------------
Michal Marek53e68922011-04-05 14:32:30 +0200257These two variables allow to override the user@host string displayed during
258boot and in /proc/version. The default value is the output of the commands
259whoami and host, respectively.
Sam Ravnborgd27579a2012-05-05 10:18:42 +0200260
261KBUILD_LDS
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300262----------
Sam Ravnborgd27579a2012-05-05 10:18:42 +0200263The linker script with full path. Assigned by the top-level Makefile.
264
Masahiro Yamadad151e972019-01-17 09:10:04 +0900265KBUILD_VMLINUX_OBJS
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300266-------------------
Masahiro Yamadad151e972019-01-17 09:10:04 +0900267All object files for vmlinux. They are linked to vmlinux in the same
268order as listed in KBUILD_VMLINUX_OBJS.
Nicholas Piggin3a166fc2017-06-20 01:52:05 +1000269
270KBUILD_VMLINUX_LIBS
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -0300271-------------------
Masahiro Yamadad151e972019-01-17 09:10:04 +0900272All .a "lib" files for vmlinux. KBUILD_VMLINUX_OBJS and KBUILD_VMLINUX_LIBS
273together specify all the object files used to link vmlinux.