kbuild.txt 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. Environment variables
  2. KCPPFLAGS
  3. --------------------------------------------------
  4. Additional options to pass when preprocessing. The preprocessing options
  5. will be used in all cases where kbuild does preprocessing including
  6. building C files and assembler files.
  7. KAFLAGS
  8. --------------------------------------------------
  9. Additional options to the assembler.
  10. KCFLAGS
  11. --------------------------------------------------
  12. Additional options to the C compiler.
  13. KBUILD_VERBOSE
  14. --------------------------------------------------
  15. Set the kbuild verbosity. Can be assigned same values as "V=...".
  16. See make help for the full list.
  17. Setting "V=..." takes precedence over KBUILD_VERBOSE.
  18. KBUILD_EXTMOD
  19. --------------------------------------------------
  20. Set the directory to look for the kernel source when building external
  21. modules.
  22. The directory can be specified in several ways:
  23. 1) Use "M=..." on the command line
  24. 2) Environmnet variable KBUILD_EXTMOD
  25. 3) Environmnet variable SUBDIRS
  26. The possibilities are listed in the order they take precedence.
  27. Using "M=..." will always override the others.
  28. KBUILD_OUTPUT
  29. --------------------------------------------------
  30. Specify the output directory when building the kernel.
  31. The output directory can also be specificed using "O=...".
  32. Setting "O=..." takes precedence over KBUILD_OUTPUT.
  33. ARCH
  34. --------------------------------------------------
  35. Set ARCH to the architecture to be built.
  36. In most cases the name of the architecture is the same as the
  37. directory name found in the arch/ directory.
  38. But some architectures such as x86 and sparc have aliases.
  39. x86: i386 for 32 bit, x86_64 for 64 bit
  40. sparc: sparc for 32 bit, sparc64 for 64 bit
  41. CROSS_COMPILE
  42. --------------------------------------------------
  43. Specify an optional fixed part of the binutils filename.
  44. CROSS_COMPILE can be a part of the filename or the full path.
  45. CROSS_COMPILE is also used for ccache is some setups.
  46. CF
  47. --------------------------------------------------
  48. Additional options for sparse.
  49. CF is often used on the command-line like this:
  50. make CF=-Wbitwise C=2
  51. INSTALL_PATH
  52. --------------------------------------------------
  53. INSTALL_PATH specifies where to place the updated kernel and system map
  54. images. Default is /boot, but you can set it to other values.
  55. INSTALLKERNEL
  56. --------------------------------------------------
  57. Install script called when using "make install".
  58. The default name is "installkernel".
  59. The script will be called with the following arguments:
  60. $1 - kernel version
  61. $2 - kernel image file
  62. $3 - kernel map file
  63. $4 - default install path (use root directory if blank)
  64. The implmentation of "make install" is architecture specific
  65. and it may differ from the above.
  66. INSTALLKERNEL is provided to enable the possibility to
  67. specify a custom installer when cross compiling a kernel.
  68. MODLIB
  69. --------------------------------------------------
  70. Specify where to install modules.
  71. The default value is:
  72. $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
  73. The value can be overridden in which case the default value is ignored.
  74. INSTALL_MOD_PATH
  75. --------------------------------------------------
  76. INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
  77. relocations required by build roots. This is not defined in the
  78. makefile but the argument can be passed to make if needed.
  79. INSTALL_MOD_STRIP
  80. --------------------------------------------------
  81. INSTALL_MOD_STRIP, if defined, will cause modules to be
  82. stripped after they are installed. If INSTALL_MOD_STRIP is '1', then
  83. the default option --strip-debug will be used. Otherwise,
  84. INSTALL_MOD_STRIP will used as the options to the strip command.
  85. INSTALL_FW_PATH
  86. --------------------------------------------------
  87. INSTALL_FW_PATH specifies where to install the firmware blobs.
  88. The default value is:
  89. $(INSTALL_MOD_PATH)/lib/firmware
  90. The value can be overridden in which case the default value is ignored.
  91. INSTALL_HDR_PATH
  92. --------------------------------------------------
  93. INSTALL_HDR_PATH specifies where to install user space headers when
  94. executing "make headers_*".
  95. The default value is:
  96. $(objtree)/usr
  97. $(objtree) is the directory where output files are saved.
  98. The output directory is often set using "O=..." on the commandline.
  99. The value can be overridden in which case the default value is ignored.
  100. KBUILD_MODPOST_WARN
  101. --------------------------------------------------
  102. KBUILD_MODPOST_WARN can be set to avoid errors in case of undefined
  103. symbols in the final module linking stage. It changes such errors
  104. into warnings.
  105. KBUILD_MODPOST_NOFINAL
  106. --------------------------------------------------
  107. KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
  108. This is solely useful to speed up test compiles.
  109. KBUILD_EXTRA_SYMBOLS
  110. --------------------------------------------------
  111. For modules that use symbols from other modules.
  112. See more details in modules.txt.
  113. ALLSOURCE_ARCHS
  114. --------------------------------------------------
  115. For tags/TAGS/cscope targets, you can specify more than one arch
  116. to be included in the databases, separated by blank space. E.g.:
  117. $ make ALLSOURCE_ARCHS="x86 mips arm" tags