kbuild.txt 8.3 KB

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