kbuild.txt 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. Output files
  2. modules.order
  3. --------------------------------------------------
  4. This file records the order in which modules appear in Makefiles. This
  5. is used by modprobe to deterministically resolve aliases that match
  6. multiple modules.
  7. modules.builtin
  8. --------------------------------------------------
  9. This file lists all modules that are built into the kernel. This is used
  10. by modprobe to not fail when trying to load something builtin.
  11. Environment variables
  12. KCPPFLAGS
  13. --------------------------------------------------
  14. Additional options to pass when preprocessing. The preprocessing options
  15. will be used in all cases where kbuild does preprocessing including
  16. building C files and assembler files.
  17. KAFLAGS
  18. --------------------------------------------------
  19. Additional options to the assembler (for built-in and modules).
  20. AFLAGS_MODULE
  21. --------------------------------------------------
  22. Additional module specific options to use for $(AS).
  23. AFLAGS_KERNEL
  24. --------------------------------------------------
  25. Additional options for $(AS) when used for assembler
  26. code for code that is compiled as built-in.
  27. KCFLAGS
  28. --------------------------------------------------
  29. Additional options to the C compiler (for built-in and modules).
  30. CFLAGS_KERNEL
  31. --------------------------------------------------
  32. Additional options for $(CC) when used to compile
  33. code that is compiled as built-in.
  34. CFLAGS_MODULE
  35. --------------------------------------------------
  36. Additional module specific options to use for $(CC).
  37. LDFLAGS_MODULE
  38. --------------------------------------------------
  39. Additional options used for $(LD) when linking modules.
  40. HOSTCFLAGS
  41. --------------------------------------------------
  42. Additional flags to be passed to $(HOSTCC) when building host programs.
  43. HOSTCXXFLAGS
  44. --------------------------------------------------
  45. Additional flags to be passed to $(HOSTCXX) when building host programs.
  46. HOSTLDFLAGS
  47. --------------------------------------------------
  48. Additional flags to be passed when linking host programs.
  49. HOSTLDLIBS
  50. --------------------------------------------------
  51. Additional libraries to link against when building host programs.
  52. KBUILD_KCONFIG
  53. --------------------------------------------------
  54. Set the top-level Kconfig file to the value of this environment
  55. variable. The default name is "Kconfig".
  56. KBUILD_VERBOSE
  57. --------------------------------------------------
  58. Set the kbuild verbosity. Can be assigned same values as "V=...".
  59. See make help for the full list.
  60. Setting "V=..." takes precedence over KBUILD_VERBOSE.
  61. KBUILD_EXTMOD
  62. --------------------------------------------------
  63. Set the directory to look for the kernel source when building external
  64. modules.
  65. The directory can be specified in several ways:
  66. 1) Use "M=..." on the command line
  67. 2) Environment variable KBUILD_EXTMOD
  68. 3) Environment variable SUBDIRS
  69. The possibilities are listed in the order they take precedence.
  70. Using "M=..." will always override the others.
  71. KBUILD_OUTPUT
  72. --------------------------------------------------
  73. Specify the output directory when building the kernel.
  74. The output directory can also be specified using "O=...".
  75. Setting "O=..." takes precedence over KBUILD_OUTPUT.
  76. KBUILD_DEBARCH
  77. --------------------------------------------------
  78. For the deb-pkg target, allows overriding the normal heuristics deployed by
  79. deb-pkg. Normally deb-pkg attempts to guess the right architecture based on
  80. the UTS_MACHINE variable, and on some architectures also the kernel config.
  81. The value of KBUILD_DEBARCH is assumed (not checked) to be a valid Debian
  82. architecture.
  83. ARCH
  84. --------------------------------------------------
  85. Set ARCH to the architecture to be built.
  86. In most cases the name of the architecture is the same as the
  87. directory name found in the arch/ directory.
  88. But some architectures such as x86 and sparc have aliases.
  89. x86: i386 for 32 bit, x86_64 for 64 bit
  90. sh: sh for 32 bit, sh64 for 64 bit
  91. sparc: sparc32 for 32 bit, sparc64 for 64 bit
  92. CROSS_COMPILE
  93. --------------------------------------------------
  94. Specify an optional fixed part of the binutils filename.
  95. CROSS_COMPILE can be a part of the filename or the full path.
  96. CROSS_COMPILE is also used for ccache in some setups.
  97. CF
  98. --------------------------------------------------
  99. Additional options for sparse.
  100. CF is often used on the command-line like this:
  101. make CF=-Wbitwise C=2
  102. INSTALL_PATH
  103. --------------------------------------------------
  104. INSTALL_PATH specifies where to place the updated kernel and system map
  105. images. Default is /boot, but you can set it to other values.
  106. INSTALLKERNEL
  107. --------------------------------------------------
  108. Install script called when using "make install".
  109. The default name is "installkernel".
  110. The script will be called with the following arguments:
  111. $1 - kernel version
  112. $2 - kernel image file
  113. $3 - kernel map file
  114. $4 - default install path (use root directory if blank)
  115. The implementation of "make install" is architecture specific
  116. and it may differ from the above.
  117. INSTALLKERNEL is provided to enable the possibility to
  118. specify a custom installer when cross compiling a kernel.
  119. MODLIB
  120. --------------------------------------------------
  121. Specify where to install modules.
  122. The default value is:
  123. $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
  124. The value can be overridden in which case the default value is ignored.
  125. INSTALL_MOD_PATH
  126. --------------------------------------------------
  127. INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
  128. relocations required by build roots. This is not defined in the
  129. makefile but the argument can be passed to make if needed.
  130. INSTALL_MOD_STRIP
  131. --------------------------------------------------
  132. INSTALL_MOD_STRIP, if defined, will cause modules to be
  133. stripped after they are installed. If INSTALL_MOD_STRIP is '1', then
  134. the default option --strip-debug will be used. Otherwise,
  135. INSTALL_MOD_STRIP value will be used as the options to the strip command.
  136. INSTALL_HDR_PATH
  137. --------------------------------------------------
  138. INSTALL_HDR_PATH specifies where to install user space headers when
  139. executing "make headers_*".
  140. The default value is:
  141. $(objtree)/usr
  142. $(objtree) is the directory where output files are saved.
  143. The output directory is often set using "O=..." on the commandline.
  144. The value can be overridden in which case the default value is ignored.
  145. KBUILD_SIGN_PIN
  146. --------------------------------------------------
  147. This variable allows a passphrase or PIN to be passed to the sign-file
  148. utility when signing kernel modules, if the private key requires such.
  149. KBUILD_MODPOST_WARN
  150. --------------------------------------------------
  151. KBUILD_MODPOST_WARN can be set to avoid errors in case of undefined
  152. symbols in the final module linking stage. It changes such errors
  153. into warnings.
  154. KBUILD_MODPOST_NOFINAL
  155. --------------------------------------------------
  156. KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
  157. This is solely useful to speed up test compiles.
  158. KBUILD_EXTRA_SYMBOLS
  159. --------------------------------------------------
  160. For modules that use symbols from other modules.
  161. See more details in modules.txt.
  162. ALLSOURCE_ARCHS
  163. --------------------------------------------------
  164. For tags/TAGS/cscope targets, you can specify more than one arch
  165. to be included in the databases, separated by blank space. E.g.:
  166. $ make ALLSOURCE_ARCHS="x86 mips arm" tags
  167. To get all available archs you can also specify all. E.g.:
  168. $ make ALLSOURCE_ARCHS=all tags
  169. KBUILD_ENABLE_EXTRA_GCC_CHECKS
  170. --------------------------------------------------
  171. If enabled over the make command line with "W=1", it turns on additional
  172. gcc -W... options for more extensive build-time checking.
  173. KBUILD_BUILD_TIMESTAMP
  174. --------------------------------------------------
  175. Setting this to a date string overrides the timestamp used in the
  176. UTS_VERSION definition (uname -v in the running kernel). The value has to
  177. be a string that can be passed to date -d. The default value
  178. is the output of the date command at one point during build.
  179. KBUILD_BUILD_USER, KBUILD_BUILD_HOST
  180. --------------------------------------------------
  181. These two variables allow to override the user@host string displayed during
  182. boot and in /proc/version. The default value is the output of the commands
  183. whoami and host, respectively.
  184. KBUILD_LDS
  185. --------------------------------------------------
  186. The linker script with full path. Assigned by the top-level Makefile.
  187. KBUILD_VMLINUX_INIT
  188. --------------------------------------------------
  189. All object files for the init (first) part of vmlinux.
  190. Files specified with KBUILD_VMLINUX_INIT are linked first.
  191. KBUILD_VMLINUX_MAIN
  192. --------------------------------------------------
  193. All object files for the main part of vmlinux.
  194. KBUILD_VMLINUX_LIBS
  195. --------------------------------------------------
  196. All .a "lib" files for vmlinux.
  197. KBUILD_VMLINUX_INIT, KBUILD_VMLINUX_MAIN, and KBUILD_VMLINUX_LIBS together
  198. specify all the object files used to link vmlinux.