327 lines · plain
1======2Kbuild3======4 5 6Output files7============8 9modules.order10-------------11This file records the order in which modules appear in Makefiles. This12is used by modprobe to deterministically resolve aliases that match13multiple modules.14 15modules.builtin16---------------17This file lists all modules that are built into the kernel. This is used18by modprobe to not fail when trying to load something builtin.19 20modules.builtin.modinfo21-----------------------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 25modules.builtin.ranges26----------------------27This file contains address offset ranges (per ELF section) for all modules28that are built into the kernel. Together with System.map, it can be used29to associate module names with symbols.30 31Environment variables32=====================33 34KCPPFLAGS35---------36Additional options to pass when preprocessing. The preprocessing options37will be used in all cases where kbuild does preprocessing including38building C files and assembler files.39 40KAFLAGS41-------42Additional options to the assembler (for built-in and modules).43 44AFLAGS_MODULE45-------------46Additional assembler options for modules.47 48AFLAGS_KERNEL49-------------50Additional assembler options for built-in.51 52KCFLAGS53-------54Additional options to the C compiler (for built-in and modules).55 56KRUSTFLAGS57----------58Additional options to the Rust compiler (for built-in and modules).59 60CFLAGS_KERNEL61-------------62Additional options for $(CC) when used to compile63code that is compiled as built-in.64 65CFLAGS_MODULE66-------------67Additional module specific options to use for $(CC).68 69RUSTFLAGS_KERNEL70----------------71Additional options for $(RUSTC) when used to compile72code that is compiled as built-in.73 74RUSTFLAGS_MODULE75----------------76Additional module specific options to use for $(RUSTC).77 78LDFLAGS_MODULE79--------------80Additional options used for $(LD) when linking modules.81 82HOSTCFLAGS83----------84Additional flags to be passed to $(HOSTCC) when building host programs.85 86HOSTCXXFLAGS87------------88Additional flags to be passed to $(HOSTCXX) when building host programs.89 90HOSTRUSTFLAGS91-------------92Additional flags to be passed to $(HOSTRUSTC) when building host programs.93 94HOSTLDFLAGS95-----------96Additional flags to be passed when linking host programs.97 98HOSTLDLIBS99----------100Additional libraries to link against when building host programs.101 102.. _userkbuildflags:103 104USERCFLAGS105----------106Additional options used for $(CC) when compiling userprogs.107 108USERLDFLAGS109-----------110Additional options used for $(LD) when linking userprogs. userprogs are linked111with CC, so $(USERLDFLAGS) should include "-Wl," prefix as applicable.112 113KBUILD_KCONFIG114--------------115Set the top-level Kconfig file to the value of this environment116variable. The default name is "Kconfig".117 118KBUILD_VERBOSE119--------------120Set the kbuild verbosity. Can be assigned same values as "V=...".121 122See make help for the full list.123 124Setting "V=..." takes precedence over KBUILD_VERBOSE.125 126KBUILD_EXTMOD127-------------128Set the directory to look for the kernel source when building external129modules.130 131Setting "M=..." takes precedence over KBUILD_EXTMOD.132 133KBUILD_OUTPUT134-------------135Specify the output directory when building the kernel.136 137This variable can also be used to point to the kernel output directory when138building external modules against a pre-built kernel in a separate build139directory. Please note that this does NOT specify the output directory for the140external modules themselves.141 142The output directory can also be specified using "O=...".143 144Setting "O=..." takes precedence over KBUILD_OUTPUT.145 146KBUILD_EXTRA_WARN147-----------------148Specify the extra build checks. The same value can be assigned by passing149W=... from the command line.150 151See `make help` for the list of the supported values.152 153Setting "W=..." takes precedence over KBUILD_EXTRA_WARN.154 155KBUILD_DEBARCH156--------------157For the deb-pkg target, allows overriding the normal heuristics deployed by158deb-pkg. Normally deb-pkg attempts to guess the right architecture based on159the UTS_MACHINE variable, and on some architectures also the kernel config.160The value of KBUILD_DEBARCH is assumed (not checked) to be a valid Debian161architecture.162 163KDOCFLAGS164---------165Specify extra (warning/error) flags for kernel-doc checks during the build,166see scripts/kernel-doc for which flags are supported. Note that this doesn't167(currently) apply to documentation builds.168 169ARCH170----171Set ARCH to the architecture to be built.172 173In most cases the name of the architecture is the same as the174directory name found in the arch/ directory.175 176But some architectures such as x86 and sparc have aliases.177 178- x86: i386 for 32 bit, x86_64 for 64 bit179- parisc: parisc64 for 64 bit180- sparc: sparc32 for 32 bit, sparc64 for 64 bit181 182CROSS_COMPILE183-------------184Specify an optional fixed part of the binutils filename.185CROSS_COMPILE can be a part of the filename or the full path.186 187CROSS_COMPILE is also used for ccache in some setups.188 189CF190--191Additional options for sparse.192 193CF is often used on the command-line like this::194 195 make CF=-Wbitwise C=2196 197INSTALL_PATH198------------199INSTALL_PATH specifies where to place the updated kernel and system map200images. Default is /boot, but you can set it to other values.201 202INSTALLKERNEL203-------------204Install script called when using "make install".205The default name is "installkernel".206 207The script will be called with the following arguments:208 209 - $1 - kernel version210 - $2 - kernel image file211 - $3 - kernel map file212 - $4 - default install path (use root directory if blank)213 214The implementation of "make install" is architecture specific215and it may differ from the above.216 217INSTALLKERNEL is provided to enable the possibility to218specify a custom installer when cross compiling a kernel.219 220MODLIB221------222Specify where to install modules.223The default value is::224 225 $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)226 227The value can be overridden in which case the default value is ignored.228 229INSTALL_MOD_PATH230----------------231INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory232relocations required by build roots. This is not defined in the233makefile but the argument can be passed to make if needed.234 235INSTALL_MOD_STRIP236-----------------237INSTALL_MOD_STRIP, if defined, will cause modules to be238stripped after they are installed. If INSTALL_MOD_STRIP is '1', then239the default option --strip-debug will be used. Otherwise,240INSTALL_MOD_STRIP value will be used as the options to the strip command.241 242INSTALL_HDR_PATH243----------------244INSTALL_HDR_PATH specifies where to install user space headers when245executing "make headers_*".246 247The default value is::248 249 $(objtree)/usr250 251$(objtree) is the directory where output files are saved.252The output directory is often set using "O=..." on the commandline.253 254The value can be overridden in which case the default value is ignored.255 256INSTALL_DTBS_PATH257-----------------258INSTALL_DTBS_PATH specifies where to install device tree blobs for259relocations required by build roots. This is not defined in the260makefile but the argument can be passed to make if needed.261 262KBUILD_ABS_SRCTREE263--------------------------------------------------264Kbuild uses a relative path to point to the tree when possible. For instance,265when building in the source tree, the source tree path is '.'266 267Setting this flag requests Kbuild to use absolute path to the source tree.268There are some useful cases to do so, like when generating tag files with269absolute path entries etc.270 271KBUILD_SIGN_PIN272---------------273This variable allows a passphrase or PIN to be passed to the sign-file274utility when signing kernel modules, if the private key requires such.275 276KBUILD_MODPOST_WARN277-------------------278KBUILD_MODPOST_WARN can be set to avoid errors in case of undefined279symbols in the final module linking stage. It changes such errors280into warnings.281 282KBUILD_MODPOST_NOFINAL283----------------------284KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.285This is solely useful to speed up test compiles.286 287KBUILD_EXTRA_SYMBOLS288--------------------289For modules that use symbols from other modules.290See more details in modules.rst.291 292ALLSOURCE_ARCHS293---------------294For tags/TAGS/cscope targets, you can specify more than one arch295to be included in the databases, separated by blank space. E.g.::296 297 $ make ALLSOURCE_ARCHS="x86 mips arm" tags298 299To get all available archs you can also specify all. E.g.::300 301 $ make ALLSOURCE_ARCHS=all tags302 303IGNORE_DIRS304-----------305For tags/TAGS/cscope targets, you can choose which directories won't306be included in the databases, separated by blank space. E.g.::307 308 $ make IGNORE_DIRS="drivers/gpu/drm/radeon tools" cscope309 310KBUILD_BUILD_TIMESTAMP311----------------------312Setting this to a date string overrides the timestamp used in the313UTS_VERSION definition (uname -v in the running kernel). The value has to314be a string that can be passed to date -d. The default value315is the output of the date command at one point during build.316 317KBUILD_BUILD_USER, KBUILD_BUILD_HOST318------------------------------------319These two variables allow to override the user@host string displayed during320boot and in /proc/version. The default value is the output of the commands321whoami and host, respectively.322 323LLVM324----325If this variable is set to 1, Kbuild will use Clang and LLVM utilities instead326of GCC and GNU binutils to build the kernel.327