kbuild.txt 7.4 KB

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