~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/kbuild/kbuild.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/kbuild/kbuild.rst (Version linux-6.12-rc7) and /Documentation/kbuild/kbuild.rst (Version linux-6.1.116)


  1 ======                                              1 ======
  2 Kbuild                                              2 Kbuild
  3 ======                                              3 ======
  4                                                     4 
  5                                                     5 
  6 Output files                                        6 Output files
  7 ============                                        7 ============
  8                                                     8 
  9 modules.order                                       9 modules.order
 10 -------------                                      10 -------------
 11 This file records the order in which modules a     11 This file records the order in which modules appear in Makefiles. This
 12 is used by modprobe to deterministically resol     12 is used by modprobe to deterministically resolve aliases that match
 13 multiple modules.                                  13 multiple modules.
 14                                                    14 
 15 modules.builtin                                    15 modules.builtin
 16 ---------------                                    16 ---------------
 17 This file lists all modules that are built int     17 This file lists all modules that are built into the kernel. This is used
 18 by modprobe to not fail when trying to load so     18 by modprobe to not fail when trying to load something builtin.
 19                                                    19 
 20 modules.builtin.modinfo                            20 modules.builtin.modinfo
 21 -----------------------                            21 -----------------------
 22 This file contains modinfo from all modules th     22 This file contains modinfo from all modules that are built into the kernel.
 23 Unlike modinfo of a separate module, all field     23 Unlike modinfo of a separate module, all fields are prefixed with module name.
 24                                                    24 
 25 modules.builtin.ranges                         << 
 26 ----------------------                         << 
 27 This file contains address offset ranges (per  << 
 28 that are built into the kernel. Together with  << 
 29 to associate module names with symbols.        << 
 30                                                    25 
 31 Environment variables                              26 Environment variables
 32 =====================                              27 =====================
 33                                                    28 
 34 KCPPFLAGS                                          29 KCPPFLAGS
 35 ---------                                          30 ---------
 36 Additional options to pass when preprocessing.     31 Additional options to pass when preprocessing. The preprocessing options
 37 will be used in all cases where kbuild does pr     32 will be used in all cases where kbuild does preprocessing including
 38 building C files and assembler files.              33 building C files and assembler files.
 39                                                    34 
 40 KAFLAGS                                            35 KAFLAGS
 41 -------                                            36 -------
 42 Additional options to the assembler (for built     37 Additional options to the assembler (for built-in and modules).
 43                                                    38 
 44 AFLAGS_MODULE                                      39 AFLAGS_MODULE
 45 -------------                                      40 -------------
 46 Additional assembler options for modules.          41 Additional assembler options for modules.
 47                                                    42 
 48 AFLAGS_KERNEL                                      43 AFLAGS_KERNEL
 49 -------------                                      44 -------------
 50 Additional assembler options for built-in.         45 Additional assembler options for built-in.
 51                                                    46 
 52 KCFLAGS                                            47 KCFLAGS
 53 -------                                            48 -------
 54 Additional options to the C compiler (for buil     49 Additional options to the C compiler (for built-in and modules).
 55                                                    50 
 56 KRUSTFLAGS                                         51 KRUSTFLAGS
 57 ----------                                         52 ----------
 58 Additional options to the Rust compiler (for b     53 Additional options to the Rust compiler (for built-in and modules).
 59                                                    54 
 60 CFLAGS_KERNEL                                      55 CFLAGS_KERNEL
 61 -------------                                      56 -------------
 62 Additional options for $(CC) when used to comp     57 Additional options for $(CC) when used to compile
 63 code that is compiled as built-in.                 58 code that is compiled as built-in.
 64                                                    59 
 65 CFLAGS_MODULE                                      60 CFLAGS_MODULE
 66 -------------                                      61 -------------
 67 Additional module specific options to use for      62 Additional module specific options to use for $(CC).
 68                                                    63 
 69 RUSTFLAGS_KERNEL                                   64 RUSTFLAGS_KERNEL
 70 ----------------                                   65 ----------------
 71 Additional options for $(RUSTC) when used to c     66 Additional options for $(RUSTC) when used to compile
 72 code that is compiled as built-in.                 67 code that is compiled as built-in.
 73                                                    68 
 74 RUSTFLAGS_MODULE                                   69 RUSTFLAGS_MODULE
 75 ----------------                                   70 ----------------
 76 Additional module specific options to use for      71 Additional module specific options to use for $(RUSTC).
 77                                                    72 
 78 LDFLAGS_MODULE                                     73 LDFLAGS_MODULE
 79 --------------                                     74 --------------
 80 Additional options used for $(LD) when linking     75 Additional options used for $(LD) when linking modules.
 81                                                    76 
 82 HOSTCFLAGS                                         77 HOSTCFLAGS
 83 ----------                                         78 ----------
 84 Additional flags to be passed to $(HOSTCC) whe     79 Additional flags to be passed to $(HOSTCC) when building host programs.
 85                                                    80 
 86 HOSTCXXFLAGS                                       81 HOSTCXXFLAGS
 87 ------------                                       82 ------------
 88 Additional flags to be passed to $(HOSTCXX) wh     83 Additional flags to be passed to $(HOSTCXX) when building host programs.
 89                                                    84 
 90 HOSTRUSTFLAGS                                      85 HOSTRUSTFLAGS
 91 -------------                                      86 -------------
 92 Additional flags to be passed to $(HOSTRUSTC)      87 Additional flags to be passed to $(HOSTRUSTC) when building host programs.
 93                                                    88 
 94 HOSTLDFLAGS                                        89 HOSTLDFLAGS
 95 -----------                                        90 -----------
 96 Additional flags to be passed when linking hos     91 Additional flags to be passed when linking host programs.
 97                                                    92 
 98 HOSTLDLIBS                                         93 HOSTLDLIBS
 99 ----------                                         94 ----------
100 Additional libraries to link against when buil     95 Additional libraries to link against when building host programs.
101                                                    96 
102 .. _userkbuildflags:                               97 .. _userkbuildflags:
103                                                    98 
104 USERCFLAGS                                         99 USERCFLAGS
105 ----------                                        100 ----------
106 Additional options used for $(CC) when compili    101 Additional options used for $(CC) when compiling userprogs.
107                                                   102 
108 USERLDFLAGS                                       103 USERLDFLAGS
109 -----------                                       104 -----------
110 Additional options used for $(LD) when linking    105 Additional options used for $(LD) when linking userprogs. userprogs are linked
111 with CC, so $(USERLDFLAGS) should include "-Wl    106 with CC, so $(USERLDFLAGS) should include "-Wl," prefix as applicable.
112                                                   107 
113 KBUILD_KCONFIG                                    108 KBUILD_KCONFIG
114 --------------                                    109 --------------
115 Set the top-level Kconfig file to the value of    110 Set the top-level Kconfig file to the value of this environment
116 variable.  The default name is "Kconfig".         111 variable.  The default name is "Kconfig".
117                                                   112 
118 KBUILD_VERBOSE                                    113 KBUILD_VERBOSE
119 --------------                                    114 --------------
120 Set the kbuild verbosity. Can be assigned same    115 Set the kbuild verbosity. Can be assigned same values as "V=...".
121                                                   116 
122 See make help for the full list.                  117 See make help for the full list.
123                                                   118 
124 Setting "V=..." takes precedence over KBUILD_V    119 Setting "V=..." takes precedence over KBUILD_VERBOSE.
125                                                   120 
126 KBUILD_EXTMOD                                     121 KBUILD_EXTMOD
127 -------------                                     122 -------------
128 Set the directory to look for the kernel sourc    123 Set the directory to look for the kernel source when building external
129 modules.                                          124 modules.
130                                                   125 
131 Setting "M=..." takes precedence over KBUILD_E    126 Setting "M=..." takes precedence over KBUILD_EXTMOD.
132                                                   127 
133 KBUILD_OUTPUT                                     128 KBUILD_OUTPUT
134 -------------                                     129 -------------
135 Specify the output directory when building the    130 Specify the output directory when building the kernel.
136                                                   131 
137 This variable can also be used to point to the << 
138 building external modules against a pre-built  << 
139 directory. Please note that this does NOT spec << 
140 external modules themselves.                   << 
141                                                << 
142 The output directory can also be specified usi    132 The output directory can also be specified using "O=...".
143                                                   133 
144 Setting "O=..." takes precedence over KBUILD_O    134 Setting "O=..." takes precedence over KBUILD_OUTPUT.
145                                                   135 
146 KBUILD_EXTRA_WARN                                 136 KBUILD_EXTRA_WARN
147 -----------------                                 137 -----------------
148 Specify the extra build checks. The same value    138 Specify the extra build checks. The same value can be assigned by passing
149 W=... from the command line.                      139 W=... from the command line.
150                                                   140 
151 See `make help` for the list of the supported     141 See `make help` for the list of the supported values.
152                                                   142 
153 Setting "W=..." takes precedence over KBUILD_E    143 Setting "W=..." takes precedence over KBUILD_EXTRA_WARN.
154                                                   144 
155 KBUILD_DEBARCH                                    145 KBUILD_DEBARCH
156 --------------                                    146 --------------
157 For the deb-pkg target, allows overriding the     147 For the deb-pkg target, allows overriding the normal heuristics deployed by
158 deb-pkg. Normally deb-pkg attempts to guess th    148 deb-pkg. Normally deb-pkg attempts to guess the right architecture based on
159 the UTS_MACHINE variable, and on some architec    149 the UTS_MACHINE variable, and on some architectures also the kernel config.
160 The value of KBUILD_DEBARCH is assumed (not ch    150 The value of KBUILD_DEBARCH is assumed (not checked) to be a valid Debian
161 architecture.                                     151 architecture.
162                                                   152 
163 KDOCFLAGS                                      << 
164 ---------                                      << 
165 Specify extra (warning/error) flags for kernel << 
166 see scripts/kernel-doc for which flags are sup << 
167 (currently) apply to documentation builds.     << 
168                                                << 
169 ARCH                                              153 ARCH
170 ----                                              154 ----
171 Set ARCH to the architecture to be built.         155 Set ARCH to the architecture to be built.
172                                                   156 
173 In most cases the name of the architecture is     157 In most cases the name of the architecture is the same as the
174 directory name found in the arch/ directory.      158 directory name found in the arch/ directory.
175                                                   159 
176 But some architectures such as x86 and sparc h    160 But some architectures such as x86 and sparc have aliases.
177                                                   161 
178 - x86: i386 for 32 bit, x86_64 for 64 bit         162 - x86: i386 for 32 bit, x86_64 for 64 bit
179 - parisc: parisc64 for 64 bit                  !! 163 - sh: sh for 32 bit, sh64 for 64 bit
180 - sparc: sparc32 for 32 bit, sparc64 for 64 bi    164 - sparc: sparc32 for 32 bit, sparc64 for 64 bit
181                                                   165 
182 CROSS_COMPILE                                     166 CROSS_COMPILE
183 -------------                                     167 -------------
184 Specify an optional fixed part of the binutils    168 Specify an optional fixed part of the binutils filename.
185 CROSS_COMPILE can be a part of the filename or    169 CROSS_COMPILE can be a part of the filename or the full path.
186                                                   170 
187 CROSS_COMPILE is also used for ccache in some     171 CROSS_COMPILE is also used for ccache in some setups.
188                                                   172 
189 CF                                                173 CF
190 --                                                174 --
191 Additional options for sparse.                    175 Additional options for sparse.
192                                                   176 
193 CF is often used on the command-line like this    177 CF is often used on the command-line like this::
194                                                   178 
195     make CF=-Wbitwise C=2                         179     make CF=-Wbitwise C=2
196                                                   180 
197 INSTALL_PATH                                      181 INSTALL_PATH
198 ------------                                      182 ------------
199 INSTALL_PATH specifies where to place the upda    183 INSTALL_PATH specifies where to place the updated kernel and system map
200 images. Default is /boot, but you can set it t    184 images. Default is /boot, but you can set it to other values.
201                                                   185 
202 INSTALLKERNEL                                     186 INSTALLKERNEL
203 -------------                                     187 -------------
204 Install script called when using "make install    188 Install script called when using "make install".
205 The default name is "installkernel".              189 The default name is "installkernel".
206                                                   190 
207 The script will be called with the following a    191 The script will be called with the following arguments:
208                                                   192 
209    - $1 - kernel version                          193    - $1 - kernel version
210    - $2 - kernel image file                       194    - $2 - kernel image file
211    - $3 - kernel map file                         195    - $3 - kernel map file
212    - $4 - default install path (use root direc    196    - $4 - default install path (use root directory if blank)
213                                                   197 
214 The implementation of "make install" is archit    198 The implementation of "make install" is architecture specific
215 and it may differ from the above.                 199 and it may differ from the above.
216                                                   200 
217 INSTALLKERNEL is provided to enable the possib    201 INSTALLKERNEL is provided to enable the possibility to
218 specify a custom installer when cross compilin    202 specify a custom installer when cross compiling a kernel.
219                                                   203 
220 MODLIB                                            204 MODLIB
221 ------                                            205 ------
222 Specify where to install modules.                 206 Specify where to install modules.
223 The default value is::                            207 The default value is::
224                                                   208 
225      $(INSTALL_MOD_PATH)/lib/modules/$(KERNELR    209      $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
226                                                   210 
227 The value can be overridden in which case the     211 The value can be overridden in which case the default value is ignored.
228                                                   212 
229 INSTALL_MOD_PATH                                  213 INSTALL_MOD_PATH
230 ----------------                                  214 ----------------
231 INSTALL_MOD_PATH specifies a prefix to MODLIB     215 INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
232 relocations required by build roots.  This is     216 relocations required by build roots.  This is not defined in the
233 makefile but the argument can be passed to mak    217 makefile but the argument can be passed to make if needed.
234                                                   218 
235 INSTALL_MOD_STRIP                                 219 INSTALL_MOD_STRIP
236 -----------------                                 220 -----------------
237 INSTALL_MOD_STRIP, if defined, will cause modu    221 INSTALL_MOD_STRIP, if defined, will cause modules to be
238 stripped after they are installed.  If INSTALL    222 stripped after they are installed.  If INSTALL_MOD_STRIP is '1', then
239 the default option --strip-debug will be used.    223 the default option --strip-debug will be used.  Otherwise,
240 INSTALL_MOD_STRIP value will be used as the op    224 INSTALL_MOD_STRIP value will be used as the options to the strip command.
241                                                   225 
242 INSTALL_HDR_PATH                                  226 INSTALL_HDR_PATH
243 ----------------                                  227 ----------------
244 INSTALL_HDR_PATH specifies where to install us    228 INSTALL_HDR_PATH specifies where to install user space headers when
245 executing "make headers_*".                       229 executing "make headers_*".
246                                                   230 
247 The default value is::                            231 The default value is::
248                                                   232 
249     $(objtree)/usr                                233     $(objtree)/usr
250                                                   234 
251 $(objtree) is the directory where output files    235 $(objtree) is the directory where output files are saved.
252 The output directory is often set using "O=...    236 The output directory is often set using "O=..." on the commandline.
253                                                   237 
254 The value can be overridden in which case the     238 The value can be overridden in which case the default value is ignored.
255                                                   239 
256 INSTALL_DTBS_PATH                              << 
257 -----------------                              << 
258 INSTALL_DTBS_PATH specifies where to install d << 
259 relocations required by build roots.  This is  << 
260 makefile but the argument can be passed to mak << 
261                                                << 
262 KBUILD_ABS_SRCTREE                                240 KBUILD_ABS_SRCTREE
263 ----------------------------------------------    241 --------------------------------------------------
264 Kbuild uses a relative path to point to the tr    242 Kbuild uses a relative path to point to the tree when possible. For instance,
265 when building in the source tree, the source t    243 when building in the source tree, the source tree path is '.'
266                                                   244 
267 Setting this flag requests Kbuild to use absol    245 Setting this flag requests Kbuild to use absolute path to the source tree.
268 There are some useful cases to do so, like whe    246 There are some useful cases to do so, like when generating tag files with
269 absolute path entries etc.                        247 absolute path entries etc.
270                                                   248 
271 KBUILD_SIGN_PIN                                   249 KBUILD_SIGN_PIN
272 ---------------                                   250 ---------------
273 This variable allows a passphrase or PIN to be    251 This variable allows a passphrase or PIN to be passed to the sign-file
274 utility when signing kernel modules, if the pr    252 utility when signing kernel modules, if the private key requires such.
275                                                   253 
276 KBUILD_MODPOST_WARN                               254 KBUILD_MODPOST_WARN
277 -------------------                               255 -------------------
278 KBUILD_MODPOST_WARN can be set to avoid errors    256 KBUILD_MODPOST_WARN can be set to avoid errors in case of undefined
279 symbols in the final module linking stage. It     257 symbols in the final module linking stage. It changes such errors
280 into warnings.                                    258 into warnings.
281                                                   259 
282 KBUILD_MODPOST_NOFINAL                            260 KBUILD_MODPOST_NOFINAL
283 ----------------------                            261 ----------------------
284 KBUILD_MODPOST_NOFINAL can be set to skip the     262 KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
285 This is solely useful to speed up test compile    263 This is solely useful to speed up test compiles.
286                                                   264 
287 KBUILD_EXTRA_SYMBOLS                              265 KBUILD_EXTRA_SYMBOLS
288 --------------------                              266 --------------------
289 For modules that use symbols from other module    267 For modules that use symbols from other modules.
290 See more details in modules.rst.                  268 See more details in modules.rst.
291                                                   269 
292 ALLSOURCE_ARCHS                                   270 ALLSOURCE_ARCHS
293 ---------------                                   271 ---------------
294 For tags/TAGS/cscope targets, you can specify     272 For tags/TAGS/cscope targets, you can specify more than one arch
295 to be included in the databases, separated by     273 to be included in the databases, separated by blank space. E.g.::
296                                                   274 
297     $ make ALLSOURCE_ARCHS="x86 mips arm" tags    275     $ make ALLSOURCE_ARCHS="x86 mips arm" tags
298                                                   276 
299 To get all available archs you can also specif    277 To get all available archs you can also specify all. E.g.::
300                                                   278 
301     $ make ALLSOURCE_ARCHS=all tags               279     $ make ALLSOURCE_ARCHS=all tags
302                                                << 
303 IGNORE_DIRS                                    << 
304 -----------                                    << 
305 For tags/TAGS/cscope targets, you can choose w << 
306 be included in the databases, separated by bla << 
307                                                << 
308     $ make IGNORE_DIRS="drivers/gpu/drm/radeon << 
309                                                   280 
310 KBUILD_BUILD_TIMESTAMP                            281 KBUILD_BUILD_TIMESTAMP
311 ----------------------                            282 ----------------------
312 Setting this to a date string overrides the ti    283 Setting this to a date string overrides the timestamp used in the
313 UTS_VERSION definition (uname -v in the runnin    284 UTS_VERSION definition (uname -v in the running kernel). The value has to
314 be a string that can be passed to date -d. The    285 be a string that can be passed to date -d. The default value
315 is the output of the date command at one point    286 is the output of the date command at one point during build.
316                                                   287 
317 KBUILD_BUILD_USER, KBUILD_BUILD_HOST              288 KBUILD_BUILD_USER, KBUILD_BUILD_HOST
318 ------------------------------------              289 ------------------------------------
319 These two variables allow to override the user    290 These two variables allow to override the user@host string displayed during
320 boot and in /proc/version. The default value i    291 boot and in /proc/version. The default value is the output of the commands
321 whoami and host, respectively.                    292 whoami and host, respectively.
322                                                   293 
323 LLVM                                              294 LLVM
324 ----                                              295 ----
325 If this variable is set to 1, Kbuild will use     296 If this variable is set to 1, Kbuild will use Clang and LLVM utilities instead
326 of GCC and GNU binutils to build the kernel.      297 of GCC and GNU binutils to build the kernel.
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php