~ [ 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.8.12)


  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                                                << 
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                                                   131 
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                                         153 KDOCFLAGS
164 ---------                                         154 ---------
165 Specify extra (warning/error) flags for kernel    155 Specify extra (warning/error) flags for kernel-doc checks during the build,
166 see scripts/kernel-doc for which flags are sup    156 see scripts/kernel-doc for which flags are supported. Note that this doesn't
167 (currently) apply to documentation builds.        157 (currently) apply to documentation builds.
168                                                   158 
169 ARCH                                              159 ARCH
170 ----                                              160 ----
171 Set ARCH to the architecture to be built.         161 Set ARCH to the architecture to be built.
172                                                   162 
173 In most cases the name of the architecture is     163 In most cases the name of the architecture is the same as the
174 directory name found in the arch/ directory.      164 directory name found in the arch/ directory.
175                                                   165 
176 But some architectures such as x86 and sparc h    166 But some architectures such as x86 and sparc have aliases.
177                                                   167 
178 - x86: i386 for 32 bit, x86_64 for 64 bit         168 - x86: i386 for 32 bit, x86_64 for 64 bit
179 - parisc: parisc64 for 64 bit                     169 - parisc: parisc64 for 64 bit
180 - sparc: sparc32 for 32 bit, sparc64 for 64 bi    170 - sparc: sparc32 for 32 bit, sparc64 for 64 bit
181                                                   171 
182 CROSS_COMPILE                                     172 CROSS_COMPILE
183 -------------                                     173 -------------
184 Specify an optional fixed part of the binutils    174 Specify an optional fixed part of the binutils filename.
185 CROSS_COMPILE can be a part of the filename or    175 CROSS_COMPILE can be a part of the filename or the full path.
186                                                   176 
187 CROSS_COMPILE is also used for ccache in some     177 CROSS_COMPILE is also used for ccache in some setups.
188                                                   178 
189 CF                                                179 CF
190 --                                                180 --
191 Additional options for sparse.                    181 Additional options for sparse.
192                                                   182 
193 CF is often used on the command-line like this    183 CF is often used on the command-line like this::
194                                                   184 
195     make CF=-Wbitwise C=2                         185     make CF=-Wbitwise C=2
196                                                   186 
197 INSTALL_PATH                                      187 INSTALL_PATH
198 ------------                                      188 ------------
199 INSTALL_PATH specifies where to place the upda    189 INSTALL_PATH specifies where to place the updated kernel and system map
200 images. Default is /boot, but you can set it t    190 images. Default is /boot, but you can set it to other values.
201                                                   191 
202 INSTALLKERNEL                                     192 INSTALLKERNEL
203 -------------                                     193 -------------
204 Install script called when using "make install    194 Install script called when using "make install".
205 The default name is "installkernel".              195 The default name is "installkernel".
206                                                   196 
207 The script will be called with the following a    197 The script will be called with the following arguments:
208                                                   198 
209    - $1 - kernel version                          199    - $1 - kernel version
210    - $2 - kernel image file                       200    - $2 - kernel image file
211    - $3 - kernel map file                         201    - $3 - kernel map file
212    - $4 - default install path (use root direc    202    - $4 - default install path (use root directory if blank)
213                                                   203 
214 The implementation of "make install" is archit    204 The implementation of "make install" is architecture specific
215 and it may differ from the above.                 205 and it may differ from the above.
216                                                   206 
217 INSTALLKERNEL is provided to enable the possib    207 INSTALLKERNEL is provided to enable the possibility to
218 specify a custom installer when cross compilin    208 specify a custom installer when cross compiling a kernel.
219                                                   209 
220 MODLIB                                            210 MODLIB
221 ------                                            211 ------
222 Specify where to install modules.                 212 Specify where to install modules.
223 The default value is::                            213 The default value is::
224                                                   214 
225      $(INSTALL_MOD_PATH)/lib/modules/$(KERNELR    215      $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
226                                                   216 
227 The value can be overridden in which case the     217 The value can be overridden in which case the default value is ignored.
228                                                   218 
229 INSTALL_MOD_PATH                                  219 INSTALL_MOD_PATH
230 ----------------                                  220 ----------------
231 INSTALL_MOD_PATH specifies a prefix to MODLIB     221 INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
232 relocations required by build roots.  This is     222 relocations required by build roots.  This is not defined in the
233 makefile but the argument can be passed to mak    223 makefile but the argument can be passed to make if needed.
234                                                   224 
235 INSTALL_MOD_STRIP                                 225 INSTALL_MOD_STRIP
236 -----------------                                 226 -----------------
237 INSTALL_MOD_STRIP, if defined, will cause modu    227 INSTALL_MOD_STRIP, if defined, will cause modules to be
238 stripped after they are installed.  If INSTALL    228 stripped after they are installed.  If INSTALL_MOD_STRIP is '1', then
239 the default option --strip-debug will be used.    229 the default option --strip-debug will be used.  Otherwise,
240 INSTALL_MOD_STRIP value will be used as the op    230 INSTALL_MOD_STRIP value will be used as the options to the strip command.
241                                                   231 
242 INSTALL_HDR_PATH                                  232 INSTALL_HDR_PATH
243 ----------------                                  233 ----------------
244 INSTALL_HDR_PATH specifies where to install us    234 INSTALL_HDR_PATH specifies where to install user space headers when
245 executing "make headers_*".                       235 executing "make headers_*".
246                                                   236 
247 The default value is::                            237 The default value is::
248                                                   238 
249     $(objtree)/usr                                239     $(objtree)/usr
250                                                   240 
251 $(objtree) is the directory where output files    241 $(objtree) is the directory where output files are saved.
252 The output directory is often set using "O=...    242 The output directory is often set using "O=..." on the commandline.
253                                                   243 
254 The value can be overridden in which case the     244 The value can be overridden in which case the default value is ignored.
255                                                   245 
256 INSTALL_DTBS_PATH                                 246 INSTALL_DTBS_PATH
257 -----------------                                 247 -----------------
258 INSTALL_DTBS_PATH specifies where to install d    248 INSTALL_DTBS_PATH specifies where to install device tree blobs for
259 relocations required by build roots.  This is     249 relocations required by build roots.  This is not defined in the
260 makefile but the argument can be passed to mak    250 makefile but the argument can be passed to make if needed.
261                                                   251 
262 KBUILD_ABS_SRCTREE                                252 KBUILD_ABS_SRCTREE
263 ----------------------------------------------    253 --------------------------------------------------
264 Kbuild uses a relative path to point to the tr    254 Kbuild uses a relative path to point to the tree when possible. For instance,
265 when building in the source tree, the source t    255 when building in the source tree, the source tree path is '.'
266                                                   256 
267 Setting this flag requests Kbuild to use absol    257 Setting this flag requests Kbuild to use absolute path to the source tree.
268 There are some useful cases to do so, like whe    258 There are some useful cases to do so, like when generating tag files with
269 absolute path entries etc.                        259 absolute path entries etc.
270                                                   260 
271 KBUILD_SIGN_PIN                                   261 KBUILD_SIGN_PIN
272 ---------------                                   262 ---------------
273 This variable allows a passphrase or PIN to be    263 This variable allows a passphrase or PIN to be passed to the sign-file
274 utility when signing kernel modules, if the pr    264 utility when signing kernel modules, if the private key requires such.
275                                                   265 
276 KBUILD_MODPOST_WARN                               266 KBUILD_MODPOST_WARN
277 -------------------                               267 -------------------
278 KBUILD_MODPOST_WARN can be set to avoid errors    268 KBUILD_MODPOST_WARN can be set to avoid errors in case of undefined
279 symbols in the final module linking stage. It     269 symbols in the final module linking stage. It changes such errors
280 into warnings.                                    270 into warnings.
281                                                   271 
282 KBUILD_MODPOST_NOFINAL                            272 KBUILD_MODPOST_NOFINAL
283 ----------------------                            273 ----------------------
284 KBUILD_MODPOST_NOFINAL can be set to skip the     274 KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
285 This is solely useful to speed up test compile    275 This is solely useful to speed up test compiles.
286                                                   276 
287 KBUILD_EXTRA_SYMBOLS                              277 KBUILD_EXTRA_SYMBOLS
288 --------------------                              278 --------------------
289 For modules that use symbols from other module    279 For modules that use symbols from other modules.
290 See more details in modules.rst.                  280 See more details in modules.rst.
291                                                   281 
292 ALLSOURCE_ARCHS                                   282 ALLSOURCE_ARCHS
293 ---------------                                   283 ---------------
294 For tags/TAGS/cscope targets, you can specify     284 For tags/TAGS/cscope targets, you can specify more than one arch
295 to be included in the databases, separated by     285 to be included in the databases, separated by blank space. E.g.::
296                                                   286 
297     $ make ALLSOURCE_ARCHS="x86 mips arm" tags    287     $ make ALLSOURCE_ARCHS="x86 mips arm" tags
298                                                   288 
299 To get all available archs you can also specif    289 To get all available archs you can also specify all. E.g.::
300                                                   290 
301     $ make ALLSOURCE_ARCHS=all tags               291     $ make ALLSOURCE_ARCHS=all tags
302                                                   292 
303 IGNORE_DIRS                                       293 IGNORE_DIRS
304 -----------                                       294 -----------
305 For tags/TAGS/cscope targets, you can choose w    295 For tags/TAGS/cscope targets, you can choose which directories won't
306 be included in the databases, separated by bla    296 be included in the databases, separated by blank space. E.g.::
307                                                   297 
308     $ make IGNORE_DIRS="drivers/gpu/drm/radeon    298     $ make IGNORE_DIRS="drivers/gpu/drm/radeon tools" cscope
309                                                   299 
310 KBUILD_BUILD_TIMESTAMP                            300 KBUILD_BUILD_TIMESTAMP
311 ----------------------                            301 ----------------------
312 Setting this to a date string overrides the ti    302 Setting this to a date string overrides the timestamp used in the
313 UTS_VERSION definition (uname -v in the runnin    303 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    304 be a string that can be passed to date -d. The default value
315 is the output of the date command at one point    305 is the output of the date command at one point during build.
316                                                   306 
317 KBUILD_BUILD_USER, KBUILD_BUILD_HOST              307 KBUILD_BUILD_USER, KBUILD_BUILD_HOST
318 ------------------------------------              308 ------------------------------------
319 These two variables allow to override the user    309 These two variables allow to override the user@host string displayed during
320 boot and in /proc/version. The default value i    310 boot and in /proc/version. The default value is the output of the commands
321 whoami and host, respectively.                    311 whoami and host, respectively.
322                                                   312 
323 LLVM                                              313 LLVM
324 ----                                              314 ----
325 If this variable is set to 1, Kbuild will use     315 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.      316 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