2019-06-12 20:52:48 +03:00
======
Kbuild
======
2009-12-07 18:38:33 +03:00
Output files
2019-06-12 20:52:48 +03:00
============
2009-12-07 18:38:33 +03:00
modules.order
2019-06-12 20:52:48 +03:00
-------------
2009-12-07 18:38:33 +03:00
This file records the order in which modules appear in Makefiles. This
is used by modprobe to deterministically resolve aliases that match
multiple modules.
modules.builtin
2019-06-12 20:52:48 +03:00
---------------
2009-12-07 18:38:33 +03:00
This file lists all modules that are built into the kernel. This is used
by modprobe to not fail when trying to load something builtin.
2019-04-29 19:11:14 +03:00
modules.builtin.modinfo
2019-07-09 19:25:51 +03:00
-----------------------
2019-04-29 19:11:14 +03:00
This file contains modinfo from all modules that are built into the kernel.
Unlike modinfo of a separate module, all fields are prefixed with module name.
2009-12-07 18:38:33 +03:00
2008-12-29 15:45:52 +03:00
Environment variables
2019-06-12 20:52:48 +03:00
=====================
2008-12-29 15:45:52 +03:00
KCPPFLAGS
2019-06-12 20:52:48 +03:00
---------
2008-12-29 15:45:52 +03:00
Additional options to pass when preprocessing. The preprocessing options
2009-01-08 21:59:34 +03:00
will be used in all cases where kbuild does preprocessing including
2008-12-29 15:45:52 +03:00
building C files and assembler files.
KAFLAGS
2019-06-12 20:52:48 +03:00
-------
kbuild: allow assignment to {A,C,LD}FLAGS_MODULE on the command line
It is now possible to assign options to AS, CC and LD
on the command line - which is only used when building modules.
{A,C,LD}FLAGS_MODULE was all used both in the top-level Makefile
in the arch makefiles, thus users had no way to specify
additional options to AS, CC, LD when building modules
without overriding the original value.
Introduce a new set of variables KBUILD_{A,C,LD}FLAGS_MODULE
that is used by arch specific files and free up
{A,C,LD}FLAGS_MODULE so they can be assigned on
the command line.
All arch Makefiles that used the old variables has been updated.
Note: Previously we had a MODFLAGS variable for both
AS and CC. But in favour of consistency this was dropped.
So in some cases arch Makefile has one assignmnet replaced by
two assignmnets.
Note2: MODFLAGS was not documented and is dropped
without any notice. I do not expect much/any breakage
from this.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Denys Vlasenko <vda.linux@googlemail.com>
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Chen Liqin <liqin.chen@sunplusct.com>
Acked-by: Mike Frysinger <vapier@gentoo.org> [blackfin]
Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com> [avr32]
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-07-28 19:33:09 +04:00
Additional options to the assembler (for built-in and modules).
AFLAGS_MODULE
2019-06-12 20:52:48 +03:00
-------------
2019-07-13 05:45:58 +03:00
Additional assembler options for modules.
2008-12-29 15:45:52 +03:00
2010-07-28 21:11:27 +04:00
AFLAGS_KERNEL
2019-06-12 20:52:48 +03:00
-------------
2019-07-13 05:45:58 +03:00
Additional assembler options for built-in.
2008-12-29 15:45:52 +03:00
KCFLAGS
2019-06-12 20:52:48 +03:00
-------
kbuild: allow assignment to {A,C,LD}FLAGS_MODULE on the command line
It is now possible to assign options to AS, CC and LD
on the command line - which is only used when building modules.
{A,C,LD}FLAGS_MODULE was all used both in the top-level Makefile
in the arch makefiles, thus users had no way to specify
additional options to AS, CC, LD when building modules
without overriding the original value.
Introduce a new set of variables KBUILD_{A,C,LD}FLAGS_MODULE
that is used by arch specific files and free up
{A,C,LD}FLAGS_MODULE so they can be assigned on
the command line.
All arch Makefiles that used the old variables has been updated.
Note: Previously we had a MODFLAGS variable for both
AS and CC. But in favour of consistency this was dropped.
So in some cases arch Makefile has one assignmnet replaced by
two assignmnets.
Note2: MODFLAGS was not documented and is dropped
without any notice. I do not expect much/any breakage
from this.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Denys Vlasenko <vda.linux@googlemail.com>
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Chen Liqin <liqin.chen@sunplusct.com>
Acked-by: Mike Frysinger <vapier@gentoo.org> [blackfin]
Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com> [avr32]
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-07-28 19:33:09 +04:00
Additional options to the C compiler (for built-in and modules).
2010-07-28 21:11:27 +04:00
CFLAGS_KERNEL
2019-06-12 20:52:48 +03:00
-------------
2011-03-31 05:57:33 +04:00
Additional options for $(CC) when used to compile
2010-07-28 21:11:27 +04:00
code that is compiled as built-in.
kbuild: allow assignment to {A,C,LD}FLAGS_MODULE on the command line
It is now possible to assign options to AS, CC and LD
on the command line - which is only used when building modules.
{A,C,LD}FLAGS_MODULE was all used both in the top-level Makefile
in the arch makefiles, thus users had no way to specify
additional options to AS, CC, LD when building modules
without overriding the original value.
Introduce a new set of variables KBUILD_{A,C,LD}FLAGS_MODULE
that is used by arch specific files and free up
{A,C,LD}FLAGS_MODULE so they can be assigned on
the command line.
All arch Makefiles that used the old variables has been updated.
Note: Previously we had a MODFLAGS variable for both
AS and CC. But in favour of consistency this was dropped.
So in some cases arch Makefile has one assignmnet replaced by
two assignmnets.
Note2: MODFLAGS was not documented and is dropped
without any notice. I do not expect much/any breakage
from this.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Denys Vlasenko <vda.linux@googlemail.com>
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Chen Liqin <liqin.chen@sunplusct.com>
Acked-by: Mike Frysinger <vapier@gentoo.org> [blackfin]
Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com> [avr32]
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-07-28 19:33:09 +04:00
CFLAGS_MODULE
2019-06-12 20:52:48 +03:00
-------------
2011-03-31 05:57:33 +04:00
Additional module specific options to use for $(CC).
kbuild: allow assignment to {A,C,LD}FLAGS_MODULE on the command line
It is now possible to assign options to AS, CC and LD
on the command line - which is only used when building modules.
{A,C,LD}FLAGS_MODULE was all used both in the top-level Makefile
in the arch makefiles, thus users had no way to specify
additional options to AS, CC, LD when building modules
without overriding the original value.
Introduce a new set of variables KBUILD_{A,C,LD}FLAGS_MODULE
that is used by arch specific files and free up
{A,C,LD}FLAGS_MODULE so they can be assigned on
the command line.
All arch Makefiles that used the old variables has been updated.
Note: Previously we had a MODFLAGS variable for both
AS and CC. But in favour of consistency this was dropped.
So in some cases arch Makefile has one assignmnet replaced by
two assignmnets.
Note2: MODFLAGS was not documented and is dropped
without any notice. I do not expect much/any breakage
from this.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Denys Vlasenko <vda.linux@googlemail.com>
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Chen Liqin <liqin.chen@sunplusct.com>
Acked-by: Mike Frysinger <vapier@gentoo.org> [blackfin]
Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com> [avr32]
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-07-28 19:33:09 +04:00
LDFLAGS_MODULE
2019-06-12 20:52:48 +03:00
--------------
kbuild: allow assignment to {A,C,LD}FLAGS_MODULE on the command line
It is now possible to assign options to AS, CC and LD
on the command line - which is only used when building modules.
{A,C,LD}FLAGS_MODULE was all used both in the top-level Makefile
in the arch makefiles, thus users had no way to specify
additional options to AS, CC, LD when building modules
without overriding the original value.
Introduce a new set of variables KBUILD_{A,C,LD}FLAGS_MODULE
that is used by arch specific files and free up
{A,C,LD}FLAGS_MODULE so they can be assigned on
the command line.
All arch Makefiles that used the old variables has been updated.
Note: Previously we had a MODFLAGS variable for both
AS and CC. But in favour of consistency this was dropped.
So in some cases arch Makefile has one assignmnet replaced by
two assignmnets.
Note2: MODFLAGS was not documented and is dropped
without any notice. I do not expect much/any breakage
from this.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Denys Vlasenko <vda.linux@googlemail.com>
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Chen Liqin <liqin.chen@sunplusct.com>
Acked-by: Mike Frysinger <vapier@gentoo.org> [blackfin]
Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com> [avr32]
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-07-28 19:33:09 +04:00
Additional options used for $(LD) when linking modules.
2008-12-29 15:45:52 +03:00
2018-07-10 03:46:02 +03:00
HOSTCFLAGS
2019-06-12 20:52:48 +03:00
----------
2018-07-10 03:46:02 +03:00
Additional flags to be passed to $(HOSTCC) when building host programs.
HOSTCXXFLAGS
2019-06-12 20:52:48 +03:00
------------
2018-07-10 03:46:02 +03:00
Additional flags to be passed to $(HOSTCXX) when building host programs.
HOSTLDFLAGS
2019-06-12 20:52:48 +03:00
-----------
2018-07-10 03:46:02 +03:00
Additional flags to be passed when linking host programs.
HOSTLDLIBS
2019-06-12 20:52:48 +03:00
----------
2018-07-10 03:46:02 +03:00
Additional libraries to link against when building host programs.
2022-02-02 00:35:42 +03:00
.. _userkbuildflags:
USERCFLAGS
----------
Additional options used for $(CC) when compiling userprogs.
USERLDFLAGS
-----------
Additional options used for $(LD) when linking userprogs. userprogs are linked
with CC, so $(USERLDFLAGS) should include "-Wl," prefix as applicable.
2018-07-05 05:47:39 +03:00
KBUILD_KCONFIG
2019-06-12 20:52:48 +03:00
--------------
2018-07-05 05:47:39 +03:00
Set the top-level Kconfig file to the value of this environment
variable. The default name is "Kconfig".
2008-12-29 15:45:52 +03:00
KBUILD_VERBOSE
2019-06-12 20:52:48 +03:00
--------------
2009-01-08 21:59:34 +03:00
Set the kbuild verbosity. Can be assigned same values as "V=...".
2019-06-12 20:52:48 +03:00
2008-12-29 15:45:52 +03:00
See make help for the full list.
2019-06-12 20:52:48 +03:00
2008-12-29 15:45:52 +03:00
Setting "V=..." takes precedence over KBUILD_VERBOSE.
KBUILD_EXTMOD
2019-06-12 20:52:48 +03:00
-------------
2008-12-29 15:45:52 +03:00
Set the directory to look for the kernel source when building external
modules.
2019-06-12 20:52:48 +03:00
2018-11-20 18:04:18 +03:00
Setting "M=..." takes precedence over KBUILD_EXTMOD.
2008-12-29 15:45:52 +03:00
KBUILD_OUTPUT
2019-06-12 20:52:48 +03:00
-------------
2008-12-29 15:45:52 +03:00
Specify the output directory when building the kernel.
2019-06-12 20:52:48 +03:00
2010-08-05 22:23:11 +04:00
The output directory can also be specified using "O=...".
2019-06-12 20:52:48 +03:00
2009-01-08 21:59:34 +03:00
Setting "O=..." takes precedence over KBUILD_OUTPUT.
2008-12-29 15:45:52 +03:00
2019-08-31 19:25:55 +03:00
KBUILD_EXTRA_WARN
-----------------
Specify the extra build checks. The same value can be assigned by passing
W=... from the command line.
See `make help` for the list of the supported values.
Setting "W=..." takes precedence over KBUILD_EXTRA_WARN.
2010-12-12 20:39:40 +03:00
KBUILD_DEBARCH
2019-06-12 20:52:48 +03:00
--------------
2010-12-12 20:39:40 +03:00
For the deb-pkg target, allows overriding the normal heuristics deployed by
deb-pkg. Normally deb-pkg attempts to guess the right architecture based on
the UTS_MACHINE variable, and on some architectures also the kernel config.
The value of KBUILD_DEBARCH is assumed (not checked) to be a valid Debian
architecture.
2008-12-29 15:45:52 +03:00
ARCH
2019-06-12 20:52:48 +03:00
----
2008-12-29 15:45:52 +03:00
Set ARCH to the architecture to be built.
2019-06-12 20:52:48 +03:00
2008-12-29 15:45:52 +03:00
In most cases the name of the architecture is the same as the
directory name found in the arch/ directory.
2019-06-12 20:52:48 +03:00
2009-01-08 21:59:34 +03:00
But some architectures such as x86 and sparc have aliases.
2019-06-12 20:52:48 +03:00
- x86: i386 for 32 bit, x86_64 for 64 bit
- sh: sh for 32 bit, sh64 for 64 bit
- sparc: sparc32 for 32 bit, sparc64 for 64 bit
2008-12-29 15:45:52 +03:00
CROSS_COMPILE
2019-06-12 20:52:48 +03:00
-------------
2008-12-29 15:45:52 +03:00
Specify an optional fixed part of the binutils filename.
CROSS_COMPILE can be a part of the filename or the full path.
2010-02-17 11:45:33 +03:00
CROSS_COMPILE is also used for ccache in some setups.
2008-12-29 15:45:52 +03:00
CF
2019-06-12 20:52:48 +03:00
--
2008-12-29 15:45:52 +03:00
Additional options for sparse.
2019-06-12 20:52:48 +03:00
CF is often used on the command-line like this::
2008-12-29 15:45:52 +03:00
make CF=-Wbitwise C=2
INSTALL_PATH
2019-06-12 20:52:48 +03:00
------------
2008-12-29 15:45:52 +03:00
INSTALL_PATH specifies where to place the updated kernel and system map
2009-01-08 21:59:34 +03:00
images. Default is /boot, but you can set it to other values.
2008-12-29 15:45:52 +03:00
2009-07-20 23:37:11 +04:00
INSTALLKERNEL
2019-06-12 20:52:48 +03:00
-------------
2009-07-20 23:37:11 +04:00
Install script called when using "make install".
The default name is "installkernel".
The script will be called with the following arguments:
2019-07-09 19:25:51 +03:00
2019-06-12 20:52:48 +03:00
- $1 - kernel version
- $2 - kernel image file
- $3 - kernel map file
- $4 - default install path (use root directory if blank)
2009-07-20 23:37:11 +04:00
2010-08-05 22:23:11 +04:00
The implementation of "make install" is architecture specific
2009-07-20 23:37:11 +04:00
and it may differ from the above.
INSTALLKERNEL is provided to enable the possibility to
specify a custom installer when cross compiling a kernel.
2008-12-29 15:45:52 +03:00
MODLIB
2019-06-12 20:52:48 +03:00
------
2008-12-29 15:45:52 +03:00
Specify where to install modules.
2019-06-12 20:52:48 +03:00
The default value is::
2008-12-29 15:45:52 +03:00
$(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
The value can be overridden in which case the default value is ignored.
INSTALL_MOD_PATH
2019-06-12 20:52:48 +03:00
----------------
2008-12-29 15:45:52 +03:00
INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
relocations required by build roots. This is not defined in the
makefile but the argument can be passed to make if needed.
INSTALL_MOD_STRIP
2019-06-12 20:52:48 +03:00
-----------------
2008-12-29 15:45:52 +03:00
INSTALL_MOD_STRIP, if defined, will cause modules to be
stripped after they are installed. If INSTALL_MOD_STRIP is '1', then
the default option --strip-debug will be used. Otherwise,
2011-01-09 10:59:49 +03:00
INSTALL_MOD_STRIP value will be used as the options to the strip command.
2008-12-29 15:45:52 +03:00
INSTALL_HDR_PATH
2019-06-12 20:52:48 +03:00
----------------
2009-01-08 21:59:34 +03:00
INSTALL_HDR_PATH specifies where to install user space headers when
2008-12-29 15:45:52 +03:00
executing "make headers_*".
2019-06-12 20:52:48 +03:00
The default value is::
2008-12-29 15:45:52 +03:00
$(objtree)/usr
$(objtree) is the directory where output files are saved.
The output directory is often set using "O=..." on the commandline.
The value can be overridden in which case the default value is ignored.
2019-07-06 06:07:13 +03:00
KBUILD_ABS_SRCTREE
--------------------------------------------------
Kbuild uses a relative path to point to the tree when possible. For instance,
when building in the source tree, the source tree path is '.'
Setting this flag requests Kbuild to use absolute path to the source tree.
There are some useful cases to do so, like when generating tag files with
absolute path entries etc.
2015-07-20 23:16:28 +03:00
KBUILD_SIGN_PIN
2019-06-12 20:52:48 +03:00
---------------
2015-07-20 23:16:28 +03:00
This variable allows a passphrase or PIN to be passed to the sign-file
utility when signing kernel modules, if the private key requires such.
2008-12-29 15:45:52 +03:00
KBUILD_MODPOST_WARN
2019-06-12 20:52:48 +03:00
-------------------
2009-01-08 21:59:34 +03:00
KBUILD_MODPOST_WARN can be set to avoid errors in case of undefined
symbols in the final module linking stage. It changes such errors
into warnings.
2008-12-29 15:45:52 +03:00
2009-01-08 21:59:34 +03:00
KBUILD_MODPOST_NOFINAL
2019-06-12 20:52:48 +03:00
----------------------
2008-12-29 15:45:52 +03:00
KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
2009-01-08 21:59:34 +03:00
This is solely useful to speed up test compiles.
2008-12-29 15:45:52 +03:00
KBUILD_EXTRA_SYMBOLS
2019-06-12 20:52:48 +03:00
--------------------
2009-01-08 21:59:34 +03:00
For modules that use symbols from other modules.
2020-03-12 01:50:44 +03:00
See more details in modules.rst.
2009-01-05 09:57:03 +03:00
ALLSOURCE_ARCHS
2019-06-12 20:52:48 +03:00
---------------
2009-01-08 21:59:34 +03:00
For tags/TAGS/cscope targets, you can specify more than one arch
2019-06-12 20:52:48 +03:00
to be included in the databases, separated by blank space. E.g.::
2009-01-05 09:57:03 +03:00
$ make ALLSOURCE_ARCHS="x86 mips arm" tags
2010-03-02 18:57:52 +03:00
2019-06-12 20:52:48 +03:00
To get all available archs you can also specify all. E.g.::
2010-03-02 18:57:52 +03:00
$ make ALLSOURCE_ARCHS=all tags
2011-03-01 11:35:29 +03:00
2011-04-05 16:32:30 +04:00
KBUILD_BUILD_TIMESTAMP
2019-06-12 20:52:48 +03:00
----------------------
2011-04-05 16:32:30 +04:00
Setting this to a date string overrides the timestamp used in the
2011-04-01 01:16:42 +04:00
UTS_VERSION definition (uname -v in the running kernel). The value has to
be a string that can be passed to date -d. The default value
2011-04-05 16:32:30 +04:00
is the output of the date command at one point during build.
KBUILD_BUILD_USER, KBUILD_BUILD_HOST
2019-06-12 20:52:48 +03:00
------------------------------------
2011-04-05 16:32:30 +04:00
These two variables allow to override the user@host string displayed during
boot and in /proc/version. The default value is the output of the commands
whoami and host, respectively.
2020-04-08 04:36:23 +03:00
LLVM
----
If this variable is set to 1, Kbuild will use Clang and LLVM utilities instead
of GCC and GNU binutils to build the kernel.