Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

docs: kbuild: convert docs to ReST and rename to *.rst

The kbuild documentation clearly shows that the documents
there are written at different times: some use markdown,
some use their own peculiar logic to split sections.

Convert everything to ReST without affecting too much
the author's style and avoiding adding uneeded markups.

The conversion is actually:
- add blank lines and identation in order to identify paragraphs;
- fix tables markups;
- add some lists markups;
- mark literal blocks;
- adjust title markups.

At its new index.rst, let's add a :orphan: while this is not linked to
the main index.rst file, in order to avoid build warnings.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>

authored by

Mauro Carvalho Chehab and committed by
Jonathan Corbet
cd238eff d7b461c5

+840 -561
+1 -1
Documentation/admin-guide/README.rst
··· 227 227 "make tinyconfig" Configure the tiniest possible kernel. 228 228 229 229 You can find more information on using the Linux kernel config tools 230 - in Documentation/kbuild/kconfig.txt. 230 + in Documentation/kbuild/kconfig.rst. 231 231 232 232 - NOTES on ``make config``: 233 233
+3 -2
Documentation/kbuild/headers_install.txt Documentation/kbuild/headers_install.rst
··· 1 + ============================================= 1 2 Exporting kernel headers for use by userspace 2 3 ============================================= 3 4 ··· 23 22 24 23 The "make headers_install" command can be run in the top level directory of the 25 24 kernel source code (or using a standard out-of-tree build). It takes two 26 - optional arguments: 25 + optional arguments:: 27 26 28 27 make headers_install ARCH=i386 INSTALL_HDR_PATH=/usr 29 28 30 29 ARCH indicates which architecture to produce headers for, and defaults to the 31 30 current architecture. The linux/asm directory of the exported kernel headers 32 31 is platform-specific, to see a complete list of supported architectures use 33 - the command: 32 + the command:: 34 33 35 34 ls -d include/asm-* | sed 's/.*-//' 36 35
+27
Documentation/kbuild/index.rst
··· 1 + :orphan: 2 + 3 + =================== 4 + Kernel Build System 5 + =================== 6 + 7 + .. toctree:: 8 + :maxdepth: 1 9 + 10 + kconfig-language 11 + kconfig-macro-language 12 + 13 + kbuild 14 + kconfig 15 + makefiles 16 + modules 17 + 18 + headers_install 19 + 20 + issues 21 + 22 + .. only:: subproject and html 23 + 24 + Indices 25 + ======= 26 + 27 + * :ref:`genindex`
+11
Documentation/kbuild/issues.rst
··· 1 + Recursion issue #1 2 + ------------------ 3 + 4 + .. include:: Kconfig.recursion-issue-01 5 + :literal: 6 + 7 + Recursion issue #2 8 + ------------------ 9 + 10 + .. include:: Kconfig.recursion-issue-02 11 + :literal:
+68 -51
Documentation/kbuild/kbuild.txt Documentation/kbuild/kbuild.rst
··· 1 + ====== 2 + Kbuild 3 + ====== 4 + 5 + 1 6 Output files 7 + ============ 2 8 3 9 modules.order 4 - -------------------------------------------------- 10 + ------------- 5 11 This file records the order in which modules appear in Makefiles. This 6 12 is used by modprobe to deterministically resolve aliases that match 7 13 multiple modules. 8 14 9 15 modules.builtin 10 - -------------------------------------------------- 16 + --------------- 11 17 This file lists all modules that are built into the kernel. This is used 12 18 by modprobe to not fail when trying to load something builtin. 13 19 ··· 24 18 25 19 26 20 Environment variables 21 + ===================== 27 22 28 23 KCPPFLAGS 29 - -------------------------------------------------- 24 + --------- 30 25 Additional options to pass when preprocessing. The preprocessing options 31 26 will be used in all cases where kbuild does preprocessing including 32 27 building C files and assembler files. 33 28 34 29 KAFLAGS 35 - -------------------------------------------------- 30 + ------- 36 31 Additional options to the assembler (for built-in and modules). 37 32 38 33 AFLAGS_MODULE 39 - -------------------------------------------------- 34 + ------------- 40 35 Additional module specific options to use for $(AS). 41 36 42 37 AFLAGS_KERNEL 43 - -------------------------------------------------- 38 + ------------- 44 39 Additional options for $(AS) when used for assembler 45 40 code for code that is compiled as built-in. 46 41 47 42 KCFLAGS 48 - -------------------------------------------------- 43 + ------- 49 44 Additional options to the C compiler (for built-in and modules). 50 45 51 46 CFLAGS_KERNEL 52 - -------------------------------------------------- 47 + ------------- 53 48 Additional options for $(CC) when used to compile 54 49 code that is compiled as built-in. 55 50 56 51 CFLAGS_MODULE 57 - -------------------------------------------------- 52 + ------------- 58 53 Additional module specific options to use for $(CC). 59 54 60 55 LDFLAGS_MODULE 61 - -------------------------------------------------- 56 + -------------- 62 57 Additional options used for $(LD) when linking modules. 63 58 64 59 HOSTCFLAGS 65 - -------------------------------------------------- 60 + ---------- 66 61 Additional flags to be passed to $(HOSTCC) when building host programs. 67 62 68 63 HOSTCXXFLAGS 69 - -------------------------------------------------- 64 + ------------ 70 65 Additional flags to be passed to $(HOSTCXX) when building host programs. 71 66 72 67 HOSTLDFLAGS 73 - -------------------------------------------------- 68 + ----------- 74 69 Additional flags to be passed when linking host programs. 75 70 76 71 HOSTLDLIBS 77 - -------------------------------------------------- 72 + ---------- 78 73 Additional libraries to link against when building host programs. 79 74 80 75 KBUILD_KCONFIG 81 - -------------------------------------------------- 76 + -------------- 82 77 Set the top-level Kconfig file to the value of this environment 83 78 variable. The default name is "Kconfig". 84 79 85 80 KBUILD_VERBOSE 86 - -------------------------------------------------- 81 + -------------- 87 82 Set the kbuild verbosity. Can be assigned same values as "V=...". 83 + 88 84 See make help for the full list. 85 + 89 86 Setting "V=..." takes precedence over KBUILD_VERBOSE. 90 87 91 88 KBUILD_EXTMOD 92 - -------------------------------------------------- 89 + ------------- 93 90 Set the directory to look for the kernel source when building external 94 91 modules. 92 + 95 93 Setting "M=..." takes precedence over KBUILD_EXTMOD. 96 94 97 95 KBUILD_OUTPUT 98 - -------------------------------------------------- 96 + ------------- 99 97 Specify the output directory when building the kernel. 98 + 100 99 The output directory can also be specified using "O=...". 100 + 101 101 Setting "O=..." takes precedence over KBUILD_OUTPUT. 102 102 103 103 KBUILD_DEBARCH 104 - -------------------------------------------------- 104 + -------------- 105 105 For the deb-pkg target, allows overriding the normal heuristics deployed by 106 106 deb-pkg. Normally deb-pkg attempts to guess the right architecture based on 107 107 the UTS_MACHINE variable, and on some architectures also the kernel config. ··· 115 103 architecture. 116 104 117 105 ARCH 118 - -------------------------------------------------- 106 + ---- 119 107 Set ARCH to the architecture to be built. 108 + 120 109 In most cases the name of the architecture is the same as the 121 110 directory name found in the arch/ directory. 111 + 122 112 But some architectures such as x86 and sparc have aliases. 123 - x86: i386 for 32 bit, x86_64 for 64 bit 124 - sh: sh for 32 bit, sh64 for 64 bit 125 - sparc: sparc32 for 32 bit, sparc64 for 64 bit 113 + 114 + - x86: i386 for 32 bit, x86_64 for 64 bit 115 + - sh: sh for 32 bit, sh64 for 64 bit 116 + - sparc: sparc32 for 32 bit, sparc64 for 64 bit 126 117 127 118 CROSS_COMPILE 128 - -------------------------------------------------- 119 + ------------- 129 120 Specify an optional fixed part of the binutils filename. 130 121 CROSS_COMPILE can be a part of the filename or the full path. 131 122 132 123 CROSS_COMPILE is also used for ccache in some setups. 133 124 134 125 CF 135 - -------------------------------------------------- 126 + -- 136 127 Additional options for sparse. 137 - CF is often used on the command-line like this: 128 + 129 + CF is often used on the command-line like this:: 138 130 139 131 make CF=-Wbitwise C=2 140 132 141 133 INSTALL_PATH 142 - -------------------------------------------------- 134 + ------------ 143 135 INSTALL_PATH specifies where to place the updated kernel and system map 144 136 images. Default is /boot, but you can set it to other values. 145 137 146 138 INSTALLKERNEL 147 - -------------------------------------------------- 139 + ------------- 148 140 Install script called when using "make install". 149 141 The default name is "installkernel". 150 142 151 143 The script will be called with the following arguments: 152 - $1 - kernel version 153 - $2 - kernel image file 154 - $3 - kernel map file 155 - $4 - default install path (use root directory if blank) 144 + - $1 - kernel version 145 + - $2 - kernel image file 146 + - $3 - kernel map file 147 + - $4 - default install path (use root directory if blank) 156 148 157 149 The implementation of "make install" is architecture specific 158 150 and it may differ from the above. ··· 165 149 specify a custom installer when cross compiling a kernel. 166 150 167 151 MODLIB 168 - -------------------------------------------------- 152 + ------ 169 153 Specify where to install modules. 170 - The default value is: 154 + The default value is:: 171 155 172 156 $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) 173 157 174 158 The value can be overridden in which case the default value is ignored. 175 159 176 160 INSTALL_MOD_PATH 177 - -------------------------------------------------- 161 + ---------------- 178 162 INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory 179 163 relocations required by build roots. This is not defined in the 180 164 makefile but the argument can be passed to make if needed. 181 165 182 166 INSTALL_MOD_STRIP 183 - -------------------------------------------------- 167 + ----------------- 184 168 INSTALL_MOD_STRIP, if defined, will cause modules to be 185 169 stripped after they are installed. If INSTALL_MOD_STRIP is '1', then 186 170 the default option --strip-debug will be used. Otherwise, 187 171 INSTALL_MOD_STRIP value will be used as the options to the strip command. 188 172 189 173 INSTALL_HDR_PATH 190 - -------------------------------------------------- 174 + ---------------- 191 175 INSTALL_HDR_PATH specifies where to install user space headers when 192 176 executing "make headers_*". 193 - The default value is: 177 + 178 + The default value is:: 194 179 195 180 $(objtree)/usr 196 181 ··· 201 184 The value can be overridden in which case the default value is ignored. 202 185 203 186 KBUILD_SIGN_PIN 204 - -------------------------------------------------- 187 + --------------- 205 188 This variable allows a passphrase or PIN to be passed to the sign-file 206 189 utility when signing kernel modules, if the private key requires such. 207 190 208 191 KBUILD_MODPOST_WARN 209 - -------------------------------------------------- 192 + ------------------- 210 193 KBUILD_MODPOST_WARN can be set to avoid errors in case of undefined 211 194 symbols in the final module linking stage. It changes such errors 212 195 into warnings. 213 196 214 197 KBUILD_MODPOST_NOFINAL 215 - -------------------------------------------------- 198 + ---------------------- 216 199 KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules. 217 200 This is solely useful to speed up test compiles. 218 201 219 202 KBUILD_EXTRA_SYMBOLS 220 - -------------------------------------------------- 203 + -------------------- 221 204 For modules that use symbols from other modules. 222 205 See more details in modules.txt. 223 206 224 207 ALLSOURCE_ARCHS 225 - -------------------------------------------------- 208 + --------------- 226 209 For tags/TAGS/cscope targets, you can specify more than one arch 227 - to be included in the databases, separated by blank space. E.g.: 210 + to be included in the databases, separated by blank space. E.g.:: 228 211 229 212 $ make ALLSOURCE_ARCHS="x86 mips arm" tags 230 213 231 - To get all available archs you can also specify all. E.g.: 214 + To get all available archs you can also specify all. E.g.:: 232 215 233 216 $ make ALLSOURCE_ARCHS=all tags 234 217 235 218 KBUILD_ENABLE_EXTRA_GCC_CHECKS 236 - -------------------------------------------------- 219 + ------------------------------ 237 220 If enabled over the make command line with "W=1", it turns on additional 238 221 gcc -W... options for more extensive build-time checking. 239 222 240 223 KBUILD_BUILD_TIMESTAMP 241 - -------------------------------------------------- 224 + ---------------------- 242 225 Setting this to a date string overrides the timestamp used in the 243 226 UTS_VERSION definition (uname -v in the running kernel). The value has to 244 227 be a string that can be passed to date -d. The default value 245 228 is the output of the date command at one point during build. 246 229 247 230 KBUILD_BUILD_USER, KBUILD_BUILD_HOST 248 - -------------------------------------------------- 231 + ------------------------------------ 249 232 These two variables allow to override the user@host string displayed during 250 233 boot and in /proc/version. The default value is the output of the commands 251 234 whoami and host, respectively. 252 235 253 236 KBUILD_LDS 254 - -------------------------------------------------- 237 + ---------- 255 238 The linker script with full path. Assigned by the top-level Makefile. 256 239 257 240 KBUILD_VMLINUX_OBJS 258 - -------------------------------------------------- 241 + ------------------- 259 242 All object files for vmlinux. They are linked to vmlinux in the same 260 243 order as listed in KBUILD_VMLINUX_OBJS. 261 244 262 245 KBUILD_VMLINUX_LIBS 263 - -------------------------------------------------- 246 + ------------------- 264 247 All .a "lib" files for vmlinux. KBUILD_VMLINUX_OBJS and KBUILD_VMLINUX_LIBS 265 248 together specify all the object files used to link vmlinux.
+127 -107
Documentation/kbuild/kconfig-language.txt Documentation/kbuild/kconfig-language.rst
··· 1 + ================ 2 + Kconfig Language 3 + ================ 4 + 1 5 Introduction 2 6 ------------ 3 7 4 8 The configuration database is a collection of configuration options 5 - organized in a tree structure: 9 + organized in a tree structure:: 6 10 7 11 +- Code maturity level options 8 12 | +- Prompt for development and/or incomplete code/drivers ··· 29 25 ------------ 30 26 31 27 Most entries define a config option; all other entries help to organize 32 - them. A single configuration option is defined like this: 28 + them. A single configuration option is defined like this:: 33 29 34 - config MODVERSIONS 30 + config MODVERSIONS 35 31 bool "Set version information on all module symbols" 36 32 depends on MODULES 37 33 help ··· 56 52 Every config option must have a type. There are only two basic types: 57 53 tristate and string; the other types are based on these two. The type 58 54 definition optionally accepts an input prompt, so these two examples 59 - are equivalent: 55 + are equivalent:: 60 56 61 57 bool "Networking support" 62 - and 58 + 59 + and:: 60 + 63 61 bool 64 62 prompt "Networking support" 65 63 ··· 104 98 d) Hardware or infrastructure that everybody expects, such as CONFIG_NET 105 99 or CONFIG_BLOCK. These are rare exceptions. 106 100 107 - - type definition + default value: 101 + - type definition + default value:: 102 + 108 103 "def_bool"/"def_tristate" <expr> ["if" <expr>] 104 + 109 105 This is a shorthand notation for a type definition plus a value. 110 106 Optionally dependencies for this default value can be added with "if". 111 107 ··· 115 107 This defines a dependency for this menu entry. If multiple 116 108 dependencies are defined, they are connected with '&&'. Dependencies 117 109 are applied to all other options within this menu entry (which also 118 - accept an "if" expression), so these two examples are equivalent: 110 + accept an "if" expression), so these two examples are equivalent:: 119 111 120 112 bool "foo" if BAR 121 113 default y if BAR 122 - and 114 + 115 + and:: 116 + 123 117 depends on BAR 124 118 bool "foo" 125 119 default y ··· 134 124 times, the limit is set to the largest selection. 135 125 Reverse dependencies can only be used with boolean or tristate 136 126 symbols. 127 + 137 128 Note: 138 129 select should be used with care. select will force 139 130 a symbol to a value without visiting the dependencies. ··· 150 139 symbol except that the "implied" symbol's value may still be set to n 151 140 from a direct dependency or with a visible prompt. 152 141 153 - Given the following example: 142 + Given the following example:: 154 143 155 - config FOO 144 + config FOO 156 145 tristate 157 146 imply BAZ 158 147 159 - config BAZ 148 + config BAZ 160 149 tristate 161 150 depends on BAR 162 151 163 152 The following values are possible: 164 153 154 + === === ============= ============== 165 155 FOO BAR BAZ's default choice for BAZ 166 - --- --- ------------- -------------- 156 + === === ============= ============== 167 157 n y n N/m/y 168 158 m y m M/y/n 169 159 y y y Y/n 170 160 y n * N 161 + === === ============= ============== 171 162 172 163 This is useful e.g. with multiple drivers that want to indicate their 173 164 ability to hook into a secondary subsystem while allowing the user to ··· 221 208 Dependencies define the visibility of a menu entry and can also reduce 222 209 the input range of tristate symbols. The tristate logic used in the 223 210 expressions uses one more state than normal boolean logic to express the 224 - module state. Dependency expressions have the following syntax: 211 + module state. Dependency expressions have the following syntax:: 225 212 226 - <expr> ::= <symbol> (1) 213 + <expr> ::= <symbol> (1) 227 214 <symbol> '=' <symbol> (2) 228 215 <symbol> '!=' <symbol> (3) 229 216 <symbol1> '<' <symbol2> (4) ··· 235 222 <expr> '&&' <expr> (7) 236 223 <expr> '||' <expr> (8) 237 224 238 - Expressions are listed in decreasing order of precedence. 225 + Expressions are listed in decreasing order of precedence. 239 226 240 227 (1) Convert the symbol into an expression. Boolean and tristate symbols 241 228 are simply converted into the respective expression values. All ··· 268 255 -------------- 269 256 270 257 The position of a menu entry in the tree is determined in two ways. First 271 - it can be specified explicitly: 258 + it can be specified explicitly:: 272 259 273 - menu "Network device support" 260 + menu "Network device support" 274 261 depends on NET 275 262 276 - config NETDEVICES 263 + config NETDEVICES 277 264 ... 278 265 279 - endmenu 266 + endmenu 280 267 281 268 All entries within the "menu" ... "endmenu" block become a submenu of 282 269 "Network device support". All subentries inherit the dependencies from ··· 288 275 can be made a submenu of it. First, the previous (parent) symbol must 289 276 be part of the dependency list and then one of these two conditions 290 277 must be true: 291 - - the child entry must become invisible, if the parent is set to 'n' 292 - - the child entry must only be visible, if the parent is visible 293 278 294 - config MODULES 279 + - the child entry must become invisible, if the parent is set to 'n' 280 + - the child entry must only be visible, if the parent is visible:: 281 + 282 + config MODULES 295 283 bool "Enable loadable module support" 296 284 297 - config MODVERSIONS 285 + config MODVERSIONS 298 286 bool "Set version information on all module symbols" 299 287 depends on MODULES 300 288 301 - comment "module support disabled" 289 + comment "module support disabled" 302 290 depends on !MODULES 303 291 304 292 MODVERSIONS directly depends on MODULES, this means it's only visible if ··· 313 299 The configuration file describes a series of menu entries, where every 314 300 line starts with a keyword (except help texts). The following keywords 315 301 end a menu entry: 302 + 316 303 - config 317 304 - menuconfig 318 305 - choice/endchoice ··· 321 306 - menu/endmenu 322 307 - if/endif 323 308 - source 309 + 324 310 The first five also start the definition of a menu entry. 325 311 326 - config: 327 - 312 + config:: 328 313 "config" <symbol> 329 314 <config options> 330 315 331 316 This defines a config symbol <symbol> and accepts any of above 332 317 attributes as options. 333 318 334 - menuconfig: 319 + menuconfig:: 335 320 "menuconfig" <symbol> 336 321 <config options> 337 322 ··· 340 325 separate list of options. To make sure all the suboptions will really 341 326 show up under the menuconfig entry and not outside of it, every item 342 327 from the <config options> list must depend on the menuconfig symbol. 343 - In practice, this is achieved by using one of the next two constructs: 328 + In practice, this is achieved by using one of the next two constructs:: 344 329 345 - (1): 346 - menuconfig M 347 - if M 348 - config C1 349 - config C2 350 - endif 330 + (1): 331 + menuconfig M 332 + if M 333 + config C1 334 + config C2 335 + endif 351 336 352 - (2): 353 - menuconfig M 354 - config C1 355 - depends on M 356 - config C2 357 - depends on M 337 + (2): 338 + menuconfig M 339 + config C1 340 + depends on M 341 + config C2 342 + depends on M 358 343 359 344 In the following examples (3) and (4), C1 and C2 still have the M 360 345 dependency, but will not appear under menuconfig M anymore, because 361 - of C0, which doesn't depend on M: 346 + of C0, which doesn't depend on M:: 362 347 363 - (3): 364 - menuconfig M 365 - config C0 366 - if M 367 - config C1 368 - config C2 369 - endif 348 + (3): 349 + menuconfig M 350 + config C0 351 + if M 352 + config C1 353 + config C2 354 + endif 370 355 371 - (4): 372 - menuconfig M 373 - config C0 374 - config C1 375 - depends on M 376 - config C2 377 - depends on M 356 + (4): 357 + menuconfig M 358 + config C0 359 + config C1 360 + depends on M 361 + config C2 362 + depends on M 378 363 379 - choices: 364 + choices:: 380 365 381 366 "choice" [symbol] 382 367 <choice options> ··· 402 387 then you may define the same choice (i.e. with the same entries) in another 403 388 place. 404 389 405 - comment: 390 + comment:: 406 391 407 392 "comment" <prompt> 408 393 <comment options> ··· 411 396 configuration process and is also echoed to the output files. The only 412 397 possible options are dependencies. 413 398 414 - menu: 399 + menu:: 415 400 416 401 "menu" <prompt> 417 402 <menu options> ··· 422 407 information. The only possible options are dependencies and "visible" 423 408 attributes. 424 409 425 - if: 410 + if:: 426 411 427 412 "if" <expr> 428 413 <if block> ··· 431 416 This defines an if block. The dependency expression <expr> is appended 432 417 to all enclosed menu entries. 433 418 434 - source: 419 + source:: 435 420 436 421 "source" <prompt> 437 422 438 423 This reads the specified configuration file. This file is always parsed. 439 424 440 - mainmenu: 425 + mainmenu:: 441 426 442 427 "mainmenu" <prompt> 443 428 ··· 467 452 architectures. 468 453 An example is the generic IOMAP functionality. 469 454 470 - We would in lib/Kconfig see: 455 + We would in lib/Kconfig see:: 471 456 472 - # Generic IOMAP is used to ... 473 - config HAVE_GENERIC_IOMAP 457 + # Generic IOMAP is used to ... 458 + config HAVE_GENERIC_IOMAP 474 459 475 - config GENERIC_IOMAP 460 + config GENERIC_IOMAP 476 461 depends on HAVE_GENERIC_IOMAP && FOO 477 462 478 - And in lib/Makefile we would see: 479 - obj-$(CONFIG_GENERIC_IOMAP) += iomap.o 463 + And in lib/Makefile we would see:: 480 464 481 - For each architecture using the generic IOMAP functionality we would see: 465 + obj-$(CONFIG_GENERIC_IOMAP) += iomap.o 482 466 483 - config X86 467 + For each architecture using the generic IOMAP functionality we would see:: 468 + 469 + config X86 484 470 select ... 485 471 select HAVE_GENERIC_IOMAP 486 472 select ... ··· 500 484 501 485 There are several features that need compiler support. The recommended way 502 486 to describe the dependency on the compiler feature is to use "depends on" 503 - followed by a test macro. 487 + followed by a test macro:: 504 488 505 - config STACKPROTECTOR 489 + config STACKPROTECTOR 506 490 bool "Stack Protector buffer overflow detection" 507 491 depends on $(cc-option,-fstack-protector) 508 492 ... 509 493 510 494 If you need to expose a compiler capability to makefiles and/or C source files, 511 - CC_HAS_ is the recommended prefix for the config option. 495 + `CC_HAS_` is the recommended prefix for the config option:: 512 496 513 - config CC_HAS_STACKPROTECTOR_NONE 497 + config CC_HAS_STACKPROTECTOR_NONE 514 498 def_bool $(cc-option,-fno-stack-protector) 515 499 516 500 Build as module only 517 501 ~~~~~~~~~~~~~~~~~~~~ 518 502 To restrict a component build to module-only, qualify its config symbol 519 - with "depends on m". E.g.: 503 + with "depends on m". E.g.:: 520 504 521 - config FOO 505 + config FOO 522 506 depends on BAR && m 523 507 524 508 limits FOO to module (=m) or disabled (=n). ··· 545 529 546 530 Read: Documentation/kbuild/Kconfig.recursion-issue-01 547 531 548 - Test with: 532 + Test with:: 549 533 550 - make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-01 allnoconfig 534 + make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-01 allnoconfig 551 535 552 536 Cumulative Kconfig recursive issue 553 537 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 554 538 555 539 Read: Documentation/kbuild/Kconfig.recursion-issue-02 556 540 557 - Test with: 541 + Test with:: 558 542 559 - make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-02 allnoconfig 543 + make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-02 allnoconfig 560 544 561 545 Practical solutions to kconfig recursive issue 562 546 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ··· 567 551 568 552 a) Remove any superfluous "select FOO" or "depends on FOO" 569 553 b) Match dependency semantics: 554 + 570 555 b1) Swap all "select FOO" to "depends on FOO" or, 556 + 571 557 b2) Swap all "depends on FOO" to "select FOO" 572 558 573 559 The resolution to a) can be tested with the sample Kconfig file ··· 584 566 Below is a list of examples of prior fixes for these types of recursive issues; 585 567 all errors appear to involve one or more select's and one or more "depends on". 586 568 569 + ============ =================================== 587 570 commit fix 588 - ====== === 571 + ============ =================================== 589 572 06b718c01208 select A -> depends on A 590 573 c22eacfe82f9 depends on A -> depends on B 591 574 6a91e854442c select A -> depends on A ··· 609 590 0c51a4d8abd6 depends on A -> select A (3) 610 591 e98062ed6dc4 select A -> depends on A (3) 611 592 91e5d284a7f1 select A -> (null) 593 + ============ =================================== 612 594 613 595 (1) Partial (or no) quote of error. 614 596 (2) That seems to be the gist of that fix. ··· 636 616 ~~~~~~~~~~~~~~~~~~~~ 637 617 638 618 The use of Kconfig is broad, Linux is now only one of Kconfig's users: 639 - one study has completed a broad analysis of Kconfig use in 12 projects [0]. 619 + one study has completed a broad analysis of Kconfig use in 12 projects [0]_. 640 620 Despite its widespread use, and although this document does a reasonable job 641 621 in documenting basic Kconfig syntax a more precise definition of Kconfig 642 622 semantics is welcomed. One project deduced Kconfig semantics through 643 - the use of the xconfig configurator [1]. Work should be done to confirm if 623 + the use of the xconfig configurator [1]_. Work should be done to confirm if 644 624 the deduced semantics matches our intended Kconfig design goals. 645 625 646 626 Having well defined semantics can be useful for tools for practical ··· 648 628 express in boolean abstraction of the inferred semantics of Kconfig to 649 629 translate Kconfig logic into boolean formulas and run a SAT solver on this to 650 630 find dead code / features (always inactive), 114 dead features were found in 651 - Linux using this methodology [1] (Section 8: Threats to validity). 631 + Linux using this methodology [1]_ (Section 8: Threats to validity). 652 632 653 633 Confirming this could prove useful as Kconfig stands as one of the the leading 654 - industrial variability modeling languages [1] [2]. Its study would help 634 + industrial variability modeling languages [1]_ [2]_. Its study would help 655 635 evaluate practical uses of such languages, their use was only theoretical 656 636 and real world requirements were not well understood. As it stands though 657 637 only reverse engineering techniques have been used to deduce semantics from 658 - variability modeling languages such as Kconfig [3]. 638 + variability modeling languages such as Kconfig [3]_. 659 639 660 - [0] http://www.eng.uwaterloo.ca/~shshe/kconfig_semantics.pdf 661 - [1] http://gsd.uwaterloo.ca/sites/default/files/vm-2013-berger.pdf 662 - [2] http://gsd.uwaterloo.ca/sites/default/files/ase241-berger_0.pdf 663 - [3] http://gsd.uwaterloo.ca/sites/default/files/icse2011.pdf 640 + .. [0] http://www.eng.uwaterloo.ca/~shshe/kconfig_semantics.pdf 641 + .. [1] http://gsd.uwaterloo.ca/sites/default/files/vm-2013-berger.pdf 642 + .. [2] http://gsd.uwaterloo.ca/sites/default/files/ase241-berger_0.pdf 643 + .. [3] http://gsd.uwaterloo.ca/sites/default/files/icse2011.pdf 664 644 665 645 Full SAT solver for Kconfig 666 646 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 667 647 668 - Although SAT solvers [0] haven't yet been used by Kconfig directly, as noted in 669 - the previous subsection, work has been done however to express in boolean 648 + Although SAT solvers [4]_ haven't yet been used by Kconfig directly, as noted 649 + in the previous subsection, work has been done however to express in boolean 670 650 abstraction the inferred semantics of Kconfig to translate Kconfig logic into 671 - boolean formulas and run a SAT solver on it [1]. Another known related project 672 - is CADOS [2] (former VAMOS [3]) and the tools, mainly undertaker [4], which has 673 - been introduced first with [5]. The basic concept of undertaker is to exract 674 - variability models from Kconfig, and put them together with a propositional 675 - formula extracted from CPP #ifdefs and build-rules into a SAT solver in order 676 - to find dead code, dead files, and dead symbols. If using a SAT solver is 677 - desirable on Kconfig one approach would be to evaluate repurposing such efforts 678 - somehow on Kconfig. There is enough interest from mentors of existing projects 679 - to not only help advise how to integrate this work upstream but also help 680 - maintain it long term. Interested developers should visit: 651 + boolean formulas and run a SAT solver on it [5]_. Another known related project 652 + is CADOS [6]_ (former VAMOS [7]_) and the tools, mainly undertaker [8]_, which 653 + has been introduced first with [9]_. The basic concept of undertaker is to 654 + exract variability models from Kconfig, and put them together with a 655 + propositional formula extracted from CPP #ifdefs and build-rules into a SAT 656 + solver in order to find dead code, dead files, and dead symbols. If using a SAT 657 + solver is desirable on Kconfig one approach would be to evaluate repurposing 658 + such efforts somehow on Kconfig. There is enough interest from mentors of 659 + existing projects to not only help advise how to integrate this work upstream 660 + but also help maintain it long term. Interested developers should visit: 681 661 682 662 http://kernelnewbies.org/KernelProjects/kconfig-sat 683 663 684 - [0] http://www.cs.cornell.edu/~sabhar/chapters/SATSolvers-KR-Handbook.pdf 685 - [1] http://gsd.uwaterloo.ca/sites/default/files/vm-2013-berger.pdf 686 - [2] https://cados.cs.fau.de 687 - [3] https://vamos.cs.fau.de 688 - [4] https://undertaker.cs.fau.de 689 - [5] https://www4.cs.fau.de/Publications/2011/tartler_11_eurosys.pdf 664 + .. [4] http://www.cs.cornell.edu/~sabhar/chapters/SATSolvers-KR-Handbook.pdf 665 + .. [5] http://gsd.uwaterloo.ca/sites/default/files/vm-2013-berger.pdf 666 + .. [6] https://cados.cs.fau.de 667 + .. [7] https://vamos.cs.fau.de 668 + .. [8] https://undertaker.cs.fau.de 669 + .. [9] https://www4.cs.fau.de/Publications/2011/tartler_11_eurosys.pdf
+21 -16
Documentation/kbuild/kconfig-macro-language.txt Documentation/kbuild/kconfig-macro-language.rst
··· 1 + ====================== 2 + Kconfig macro language 3 + ====================== 4 + 1 5 Concept 2 6 ------- 3 7 ··· 11 7 substitution. 12 8 13 9 There is clear distinction between the two language stages. For example, you 14 - can write a makefile like follows: 10 + can write a makefile like follows:: 15 11 16 12 APP := foo 17 13 SRC := foo.c ··· 21 17 $(CC) -o $(APP) $(SRC) 22 18 23 19 The macro language replaces the variable references with their expanded form, 24 - and handles as if the source file were input like follows: 20 + and handles as if the source file were input like follows:: 25 21 26 22 foo: foo.c 27 23 gcc -o foo foo.c ··· 30 26 updated. 31 27 32 28 The idea is quite similar in Kconfig - it is possible to describe a Kconfig 33 - file like this: 29 + file like this:: 34 30 35 31 CC := gcc 36 32 ··· 38 34 def_bool $(shell, $(srctree)/scripts/gcc-check-foo.sh $(CC)) 39 35 40 36 The macro language in Kconfig processes the source file into the following 41 - intermediate: 37 + intermediate:: 42 38 43 39 config CC_HAS_FOO 44 40 def_bool y ··· 73 69 side was originally defined as a simple variable. Otherwise, its evaluation is 74 70 deferred. 75 71 76 - The variable reference can take parameters, in the following form: 72 + The variable reference can take parameters, in the following form:: 77 73 78 74 $(name,arg1,arg2,arg3) 79 75 ··· 145 141 Kconfig adopts Make-like macro language, but the function call syntax is 146 142 slightly different. 147 143 148 - A function call in Make looks like this: 144 + A function call in Make looks like this:: 149 145 150 146 $(func-name arg1,arg2,arg3) 151 147 ··· 153 149 whitespace. Then, leading whitespaces are trimmed from the first argument, 154 150 while whitespaces in the other arguments are kept. You need to use a kind of 155 151 trick to start the first parameter with spaces. For example, if you want 156 - to make "info" function print " hello", you can write like follows: 152 + to make "info" function print " hello", you can write like follows:: 157 153 158 154 empty := 159 155 space := $(empty) $(empty) 160 156 $(info $(space)$(space)hello) 161 157 162 158 Kconfig uses only commas for delimiters, and keeps all whitespaces in the 163 - function call. Some people prefer putting a space after each comma delimiter: 159 + function call. Some people prefer putting a space after each comma delimiter:: 164 160 165 161 $(func-name, arg1, arg2, arg3) 166 162 ··· 170 166 replaces ".c" with " .o". 171 167 172 168 In Make, a user-defined function is referenced by using a built-in function, 173 - 'call', like this: 169 + 'call', like this:: 174 170 175 171 $(call my-func,arg1,arg2,arg3) 176 172 ··· 183 179 this is _useful_ inconsistency. 184 180 185 181 In Kconfig, for simpler implementation and grammatical consistency, commas that 186 - appear in the $( ) context are always delimiters. It means 182 + appear in the $( ) context are always delimiters. It means:: 187 183 188 184 $(shell, echo hello, world) 189 185 190 186 is an error because it is passing two parameters where the 'shell' function 191 - accepts only one. To pass commas in arguments, you can use the following trick: 187 + accepts only one. To pass commas in arguments, you can use the following trick:: 192 188 193 189 comma := , 194 190 $(shell, echo hello$(comma) world) ··· 199 195 200 196 A variable (or function) cannot be expanded across tokens. So, you cannot use 201 197 a variable as a shorthand for an expression that consists of multiple tokens. 202 - The following works: 198 + The following works:: 203 199 204 200 RANGE_MIN := 1 205 201 RANGE_MAX := 3 ··· 208 204 int "foo" 209 205 range $(RANGE_MIN) $(RANGE_MAX) 210 206 211 - But, the following does not work: 207 + But, the following does not work:: 212 208 213 209 RANGES := 1 3 214 210 ··· 217 213 range $(RANGES) 218 214 219 215 A variable cannot be expanded to any keyword in Kconfig. The following does 220 - not work: 216 + not work:: 221 217 222 218 MY_TYPE := tristate 223 219 ··· 227 223 228 224 Obviously from the design, $(shell command) is expanded in the textual 229 225 substitution phase. You cannot pass symbols to the 'shell' function. 230 - The following does not work as expected. 226 + 227 + The following does not work as expected:: 231 228 232 229 config ENDIAN_FLAG 233 230 string ··· 239 234 def_bool $(shell $(srctree)/scripts/gcc-check-flag ENDIAN_FLAG) 240 235 241 236 Instead, you can do like follows so that any function call is statically 242 - expanded. 237 + expanded:: 243 238 244 239 config CC_HAS_ENDIAN_FLAG 245 240 bool
+82 -54
Documentation/kbuild/kconfig.txt Documentation/kbuild/kconfig.rst
··· 1 - This file contains some assistance for using "make *config". 1 + =================== 2 + Kconfig make config 3 + =================== 4 + 5 + This file contains some assistance for using `make *config`. 2 6 3 7 Use "make help" to list all of the possible configuration targets. 4 8 ··· 10 6 programs also have embedded help text. Be sure to check that for 11 7 navigation, search, and other general help text. 12 8 13 - ====================================================================== 14 9 General 15 - -------------------------------------------------- 10 + ------- 16 11 17 12 New kernel releases often introduce new config symbols. Often more 18 13 important, new kernel releases may rename config symbols. When ··· 20 17 for you, so you may find that you need to see what NEW kernel 21 18 symbols have been introduced. 22 19 23 - To see a list of new config symbols, use 20 + To see a list of new config symbols, use:: 24 21 25 22 cp user/some/old.config .config 26 23 make listnewconfig 27 24 28 25 and the config program will list any new symbols, one per line. 29 26 30 - Alternatively, you can use the brute force method: 27 + Alternatively, you can use the brute force method:: 31 28 32 29 make oldconfig 33 30 scripts/diffconfig .config.old .config | less 34 31 35 - ______________________________________________________________________ 36 - Environment variables for '*config' 32 + ---------------------------------------------------------------------- 33 + 34 + Environment variables for `*config` 37 35 38 36 KCONFIG_CONFIG 39 - -------------------------------------------------- 37 + -------------- 40 38 This environment variable can be used to specify a default kernel config 41 39 file name to override the default name of ".config". 42 40 43 41 KCONFIG_OVERWRITECONFIG 44 - -------------------------------------------------- 42 + ----------------------- 45 43 If you set KCONFIG_OVERWRITECONFIG in the environment, Kconfig will not 46 44 break symlinks when .config is a symlink to somewhere else. 47 45 48 - CONFIG_ 49 - -------------------------------------------------- 50 - If you set CONFIG_ in the environment, Kconfig will prefix all symbols 46 + `CONFIG_` 47 + --------- 48 + If you set `CONFIG_` in the environment, Kconfig will prefix all symbols 51 49 with its value when saving the configuration, instead of using the default, 52 - "CONFIG_". 50 + `CONFIG_`. 53 51 54 - ______________________________________________________________________ 52 + ---------------------------------------------------------------------- 53 + 55 54 Environment variables for '{allyes/allmod/allno/rand}config' 56 55 57 56 KCONFIG_ALLCONFIG 58 - -------------------------------------------------- 57 + ----------------- 59 58 (partially based on lkml email from/by Rob Landley, re: miniconfig) 59 + 60 60 -------------------------------------------------- 61 + 61 62 The allyesconfig/allmodconfig/allnoconfig/randconfig variants can also 62 63 use the environment variable KCONFIG_ALLCONFIG as a flag or a filename 63 64 that contains config symbols that the user requires to be set to a 64 65 specific value. If KCONFIG_ALLCONFIG is used without a filename where 65 - KCONFIG_ALLCONFIG == "" or KCONFIG_ALLCONFIG == "1", "make *config" 66 + KCONFIG_ALLCONFIG == "" or KCONFIG_ALLCONFIG == "1", `make *config` 66 67 checks for a file named "all{yes/mod/no/def/random}.config" 67 - (corresponding to the *config command that was used) for symbol values 68 + (corresponding to the `*config` command that was used) for symbol values 68 69 that are to be forced. If this file is not found, it checks for a 69 70 file named "all.config" to contain forced values. 70 71 ··· 81 74 (usually a subset of all) preset config symbols. These variable 82 75 settings are still subject to normal dependency checks. 83 76 84 - Examples: 77 + Examples:: 78 + 85 79 KCONFIG_ALLCONFIG=custom-notebook.config make allnoconfig 86 - or 80 + 81 + or:: 82 + 87 83 KCONFIG_ALLCONFIG=mini.config make allnoconfig 88 - or 84 + 85 + or:: 86 + 89 87 make KCONFIG_ALLCONFIG=mini.config allnoconfig 90 88 91 89 These examples will disable most options (allnoconfig) but enable or 92 90 disable the options that are explicitly listed in the specified 93 91 mini-config files. 94 92 95 - ______________________________________________________________________ 93 + ---------------------------------------------------------------------- 94 + 96 95 Environment variables for 'randconfig' 97 96 98 97 KCONFIG_SEED 99 - -------------------------------------------------- 98 + ------------ 100 99 You can set this to the integer value used to seed the RNG, if you want 101 100 to somehow debug the behaviour of the kconfig parser/frontends. 102 101 If not set, the current time will be used. 103 102 104 103 KCONFIG_PROBABILITY 105 - -------------------------------------------------- 104 + ------------------- 106 105 This variable can be used to skew the probabilities. This variable can 107 106 be unset or empty, or set to three different formats: 107 + 108 + ======================= ================== ===================== 108 109 KCONFIG_PROBABILITY y:n split y:m:n split 109 - ----------------------------------------------------------------- 110 + ======================= ================== ===================== 110 111 unset or empty 50 : 50 33 : 33 : 34 111 112 N N : 100-N N/2 : N/2 : 100-N 112 113 [1] N:M N+M : 100-(N+M) N : M : 100-(N+M) 113 114 [2] N:M:L N : 100-N M : L : 100-(M+L) 115 + ======================= ================== ===================== 114 116 115 117 where N, M and L are integers (in base 10) in the range [0,100], and so 116 118 that: 119 + 117 120 [1] N+M is in the range [0,100] 121 + 118 122 [2] M+L is in the range [0,100] 119 123 120 - Examples: 124 + Examples:: 125 + 121 126 KCONFIG_PROBABILITY=10 122 127 10% of booleans will be set to 'y', 90% to 'n' 123 128 5% of tristates will be set to 'y', 5% to 'm', 90% to 'n' ··· 140 121 10% of booleans will be set to 'y', 90% to 'n' 141 122 15% of tristates will be set to 'y', 15% to 'm', 70% to 'n' 142 123 143 - ______________________________________________________________________ 124 + ---------------------------------------------------------------------- 125 + 144 126 Environment variables for 'syncconfig' 145 127 146 128 KCONFIG_NOSILENTUPDATE 147 - -------------------------------------------------- 129 + ---------------------- 148 130 If this variable has a non-blank value, it prevents silent kernel 149 131 config updates (requires explicit updates). 150 132 151 133 KCONFIG_AUTOCONFIG 152 - -------------------------------------------------- 134 + ------------------ 153 135 This environment variable can be set to specify the path & name of the 154 136 "auto.conf" file. Its default value is "include/config/auto.conf". 155 137 156 138 KCONFIG_TRISTATE 157 - -------------------------------------------------- 139 + ---------------- 158 140 This environment variable can be set to specify the path & name of the 159 141 "tristate.conf" file. Its default value is "include/config/tristate.conf". 160 142 161 143 KCONFIG_AUTOHEADER 162 - -------------------------------------------------- 144 + ------------------ 163 145 This environment variable can be set to specify the path & name of the 164 146 "autoconf.h" (header) file. 165 147 Its default value is "include/generated/autoconf.h". 166 148 167 149 168 - ====================================================================== 150 + ---------------------------------------------------------------------- 151 + 169 152 menuconfig 170 - -------------------------------------------------- 153 + ---------- 171 154 172 155 SEARCHING for CONFIG symbols 173 156 ··· 179 158 names, so you have to know something close to what you are 180 159 looking for. 181 160 182 - Example: 161 + Example:: 162 + 183 163 /hotplug 184 164 This lists all config symbols that contain "hotplug", 185 165 e.g., HOTPLUG_CPU, MEMORY_HOTPLUG. ··· 188 166 For search help, enter / followed by TAB-TAB (to highlight 189 167 <Help>) and Enter. This will tell you that you can also use 190 168 regular expressions (regexes) in the search string, so if you 191 - are not interested in MEMORY_HOTPLUG, you could try 169 + are not interested in MEMORY_HOTPLUG, you could try:: 192 170 193 171 /^hotplug 194 172 195 173 When searching, symbols are sorted thus: 174 + 196 175 - first, exact matches, sorted alphabetically (an exact match 197 176 is when the search matches the complete symbol name); 198 177 - then, other matches, sorted alphabetically. 178 + 199 179 For example: ^ATH.K matches: 180 + 200 181 ATH5K ATH9K ATH5K_AHB ATH5K_DEBUG [...] ATH6KL ATH6KL_DEBUG 201 182 [...] ATH9K_AHB ATH9K_BTCOEX_SUPPORT ATH9K_COMMON [...] 183 + 202 184 of which only ATH5K and ATH9K match exactly and so are sorted 203 185 first (and in alphabetical order), then come all other symbols, 204 186 sorted in alphabetical order. 205 187 206 - ______________________________________________________________________ 188 + ---------------------------------------------------------------------- 189 + 207 190 User interface options for 'menuconfig' 208 191 209 192 MENUCONFIG_COLOR 210 - -------------------------------------------------- 193 + ---------------- 211 194 It is possible to select different color themes using the variable 212 - MENUCONFIG_COLOR. To select a theme use: 195 + MENUCONFIG_COLOR. To select a theme use:: 213 196 214 197 make MENUCONFIG_COLOR=<theme> menuconfig 215 198 216 - Available themes are: 217 - mono => selects colors suitable for monochrome displays 218 - blackbg => selects a color scheme with black background 219 - classic => theme with blue background. The classic look 220 - bluetitle => a LCD friendly version of classic. (default) 199 + Available themes are:: 200 + 201 + - mono => selects colors suitable for monochrome displays 202 + - blackbg => selects a color scheme with black background 203 + - classic => theme with blue background. The classic look 204 + - bluetitle => a LCD friendly version of classic. (default) 221 205 222 206 MENUCONFIG_MODE 223 - -------------------------------------------------- 207 + --------------- 224 208 This mode shows all sub-menus in one large tree. 225 209 226 - Example: 210 + Example:: 211 + 227 212 make MENUCONFIG_MODE=single_menu menuconfig 228 213 214 + ---------------------------------------------------------------------- 229 215 230 - ====================================================================== 231 216 nconfig 232 - -------------------------------------------------- 217 + ------- 233 218 234 219 nconfig is an alternate text-based configurator. It lists function 235 220 keys across the bottom of the terminal (window) that execute commands. ··· 260 231 given string or regular expression (regex). 261 232 262 233 NCONFIG_MODE 263 - -------------------------------------------------- 234 + ------------ 264 235 This mode shows all sub-menus in one large tree. 265 236 266 - Example: 237 + Example:: 267 238 make NCONFIG_MODE=single_menu nconfig 268 239 240 + ---------------------------------------------------------------------- 269 241 270 - ====================================================================== 271 242 xconfig 272 - -------------------------------------------------- 243 + ------- 273 244 274 245 Searching in xconfig: 275 246 ··· 289 260 to return to the main menu. 290 261 291 262 292 - ====================================================================== 263 + ---------------------------------------------------------------------- 264 + 293 265 gconfig 294 - -------------------------------------------------- 266 + ------- 295 267 296 268 Searching in gconfig: 297 269 298 270 There is no search command in gconfig. However, gconfig does 299 271 have several different viewing choices, modes, and options. 300 - 301 - ###
+334 -194
Documentation/kbuild/makefiles.txt Documentation/kbuild/makefiles.rst
··· 1 + ====================== 1 2 Linux Kernel Makefiles 3 + ====================== 2 4 3 5 This document describes the Linux kernel Makefiles. 4 6 5 - === Table of Contents 7 + .. Table of Contents 6 8 7 9 === 1 Overview 8 10 === 2 Who does what ··· 56 54 === 10 Credits 57 55 === 11 TODO 58 56 59 - === 1 Overview 57 + 1 Overview 58 + ========== 60 59 61 - The Makefiles have five parts: 60 + The Makefiles have five parts:: 62 61 63 62 Makefile the top Makefile. 64 63 .config the kernel configuration file. ··· 88 85 are used to build the kernel based on the kbuild makefiles. 89 86 90 87 91 - === 2 Who does what 88 + 2 Who does what 89 + =============== 92 90 93 91 People have four different relationships with the kernel Makefiles. 94 92 ··· 114 110 This document is aimed towards normal developers and arch developers. 115 111 116 112 117 - === 3 The kbuild files 113 + 3 The kbuild files 114 + ================== 118 115 119 116 Most Makefiles within the kernel are kbuild Makefiles that use the 120 117 kbuild infrastructure. This chapter introduces the syntax used in the ··· 127 122 Section 3.1 "Goal definitions" is a quick intro, further chapters provide 128 123 more details, with real examples. 129 124 130 - --- 3.1 Goal definitions 125 + 3.1 Goal definitions 126 + -------------------- 131 127 132 128 Goal definitions are the main part (heart) of the kbuild Makefile. 133 129 These lines define the files to be built, any special compilation ··· 136 130 137 131 The most simple kbuild makefile contains one line: 138 132 139 - Example: 133 + Example:: 134 + 140 135 obj-y += foo.o 141 136 142 137 This tells kbuild that there is one object in that directory, named ··· 146 139 If foo.o shall be built as a module, the variable obj-m is used. 147 140 Therefore the following pattern is often used: 148 141 149 - Example: 142 + Example:: 143 + 150 144 obj-$(CONFIG_FOO) += foo.o 151 145 152 146 $(CONFIG_FOO) evaluates to either y (for built-in) or m (for module). 153 147 If CONFIG_FOO is neither y nor m, then the file will not be compiled 154 148 nor linked. 155 149 156 - --- 3.2 Built-in object goals - obj-y 150 + 3.2 Built-in object goals - obj-y 151 + --------------------------------- 157 152 158 153 The kbuild Makefile specifies object files for vmlinux 159 154 in the $(obj-y) lists. These lists depend on the kernel ··· 176 167 order may e.g. change the order in which your SCSI 177 168 controllers are detected, and thus your disks are renumbered. 178 169 179 - Example: 170 + Example:: 171 + 180 172 #drivers/isdn/i4l/Makefile 181 173 # Makefile for the kernel ISDN subsystem and device drivers. 182 174 # Each configuration option enables a list of files. 183 175 obj-$(CONFIG_ISDN_I4L) += isdn.o 184 176 obj-$(CONFIG_ISDN_PPP_BSDCOMP) += isdn_bsdcomp.o 185 177 186 - --- 3.3 Loadable module goals - obj-m 178 + 3.3 Loadable module goals - obj-m 179 + --------------------------------- 187 180 188 181 $(obj-m) specifies object files which are built as loadable 189 182 kernel modules. ··· 194 183 files. In the case of one source file, the kbuild makefile 195 184 simply adds the file to $(obj-m). 196 185 197 - Example: 186 + Example:: 187 + 198 188 #drivers/isdn/i4l/Makefile 199 189 obj-$(CONFIG_ISDN_PPP_BSDCOMP) += isdn_bsdcomp.o 200 190 ··· 207 195 module from, so you have to tell it by setting a $(<module_name>-y) 208 196 variable. 209 197 210 - Example: 198 + Example:: 199 + 211 200 #drivers/isdn/i4l/Makefile 212 201 obj-$(CONFIG_ISDN_I4L) += isdn.o 213 202 isdn-y := isdn_net_lib.o isdn_v110.o isdn_common.o ··· 218 205 "$(LD) -r" on the list of these files to generate isdn.o. 219 206 220 207 Due to kbuild recognizing $(<module_name>-y) for composite objects, 221 - you can use the value of a CONFIG_ symbol to optionally include an 208 + you can use the value of a `CONFIG_` symbol to optionally include an 222 209 object file as part of a composite object. 223 210 224 - Example: 211 + Example:: 212 + 225 213 #fs/ext2/Makefile 226 214 obj-$(CONFIG_EXT2_FS) += ext2.o 227 215 ext2-y := balloc.o dir.o file.o ialloc.o inode.o ioctl.o \ ··· 239 225 kbuild will build an ext2.o file for you out of the individual 240 226 parts and then link this into built-in.a, as you would expect. 241 227 242 - --- 3.4 Objects which export symbols 228 + 3.4 Objects which export symbols 229 + -------------------------------- 243 230 244 231 No special notation is required in the makefiles for 245 232 modules exporting symbols. 246 233 247 - --- 3.5 Library file goals - lib-y 234 + 3.5 Library file goals - lib-y 235 + ------------------------------ 248 236 249 237 Objects listed with obj-* are used for modules, or 250 238 combined in a built-in.a for that specific directory. ··· 263 247 and to be part of a library. Therefore the same directory 264 248 may contain both a built-in.a and a lib.a file. 265 249 266 - Example: 250 + Example:: 251 + 267 252 #arch/x86/lib/Makefile 268 253 lib-y := delay.o 269 254 270 255 This will create a library lib.a based on delay.o. For kbuild to 271 256 actually recognize that there is a lib.a being built, the directory 272 257 shall be listed in libs-y. 258 + 273 259 See also "6.4 List directories to visit when descending". 274 260 275 - Use of lib-y is normally restricted to lib/ and arch/*/lib. 261 + Use of lib-y is normally restricted to `lib/` and `arch/*/lib`. 276 262 277 - --- 3.6 Descending down in directories 263 + 3.6 Descending down in directories 264 + ---------------------------------- 278 265 279 266 A Makefile is only responsible for building objects in its own 280 267 directory. Files in subdirectories should be taken care of by ··· 289 270 ext2 lives in a separate directory, and the Makefile present in fs/ 290 271 tells kbuild to descend down using the following assignment. 291 272 292 - Example: 273 + Example:: 274 + 293 275 #fs/Makefile 294 276 obj-$(CONFIG_EXT2_FS) += ext2/ 295 277 ··· 301 281 the directory, it is the Makefile in the subdirectory that 302 282 specifies what is modular and what is built-in. 303 283 304 - It is good practice to use a CONFIG_ variable when assigning directory 284 + It is good practice to use a `CONFIG_` variable when assigning directory 305 285 names. This allows kbuild to totally skip the directory if the 306 - corresponding CONFIG_ option is neither 'y' nor 'm'. 286 + corresponding `CONFIG_` option is neither 'y' nor 'm'. 307 287 308 - --- 3.7 Compilation flags 288 + 3.7 Compilation flags 289 + --------------------- 309 290 310 291 ccflags-y, asflags-y and ldflags-y 311 292 These three flags apply only to the kbuild makefile in which they ··· 318 297 319 298 ccflags-y specifies options for compiling with $(CC). 320 299 321 - Example: 300 + Example:: 301 + 322 302 # drivers/acpi/acpica/Makefile 323 303 ccflags-y := -Os -D_LINUX -DBUILDING_ACPICA 324 304 ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT ··· 330 308 331 309 asflags-y specifies options for assembling with $(AS). 332 310 333 - Example: 311 + Example:: 312 + 334 313 #arch/sparc/kernel/Makefile 335 314 asflags-y := -ansi 336 315 337 316 ldflags-y specifies options for linking with $(LD). 338 317 339 - Example: 318 + Example:: 319 + 340 320 #arch/cris/boot/compressed/Makefile 341 321 ldflags-y += -T $(srctree)/$(src)/decompress_$(arch-y).lds 342 322 ··· 349 325 Options specified using subdir-* are added to the commandline before 350 326 the options specified using the non-subdir variants. 351 327 352 - Example: 328 + Example:: 329 + 353 330 subdir-ccflags-y := -Werror 354 331 355 332 CFLAGS_$@, AFLAGS_$@ 356 - 357 333 CFLAGS_$@ and AFLAGS_$@ only apply to commands in current 358 334 kbuild makefile. 359 335 360 336 $(CFLAGS_$@) specifies per-file options for $(CC). The $@ 361 337 part has a literal value which specifies the file that it is for. 362 338 363 - Example: 339 + Example:: 340 + 364 341 # drivers/scsi/Makefile 365 342 CFLAGS_aha152x.o = -DAHA152X_STAT -DAUTOCONF 366 343 CFLAGS_gdth.o = # -DDEBUG_GDTH=2 -D__SERIAL__ -D__COM2__ \ ··· 372 347 $(AFLAGS_$@) is a similar feature for source files in assembly 373 348 languages. 374 349 375 - Example: 350 + Example:: 351 + 376 352 # arch/arm/kernel/Makefile 377 353 AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET) 378 354 AFLAGS_crunch-bits.o := -Wa,-mcpu=ep9312 379 355 AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt 380 356 381 357 382 - --- 3.9 Dependency tracking 358 + 3.9 Dependency tracking 359 + ----------------------- 383 360 384 361 Kbuild tracks dependencies on the following: 385 - 1) All prerequisite files (both *.c and *.h) 386 - 2) CONFIG_ options used in all prerequisite files 362 + 1) All prerequisite files (both `*.c` and `*.h`) 363 + 2) `CONFIG_` options used in all prerequisite files 387 364 3) Command-line used to compile target 388 365 389 366 Thus, if you change an option to $(CC) all affected files will 390 367 be re-compiled. 391 368 392 - --- 3.10 Special Rules 369 + 3.10 Special Rules 370 + ------------------ 393 371 394 372 Special rules are used when the kbuild infrastructure does 395 373 not provide the required support. A typical example is ··· 407 379 408 380 Two variables are used when defining special rules: 409 381 410 - $(src) 411 - $(src) is a relative path which points to the directory 412 - where the Makefile is located. Always use $(src) when 413 - referring to files located in the src tree. 382 + $(src) 383 + $(src) is a relative path which points to the directory 384 + where the Makefile is located. Always use $(src) when 385 + referring to files located in the src tree. 414 386 415 - $(obj) 416 - $(obj) is a relative path which points to the directory 417 - where the target is saved. Always use $(obj) when 418 - referring to generated files. 387 + $(obj) 388 + $(obj) is a relative path which points to the directory 389 + where the target is saved. Always use $(obj) when 390 + referring to generated files. 419 391 420 - Example: 392 + Example:: 393 + 421 394 #drivers/scsi/Makefile 422 395 $(obj)/53c8xx_d.h: $(src)/53c7,8xx.scr $(src)/script_asm.pl 423 396 $(CPP) -DCHIP=810 - < $< | ... $(src)/script_asm.pl 424 397 425 - This is a special rule, following the normal syntax 426 - required by make. 427 - The target file depends on two prerequisite files. References 428 - to the target file are prefixed with $(obj), references 429 - to prerequisites are referenced with $(src) (because they are not 430 - generated files). 398 + This is a special rule, following the normal syntax 399 + required by make. 431 400 432 - $(kecho) 433 - echoing information to user in a rule is often a good practice 434 - but when execution "make -s" one does not expect to see any output 435 - except for warnings/errors. 436 - To support this kbuild defines $(kecho) which will echo out the 437 - text following $(kecho) to stdout except if "make -s" is used. 401 + The target file depends on two prerequisite files. References 402 + to the target file are prefixed with $(obj), references 403 + to prerequisites are referenced with $(src) (because they are not 404 + generated files). 438 405 439 - Example: 406 + $(kecho) 407 + echoing information to user in a rule is often a good practice 408 + but when execution "make -s" one does not expect to see any output 409 + except for warnings/errors. 410 + To support this kbuild defines $(kecho) which will echo out the 411 + text following $(kecho) to stdout except if "make -s" is used. 412 + 413 + Example:: 414 + 440 415 #arch/blackfin/boot/Makefile 441 416 $(obj)/vmImage: $(obj)/vmlinux.gz 442 417 $(call if_changed,uimage) 443 418 @$(kecho) 'Kernel: $@ is ready' 444 419 445 420 446 - --- 3.11 $(CC) support functions 421 + 3.11 $(CC) support functions 422 + ---------------------------- 447 423 448 424 The kernel may be built with several different versions of 449 425 $(CC), each supporting a unique set of features and options. ··· 457 425 458 426 as-option 459 427 as-option is used to check if $(CC) -- when used to compile 460 - assembler (*.S) files -- supports the given option. An optional 428 + assembler (`*.S`) files -- supports the given option. An optional 461 429 second option may be specified if the first option is not supported. 462 430 463 - Example: 431 + Example:: 432 + 464 433 #arch/sh/Makefile 465 434 cflags-y += $(call as-option,-Wa$(comma)-isa=$(isa-y),) 466 435 467 436 In the above example, cflags-y will be assigned the option 468 437 -Wa$(comma)-isa=$(isa-y) if it is supported by $(CC). 438 + The second argument is optional, and if supplied will be used 439 + if first argument is not supported. 440 + 441 + cc-ldoption 442 + cc-ldoption is used to check if $(CC) when used to link object files 443 + supports the given option. An optional second option may be 444 + specified if first option are not supported. 445 + 446 + Example:: 447 + 448 + #arch/x86/kernel/Makefile 449 + vsyscall-flags += $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) 450 + 451 + In the above example, vsyscall-flags will be assigned the option 452 + -Wl$(comma)--hash-style=sysv if it is supported by $(CC). 469 453 The second argument is optional, and if supplied will be used 470 454 if first argument is not supported. 471 455 ··· 495 447 cc-option is used to check if $(CC) supports a given option, and if 496 448 not supported to use an optional second option. 497 449 498 - Example: 450 + Example:: 451 + 499 452 #arch/x86/Makefile 500 453 cflags-y += $(call cc-option,-march=pentium-mmx,-march=i586) 501 454 ··· 510 461 cc-option-yn is used to check if gcc supports a given option 511 462 and return 'y' if supported, otherwise 'n'. 512 463 513 - Example: 464 + Example:: 465 + 514 466 #arch/ppc/Makefile 515 467 biarch := $(call cc-option-yn, -m32) 516 468 aflags-$(biarch) += -a32 ··· 529 479 because gcc 4.4 and later accept any unknown -Wno-* option and only 530 480 warn about it if there is another warning in the source file. 531 481 532 - Example: 482 + Example:: 483 + 533 484 KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) 534 485 535 486 In the above example, -Wno-unused-but-set-variable will be added to ··· 541 490 if version expression is true, or the fifth (if given) if the version 542 491 expression is false. 543 492 544 - Example: 493 + Example:: 494 + 545 495 #fs/reiserfs/Makefile 546 496 ccflags-y := $(call cc-ifversion, -lt, 0402, -O1) 547 497 ··· 567 515 build (host arch is different from target arch). And if CROSS_COMPILE 568 516 is already set then leave it with the old value. 569 517 570 - Example: 518 + Example:: 519 + 571 520 #arch/m68k/Makefile 572 521 ifneq ($(SUBARCH),$(ARCH)) 573 522 ifeq ($(CROSS_COMPILE),) ··· 576 523 endif 577 524 endif 578 525 579 - --- 3.12 $(LD) support functions 526 + 3.12 $(LD) support functions 527 + ---------------------------- 580 528 581 529 ld-option 582 530 ld-option is used to check if $(LD) supports the supplied option. ··· 585 531 The second argument is an optional option that can be used if the 586 532 first option is not supported by $(LD). 587 533 588 - Example: 534 + Example:: 535 + 589 536 #Makefile 590 537 LDFLAGS_vmlinux += $(call ld-option, -X) 591 538 592 539 593 - === 4 Host Program support 540 + 4 Host Program support 541 + ====================== 594 542 595 543 Kbuild supports building executables on the host for use during the 596 544 compilation stage. ··· 606 550 or utilise the variable $(always). 607 551 Both possibilities are described in the following. 608 552 609 - --- 4.1 Simple Host Program 553 + 4.1 Simple Host Program 554 + ----------------------- 610 555 611 556 In some cases there is a need to compile and run a program on the 612 557 computer where the build is running. 613 558 The following line tells kbuild that the program bin2hex shall be 614 559 built on the build host. 615 560 616 - Example: 561 + Example:: 562 + 617 563 hostprogs-y := bin2hex 618 564 619 565 Kbuild assumes in the above example that bin2hex is made from a single 620 566 c-source file named bin2hex.c located in the same directory as 621 567 the Makefile. 622 568 623 - --- 4.2 Composite Host Programs 569 + 4.2 Composite Host Programs 570 + --------------------------- 624 571 625 572 Host programs can be made up based on composite objects. 626 573 The syntax used to define composite objects for host programs is ··· 631 572 $(<executable>-objs) lists all objects used to link the final 632 573 executable. 633 574 634 - Example: 575 + Example:: 576 + 635 577 #scripts/lxdialog/Makefile 636 578 hostprogs-y := lxdialog 637 579 lxdialog-objs := checklist.o lxdialog.o ··· 640 580 Objects with extension .o are compiled from the corresponding .c 641 581 files. In the above example, checklist.c is compiled to checklist.o 642 582 and lxdialog.c is compiled to lxdialog.o. 583 + 643 584 Finally, the two .o files are linked to the executable, lxdialog. 644 585 Note: The syntax <executable>-y is not permitted for host-programs. 645 586 646 - --- 4.3 Using C++ for host programs 587 + 4.3 Using C++ for host programs 588 + ------------------------------- 647 589 648 590 kbuild offers support for host programs written in C++. This was 649 591 introduced solely to support kconfig, and is not recommended 650 592 for general use. 651 593 652 - Example: 594 + Example:: 595 + 653 596 #scripts/kconfig/Makefile 654 597 hostprogs-y := qconf 655 598 qconf-cxxobjs := qconf.o ··· 663 600 If qconf is composed of a mixture of .c and .cc files, then an 664 601 additional line can be used to identify this. 665 602 666 - Example: 603 + Example:: 604 + 667 605 #scripts/kconfig/Makefile 668 606 hostprogs-y := qconf 669 607 qconf-cxxobjs := qconf.o 670 608 qconf-objs := check.o 671 609 672 - --- 4.4 Controlling compiler options for host programs 610 + 4.4 Controlling compiler options for host programs 611 + -------------------------------------------------- 673 612 674 613 When compiling host programs, it is possible to set specific flags. 675 614 The programs will always be compiled utilising $(HOSTCC) passed ··· 679 614 To set flags that will take effect for all host programs created 680 615 in that Makefile, use the variable HOST_EXTRACFLAGS. 681 616 682 - Example: 617 + Example:: 618 + 683 619 #scripts/lxdialog/Makefile 684 620 HOST_EXTRACFLAGS += -I/usr/include/ncurses 685 621 686 622 To set specific flags for a single file the following construction 687 623 is used: 688 624 689 - Example: 625 + Example:: 626 + 690 627 #arch/ppc64/boot/Makefile 691 628 HOSTCFLAGS_piggyback.o := -DKERNELBASE=$(KERNELBASE) 692 629 693 630 It is also possible to specify additional options to the linker. 694 631 695 - Example: 632 + Example:: 633 + 696 634 #scripts/kconfig/Makefile 697 635 HOSTLDLIBS_qconf := -L$(QTDIR)/lib 698 636 699 637 When linking qconf, it will be passed the extra option 700 638 "-L$(QTDIR)/lib". 701 639 702 - --- 4.5 When host programs are actually built 640 + 4.5 When host programs are actually built 641 + ----------------------------------------- 703 642 704 643 Kbuild will only build host-programs when they are referenced 705 644 as a prerequisite. ··· 711 642 712 643 (1) List the prerequisite explicitly in a special rule. 713 644 714 - Example: 645 + Example:: 646 + 715 647 #drivers/pci/Makefile 716 648 hostprogs-y := gen-devlist 717 649 $(obj)/devlist.h: $(src)/pci.ids $(obj)/gen-devlist ··· 723 653 the host programs in special rules must be prefixed with $(obj). 724 654 725 655 (2) Use $(always) 656 + 726 657 When there is no suitable special rule, and the host program 727 658 shall be built when a makefile is entered, the $(always) 728 659 variable shall be used. 729 660 730 - Example: 661 + Example:: 662 + 731 663 #scripts/lxdialog/Makefile 732 664 hostprogs-y := lxdialog 733 665 always := $(hostprogs-y) ··· 737 665 This will tell kbuild to build lxdialog even if not referenced in 738 666 any rule. 739 667 740 - --- 4.6 Using hostprogs-$(CONFIG_FOO) 668 + 4.6 Using hostprogs-$(CONFIG_FOO) 669 + --------------------------------- 741 670 742 671 A typical pattern in a Kbuild file looks like this: 743 672 744 - Example: 673 + Example:: 674 + 745 675 #scripts/Makefile 746 676 hostprogs-$(CONFIG_KALLSYMS) += kallsyms 747 677 ··· 753 679 like hostprogs-y. But only hostprogs-y is recommended to be used 754 680 when no CONFIG symbols are involved. 755 681 756 - === 5 Kbuild clean infrastructure 682 + 5 Kbuild clean infrastructure 683 + ============================= 757 684 758 685 "make clean" deletes most generated files in the obj tree where the kernel 759 686 is compiled. This includes generated files such as host programs. ··· 766 691 767 692 Additional files can be specified in kbuild makefiles by use of $(clean-files). 768 693 769 - Example: 694 + Example:: 695 + 770 696 #lib/Makefile 771 697 clean-files := crc32table.h 772 698 ··· 777 701 778 702 To delete a directory hierarchy use: 779 703 780 - Example: 704 + Example:: 705 + 781 706 #scripts/package/Makefile 782 707 clean-dirs := $(objtree)/debian/ 783 708 ··· 788 711 To exclude certain files from make clean, use the $(no-clean-files) variable. 789 712 This is only a special case used in the top level Kbuild file: 790 713 791 - Example: 714 + Example:: 715 + 792 716 #Kbuild 793 717 no-clean-files := $(bounds-file) $(offsets-file) 794 718 ··· 797 719 but in the architecture makefiles where the kbuild infrastructure 798 720 is not sufficient this sometimes needs to be explicit. 799 721 800 - Example: 722 + Example:: 723 + 801 724 #arch/x86/boot/Makefile 802 725 subdir- := compressed/ 803 726 ··· 808 729 To support the clean infrastructure in the Makefiles that build the 809 730 final bootimage there is an optional target named archclean: 810 731 811 - Example: 732 + Example:: 733 + 812 734 #arch/x86/Makefile 813 735 archclean: 814 736 $(Q)$(MAKE) $(clean)=arch/x86/boot ··· 825 745 Note 2: All directories listed in core-y, libs-y, drivers-y and net-y will 826 746 be visited during "make clean". 827 747 828 - === 6 Architecture Makefiles 748 + 6 Architecture Makefiles 749 + ======================== 829 750 830 751 The top level Makefile sets up the environment and does the preparation, 831 752 before starting to descend down in the individual directories. ··· 837 756 a few targets. 838 757 839 758 When kbuild executes, the following steps are followed (roughly): 759 + 840 760 1) Configuration of the kernel => produce .config 841 761 2) Store kernel version in include/linux/version.h 842 762 3) Updating all other prerequisites to the target prepare: ··· 855 773 - Preparing initrd images and the like 856 774 857 775 858 - --- 6.1 Set variables to tweak the build to the architecture 776 + 6.1 Set variables to tweak the build to the architecture 777 + -------------------------------------------------------- 859 778 860 - LDFLAGS Generic $(LD) options 779 + LDFLAGS 780 + Generic $(LD) options 861 781 862 782 Flags used for all invocations of the linker. 863 783 Often specifying the emulation is sufficient. 864 784 865 - Example: 785 + Example:: 786 + 866 787 #arch/s390/Makefile 867 788 LDFLAGS := -m elf_s390 789 + 868 790 Note: ldflags-y can be used to further customise 869 791 the flags used. See chapter 3.7. 870 792 871 - LDFLAGS_vmlinux Options for $(LD) when linking vmlinux 793 + LDFLAGS_vmlinux 794 + Options for $(LD) when linking vmlinux 872 795 873 796 LDFLAGS_vmlinux is used to specify additional flags to pass to 874 797 the linker when linking the final vmlinux image. 875 798 LDFLAGS_vmlinux uses the LDFLAGS_$@ support. 876 799 877 - Example: 800 + Example:: 801 + 878 802 #arch/x86/Makefile 879 803 LDFLAGS_vmlinux := -e stext 880 804 881 - OBJCOPYFLAGS objcopy flags 805 + OBJCOPYFLAGS 806 + objcopy flags 882 807 883 808 When $(call if_changed,objcopy) is used to translate a .o file, 884 809 the flags specified in OBJCOPYFLAGS will be used. 885 810 $(call if_changed,objcopy) is often used to generate raw binaries on 886 811 vmlinux. 887 812 888 - Example: 813 + Example:: 814 + 889 815 #arch/s390/Makefile 890 816 OBJCOPYFLAGS := -O binary 891 817 ··· 904 814 In this example, the binary $(obj)/image is a binary version of 905 815 vmlinux. The usage of $(call if_changed,xxx) will be described later. 906 816 907 - KBUILD_AFLAGS $(AS) assembler flags 817 + KBUILD_AFLAGS 818 + $(AS) assembler flags 908 819 909 820 Default value - see top level Makefile 910 821 Append or modify as required per architecture. 911 822 912 - Example: 823 + Example:: 824 + 913 825 #arch/sparc64/Makefile 914 826 KBUILD_AFLAGS += -m64 -mcpu=ultrasparc 915 827 916 - KBUILD_CFLAGS $(CC) compiler flags 828 + KBUILD_CFLAGS 829 + $(CC) compiler flags 917 830 918 831 Default value - see top level Makefile 919 832 Append or modify as required per architecture. 920 833 921 834 Often, the KBUILD_CFLAGS variable depends on the configuration. 922 835 923 - Example: 836 + Example:: 837 + 924 838 #arch/x86/boot/compressed/Makefile 925 839 cflags-$(CONFIG_X86_32) := -march=i386 926 840 cflags-$(CONFIG_X86_64) := -mcmodel=small 927 841 KBUILD_CFLAGS += $(cflags-y) 928 842 929 843 Many arch Makefiles dynamically run the target C compiler to 930 - probe supported options: 844 + probe supported options:: 931 845 932 846 #arch/x86/Makefile 933 847 ··· 947 853 The first example utilises the trick that a config option expands 948 854 to 'y' when selected. 949 855 950 - KBUILD_AFLAGS_KERNEL $(AS) options specific for built-in 856 + KBUILD_AFLAGS_KERNEL 857 + $(AS) options specific for built-in 951 858 952 859 $(KBUILD_AFLAGS_KERNEL) contains extra C compiler flags used to compile 953 860 resident kernel code. 954 861 955 - KBUILD_AFLAGS_MODULE Options for $(AS) when building modules 862 + KBUILD_AFLAGS_MODULE 863 + Options for $(AS) when building modules 956 864 957 865 $(KBUILD_AFLAGS_MODULE) is used to add arch-specific options that 958 866 are used for $(AS). 867 + 959 868 From commandline AFLAGS_MODULE shall be used (see kbuild.txt). 960 869 961 - KBUILD_CFLAGS_KERNEL $(CC) options specific for built-in 870 + KBUILD_CFLAGS_KERNEL 871 + $(CC) options specific for built-in 962 872 963 873 $(KBUILD_CFLAGS_KERNEL) contains extra C compiler flags used to compile 964 874 resident kernel code. 965 875 966 - KBUILD_CFLAGS_MODULE Options for $(CC) when building modules 876 + KBUILD_CFLAGS_MODULE 877 + Options for $(CC) when building modules 967 878 968 879 $(KBUILD_CFLAGS_MODULE) is used to add arch-specific options that 969 880 are used for $(CC). 970 881 From commandline CFLAGS_MODULE shall be used (see kbuild.txt). 971 882 972 - KBUILD_LDFLAGS_MODULE Options for $(LD) when linking modules 883 + KBUILD_LDFLAGS_MODULE 884 + Options for $(LD) when linking modules 973 885 974 886 $(KBUILD_LDFLAGS_MODULE) is used to add arch-specific options 975 887 used when linking modules. This is often a linker script. 888 + 976 889 From commandline LDFLAGS_MODULE shall be used (see kbuild.txt). 977 890 978 891 KBUILD_ARFLAGS Options for $(AR) when creating archives ··· 995 894 means for an architecture to override the defaults. 996 895 997 896 998 - --- 6.2 Add prerequisites to archheaders: 897 + 6.2 Add prerequisites to archheaders 898 + ------------------------------------ 999 899 1000 900 The archheaders: rule is used to generate header files that 1001 901 may be installed into user space by "make header_install" or ··· 1009 907 architecture itself. 1010 908 1011 909 1012 - --- 6.3 Add prerequisites to archprepare: 910 + 6.3 Add prerequisites to archprepare 911 + ------------------------------------ 1013 912 1014 913 The archprepare: rule is used to list prerequisites that need to be 1015 914 built before starting to descend down in the subdirectories. 1016 915 This is usually used for header files containing assembler constants. 1017 916 1018 - Example: 917 + Example:: 918 + 1019 919 #arch/arm/Makefile 1020 920 archprepare: maketools 1021 921 ··· 1027 923 generating offset header files. 1028 924 1029 925 1030 - --- 6.4 List directories to visit when descending 926 + 6.4 List directories to visit when descending 927 + --------------------------------------------- 1031 928 1032 929 An arch Makefile cooperates with the top Makefile to define variables 1033 930 which specify how to build the vmlinux file. Note that there is no ··· 1036 931 machinery is all architecture-independent. 1037 932 1038 933 1039 - head-y, init-y, core-y, libs-y, drivers-y, net-y 934 + head-y, init-y, core-y, libs-y, drivers-y, net-y 935 + $(head-y) lists objects to be linked first in vmlinux. 1040 936 1041 - $(head-y) lists objects to be linked first in vmlinux. 1042 - $(libs-y) lists directories where a lib.a archive can be located. 1043 - The rest list directories where a built-in.a object file can be 1044 - located. 937 + $(libs-y) lists directories where a lib.a archive can be located. 1045 938 1046 - $(init-y) objects will be located after $(head-y). 1047 - Then the rest follows in this order: 1048 - $(core-y), $(libs-y), $(drivers-y) and $(net-y). 939 + The rest list directories where a built-in.a object file can be 940 + located. 1049 941 1050 - The top level Makefile defines values for all generic directories, 1051 - and arch/$(ARCH)/Makefile only adds architecture-specific directories. 942 + $(init-y) objects will be located after $(head-y). 1052 943 1053 - Example: 944 + Then the rest follows in this order: 945 + 946 + $(core-y), $(libs-y), $(drivers-y) and $(net-y). 947 + 948 + The top level Makefile defines values for all generic directories, 949 + and arch/$(ARCH)/Makefile only adds architecture-specific 950 + directories. 951 + 952 + Example:: 953 + 1054 954 #arch/sparc64/Makefile 1055 955 core-y += arch/sparc64/kernel/ 1056 956 libs-y += arch/sparc64/prom/ arch/sparc64/lib/ 1057 957 drivers-$(CONFIG_OPROFILE) += arch/sparc64/oprofile/ 1058 958 1059 959 1060 - --- 6.5 Architecture-specific boot images 960 + 6.5 Architecture-specific boot images 961 + ------------------------------------- 1061 962 1062 963 An arch Makefile specifies goals that take the vmlinux file, compress 1063 964 it, wrap it in bootstrapping code, and copy the resulting files ··· 1081 970 arch/$(ARCH)/Makefile, and use the full path when calling down 1082 971 into the arch/$(ARCH)/boot/Makefile. 1083 972 1084 - Example: 973 + Example:: 974 + 1085 975 #arch/x86/Makefile 1086 976 boot := arch/x86/boot 1087 977 bzImage: vmlinux ··· 1095 983 but executing "make help" will list all relevant targets. 1096 984 To support this, $(archhelp) must be defined. 1097 985 1098 - Example: 986 + Example:: 987 + 1099 988 #arch/x86/Makefile 1100 989 define archhelp 1101 990 echo '* bzImage - Image (arch/$(ARCH)/boot/bzImage)' ··· 1110 997 Add a new prerequisite to all: to select a default goal different 1111 998 from vmlinux. 1112 999 1113 - Example: 1000 + Example:: 1001 + 1114 1002 #arch/x86/Makefile 1115 1003 all: bzImage 1116 1004 1117 1005 When "make" is executed without arguments, bzImage will be built. 1118 1006 1119 - --- 6.6 Building non-kbuild targets 1007 + 6.6 Building non-kbuild targets 1008 + ------------------------------- 1120 1009 1121 1010 extra-y 1122 - 1123 1011 extra-y specifies additional targets created in the current 1124 - directory, in addition to any targets specified by obj-*. 1012 + directory, in addition to any targets specified by `obj-*`. 1125 1013 1126 1014 Listing all targets in extra-y is required for two purposes: 1015 + 1127 1016 1) Enable kbuild to check changes in command lines 1017 + 1128 1018 - When $(call if_changed,xxx) is used 1019 + 1129 1020 2) kbuild knows what files to delete during "make clean" 1130 1021 1131 - Example: 1022 + Example:: 1023 + 1132 1024 #arch/x86/kernel/Makefile 1133 1025 extra-y := head.o init_task.o 1134 1026 ··· 1141 1023 shall be built, but shall not be linked as part of built-in.a. 1142 1024 1143 1025 1144 - --- 6.7 Commands useful for building a boot image 1026 + 6.7 Commands useful for building a boot image 1027 + --------------------------------------------- 1145 1028 1146 - Kbuild provides a few macros that are useful when building a 1147 - boot image. 1029 + Kbuild provides a few macros that are useful when building a 1030 + boot image. 1148 1031 1149 1032 if_changed 1150 - 1151 1033 if_changed is the infrastructure used for the following commands. 1152 1034 1153 - Usage: 1035 + Usage:: 1036 + 1154 1037 target: source(s) FORCE 1155 1038 $(call if_changed,ld/objcopy/gzip/...) 1156 1039 ··· 1169 1050 Note: It is a typical mistake to forget the FORCE prerequisite. 1170 1051 Another common pitfall is that whitespace is sometimes 1171 1052 significant; for instance, the below will fail (note the extra space 1172 - after the comma): 1173 - target: source(s) FORCE 1174 - #WRONG!# $(call if_changed, ld/objcopy/gzip/...) 1053 + after the comma):: 1175 1054 1176 - Note: if_changed should not be used more than once per target. 1055 + target: source(s) FORCE 1056 + 1057 + **WRONG!** $(call if_changed, ld/objcopy/gzip/...) 1058 + 1059 + Note: 1060 + if_changed should not be used more than once per target. 1177 1061 It stores the executed command in a corresponding .cmd 1062 + 1178 1063 file and multiple calls would result in overwrites and 1179 1064 unwanted results when the target is up to date and only the 1180 1065 tests on changed commands trigger execution of commands. ··· 1186 1063 ld 1187 1064 Link target. Often, LDFLAGS_$@ is used to set specific options to ld. 1188 1065 1189 - Example: 1066 + Example:: 1067 + 1190 1068 #arch/x86/boot/Makefile 1191 1069 LDFLAGS_bootsect := -Ttext 0x0 -s --oformat binary 1192 1070 LDFLAGS_setup := -Ttext 0x0 -s --oformat binary -e begtext ··· 1201 1077 LDFLAGS_$@ syntax - one for each potential target. 1202 1078 $(targets) are assigned all potential targets, by which kbuild knows 1203 1079 the targets and will: 1080 + 1204 1081 1) check for commandline changes 1205 1082 2) delete target during make clean 1206 1083 1207 1084 The ": %: %.o" part of the prerequisite is a shorthand that 1208 1085 frees us from listing the setup.o and bootsect.o files. 1209 - Note: It is a common mistake to forget the "targets :=" assignment, 1086 + 1087 + Note: 1088 + It is a common mistake to forget the "targets :=" assignment, 1210 1089 resulting in the target file being recompiled for no 1211 1090 obvious reason. 1212 1091 ··· 1221 1094 gzip 1222 1095 Compress target. Use maximum compression to compress target. 1223 1096 1224 - Example: 1097 + Example:: 1098 + 1225 1099 #arch/x86/boot/compressed/Makefile 1226 1100 $(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE 1227 1101 $(call if_changed,gzip) ··· 1233 1105 in an init section in the image. Platform code *must* copy the 1234 1106 blob to non-init memory prior to calling unflatten_device_tree(). 1235 1107 1236 - To use this command, simply add *.dtb into obj-y or targets, or make 1237 - some other target depend on %.dtb 1108 + To use this command, simply add `*.dtb` into obj-y or targets, or make 1109 + some other target depend on `%.dtb` 1238 1110 1239 - A central rule exists to create $(obj)/%.dtb from $(src)/%.dts; 1111 + A central rule exists to create `$(obj)/%.dtb` from `$(src)/%.dts`; 1240 1112 architecture Makefiles do no need to explicitly write out that rule. 1241 1113 1242 - Example: 1114 + Example:: 1115 + 1243 1116 targets += $(dtb-y) 1244 1117 DTC_FLAGS ?= -p 1024 1245 1118 1246 - --- 6.8 Custom kbuild commands 1119 + 6.8 Custom kbuild commands 1120 + -------------------------- 1247 1121 1248 1122 When kbuild is executing with KBUILD_VERBOSE=0, then only a shorthand 1249 1123 of a command is normally displayed. 1250 1124 To enable this behaviour for custom commands kbuild requires 1251 - two variables to be set: 1252 - quiet_cmd_<command> - what shall be echoed 1253 - cmd_<command> - the command to execute 1125 + two variables to be set:: 1254 1126 1255 - Example: 1127 + quiet_cmd_<command> - what shall be echoed 1128 + cmd_<command> - the command to execute 1129 + 1130 + Example:: 1131 + 1256 1132 # 1257 1133 quiet_cmd_image = BUILD $@ 1258 1134 cmd_image = $(obj)/tools/build $(BUILDFLAGS) \ ··· 1267 1135 $(call if_changed,image) 1268 1136 @echo 'Kernel: $@ is ready' 1269 1137 1270 - When updating the $(obj)/bzImage target, the line 1138 + When updating the $(obj)/bzImage target, the line: 1271 1139 1272 - BUILD arch/x86/boot/bzImage 1140 + BUILD arch/x86/boot/bzImage 1273 1141 1274 1142 will be displayed with "make KBUILD_VERBOSE=0". 1275 1143 ··· 1280 1148 arch/$(ARCH)/kernel/vmlinux.lds is used. 1281 1149 The script is a preprocessed variant of the file vmlinux.lds.S 1282 1150 located in the same directory. 1283 - kbuild knows .lds files and includes a rule *lds.S -> *lds. 1151 + kbuild knows .lds files and includes a rule `*lds.S` -> `*lds`. 1284 1152 1285 - Example: 1153 + Example:: 1154 + 1286 1155 #arch/x86/kernel/Makefile 1287 1156 always := vmlinux.lds 1288 1157 ··· 1295 1162 The assignment to $(CPPFLAGS_vmlinux.lds) tells kbuild to use the 1296 1163 specified options when building the target vmlinux.lds. 1297 1164 1298 - When building the *.lds target, kbuild uses the variables: 1299 - KBUILD_CPPFLAGS : Set in top-level Makefile 1300 - cppflags-y : May be set in the kbuild makefile 1301 - CPPFLAGS_$(@F) : Target-specific flags. 1302 - Note that the full filename is used in this 1303 - assignment. 1165 + When building the `*.lds` target, kbuild uses the variables:: 1304 1166 1305 - The kbuild infrastructure for *lds files is used in several 1167 + KBUILD_CPPFLAGS : Set in top-level Makefile 1168 + cppflags-y : May be set in the kbuild makefile 1169 + CPPFLAGS_$(@F) : Target-specific flags. 1170 + Note that the full filename is used in this 1171 + assignment. 1172 + 1173 + The kbuild infrastructure for `*lds` files is used in several 1306 1174 architecture-specific files. 1307 1175 1308 - --- 6.10 Generic header files 1176 + 6.10 Generic header files 1177 + ------------------------- 1309 1178 1310 1179 The directory include/asm-generic contains the header files 1311 1180 that may be shared between individual architectures. ··· 1315 1180 to list the file in the Kbuild file. 1316 1181 See "7.2 generic-y" for further info on syntax etc. 1317 1182 1318 - --- 6.11 Post-link pass 1183 + 6.11 Post-link pass 1184 + ------------------- 1319 1185 1320 1186 If the file arch/xxx/Makefile.postlink exists, this makefile 1321 1187 will be invoked for post-link objects (vmlinux and modules.ko) ··· 1331 1195 For example, powerpc uses this to check relocation sanity of 1332 1196 the linked vmlinux file. 1333 1197 1334 - === 7 Kbuild syntax for exported headers 1198 + 7 Kbuild syntax for exported headers 1199 + ------------------------------------ 1335 1200 1336 1201 The kernel includes a set of headers that is exported to userspace. 1337 1202 Many headers can be exported as-is but other headers require a 1338 1203 minimal pre-processing before they are ready for user-space. 1339 1204 The pre-processing does: 1205 + 1340 1206 - drop kernel-specific annotations 1341 1207 - drop include of compiler.h 1342 - - drop all sections that are kernel internal (guarded by ifdef __KERNEL__) 1208 + - drop all sections that are kernel internal (guarded by `ifdef __KERNEL__`) 1343 1209 1344 1210 All headers under include/uapi/, include/generated/uapi/, 1345 1211 arch/<arch>/include/uapi/ and arch/<arch>/include/generated/uapi/ ··· 1351 1213 arch/<arch>/include/asm/ to list asm files coming from asm-generic. 1352 1214 See subsequent chapter for the syntax of the Kbuild file. 1353 1215 1354 - --- 7.1 no-export-headers 1216 + 7.1 no-export-headers 1217 + --------------------- 1355 1218 1356 1219 no-export-headers is essentially used by include/uapi/linux/Kbuild to 1357 1220 avoid exporting specific headers (e.g. kvm.h) on architectures that do 1358 1221 not support it. It should be avoided as much as possible. 1359 1222 1360 - --- 7.2 generic-y 1223 + 7.2 generic-y 1224 + ------------- 1361 1225 1362 1226 If an architecture uses a verbatim copy of a header from 1363 1227 include/asm-generic then this is listed in the file 1364 1228 arch/$(ARCH)/include/asm/Kbuild like this: 1365 1229 1366 - Example: 1230 + Example:: 1231 + 1367 1232 #arch/x86/include/asm/Kbuild 1368 1233 generic-y += termios.h 1369 1234 generic-y += rtc.h 1370 1235 1371 1236 During the prepare phase of the build a wrapper include 1372 - file is generated in the directory: 1237 + file is generated in the directory:: 1373 1238 1374 1239 arch/$(ARCH)/include/generated/asm 1375 1240 1376 1241 When a header is exported where the architecture uses 1377 1242 the generic header a similar wrapper is generated as part 1378 - of the set of exported headers in the directory: 1243 + of the set of exported headers in the directory:: 1379 1244 1380 1245 usr/include/asm 1381 1246 1382 1247 The generated wrapper will in both cases look like the following: 1383 1248 1384 - Example: termios.h 1249 + Example: termios.h:: 1250 + 1385 1251 #include <asm-generic/termios.h> 1386 1252 1387 - --- 7.3 generated-y 1253 + 7.3 generated-y 1254 + --------------- 1388 1255 1389 1256 If an architecture generates other header files alongside generic-y 1390 1257 wrappers, generated-y specifies them. ··· 1397 1254 This prevents them being treated as stale asm-generic wrappers and 1398 1255 removed. 1399 1256 1400 - Example: 1257 + Example:: 1258 + 1401 1259 #arch/x86/include/asm/Kbuild 1402 1260 generated-y += syscalls_32.h 1403 1261 1404 - --- 7.4 mandatory-y 1262 + 7.4 mandatory-y 1263 + --------------- 1405 1264 1406 1265 mandatory-y is essentially used by include/(uapi/)asm-generic/Kbuild 1407 1266 to define the minimum set of ASM headers that all architectures must have. ··· 1415 1270 The convention is to list one subdir per line and 1416 1271 preferably in alphabetic order. 1417 1272 1418 - === 8 Kbuild Variables 1273 + 8 Kbuild Variables 1274 + ================== 1419 1275 1420 1276 The top Makefile exports the following variables: 1421 1277 1422 1278 VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION 1423 - 1424 1279 These variables define the current kernel version. A few arch 1425 1280 Makefiles actually use these values directly; they should use 1426 1281 $(KERNELRELEASE) instead. ··· 1434 1289 such as "-pre4", and is often blank. 1435 1290 1436 1291 KERNELRELEASE 1437 - 1438 1292 $(KERNELRELEASE) is a single string such as "2.4.0-pre4", suitable 1439 1293 for constructing installation directory names or showing in 1440 1294 version strings. Some arch Makefiles use it for this purpose. 1441 1295 1442 1296 ARCH 1443 - 1444 1297 This variable defines the target architecture, such as "i386", 1445 1298 "arm", or "sparc". Some kbuild Makefiles test $(ARCH) to 1446 1299 determine which files to compile. 1447 1300 1448 1301 By default, the top Makefile sets $(ARCH) to be the same as the 1449 1302 host system architecture. For a cross build, a user may 1450 - override the value of $(ARCH) on the command line: 1303 + override the value of $(ARCH) on the command line:: 1451 1304 1452 1305 make ARCH=m68k ... 1453 1306 1454 1307 1455 1308 INSTALL_PATH 1456 - 1457 1309 This variable defines a place for the arch Makefiles to install 1458 1310 the resident kernel image and System.map file. 1459 1311 Use this for architecture-specific install targets. 1460 1312 1461 1313 INSTALL_MOD_PATH, MODLIB 1462 - 1463 1314 $(INSTALL_MOD_PATH) specifies a prefix to $(MODLIB) for module 1464 1315 installation. This variable is not defined in the Makefile but 1465 1316 may be passed in by the user if desired. ··· 1466 1325 override this value on the command line if desired. 1467 1326 1468 1327 INSTALL_MOD_STRIP 1469 - 1470 1328 If this variable is specified, it will cause modules to be stripped 1471 1329 after they are installed. If INSTALL_MOD_STRIP is '1', then the 1472 1330 default option --strip-debug will be used. Otherwise, the ··· 1473 1333 command. 1474 1334 1475 1335 1476 - === 9 Makefile language 1336 + 9 Makefile language 1337 + =================== 1477 1338 1478 1339 The kernel Makefiles are designed to be run with GNU Make. The Makefiles 1479 1340 use only the documented features of GNU Make, but they do use many ··· 1493 1352 There are some cases where "=" is appropriate. Usually, though, ":=" 1494 1353 is the right choice. 1495 1354 1496 - === 10 Credits 1355 + 10 Credits 1356 + ========== 1497 1357 1498 - Original version made by Michael Elizabeth Chastain, <mailto:mec@shout.net> 1499 - Updates by Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de> 1500 - Updates by Sam Ravnborg <sam@ravnborg.org> 1501 - Language QA by Jan Engelhardt <jengelh@gmx.de> 1358 + - Original version made by Michael Elizabeth Chastain, <mailto:mec@shout.net> 1359 + - Updates by Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de> 1360 + - Updates by Sam Ravnborg <sam@ravnborg.org> 1361 + - Language QA by Jan Engelhardt <jengelh@gmx.de> 1502 1362 1503 - === 11 TODO 1363 + 11 TODO 1364 + ======= 1504 1365 1505 1366 - Describe how kbuild supports shipped files with _shipped. 1506 1367 - Generating offset header files. 1507 1368 - Add more variables to section 7? 1508 - 1509 - 1510 -
+99 -69
Documentation/kbuild/modules.txt Documentation/kbuild/modules.rst
··· 1 + ========================= 1 2 Building External Modules 3 + ========================= 2 4 3 5 This document describes how to build an out-of-tree kernel module. 4 6 5 - === Table of Contents 7 + .. Table of Contents 6 8 7 9 === 1 Introduction 8 10 === 2 How to Build External Modules ··· 33 31 34 32 35 33 36 - === 1. Introduction 34 + 1. Introduction 35 + =============== 37 36 38 37 "kbuild" is the build system used by the Linux kernel. Modules must use 39 38 kbuild to stay compatible with changes in the build infrastructure and ··· 51 48 section 3. 52 49 53 50 54 - === 2. How to Build External Modules 51 + 2. How to Build External Modules 52 + ================================ 55 53 56 54 To build external modules, you must have a prebuilt kernel available 57 55 that contains the configuration and header files used in the build. ··· 69 65 CONFIG_MODVERSIONS is set; therefore, a full kernel build needs to be 70 66 executed to make module versioning work. 71 67 72 - --- 2.1 Command Syntax 68 + 2.1 Command Syntax 69 + ================== 73 70 74 - The command to build an external module is: 71 + The command to build an external module is:: 75 72 76 73 $ make -C <path_to_kernel_src> M=$PWD 77 74 78 75 The kbuild system knows that an external module is being built 79 76 due to the "M=<dir>" option given in the command. 80 77 81 - To build against the running kernel use: 78 + To build against the running kernel use:: 82 79 83 80 $ make -C /lib/modules/`uname -r`/build M=$PWD 84 81 85 82 Then to install the module(s) just built, add the target 86 - "modules_install" to the command: 83 + "modules_install" to the command:: 87 84 88 85 $ make -C /lib/modules/`uname -r`/build M=$PWD modules_install 89 86 90 - --- 2.2 Options 87 + 2.2 Options 88 + =========== 91 89 92 90 ($KDIR refers to the path of the kernel source directory.) 93 91 ··· 106 100 directory where the external module (kbuild file) is 107 101 located. 108 102 109 - --- 2.3 Targets 103 + 2.3 Targets 104 + =========== 110 105 111 106 When building an external module, only a subset of the "make" 112 107 targets are available. ··· 137 130 help 138 131 List the available targets for external modules. 139 132 140 - --- 2.4 Building Separate Files 133 + 2.4 Building Separate Files 134 + =========================== 141 135 142 136 It is possible to build single files that are part of a module. 143 137 This works equally well for the kernel, a module, and even for 144 138 external modules. 145 139 146 - Example (The module foo.ko, consist of bar.o and baz.o): 140 + Example (The module foo.ko, consist of bar.o and baz.o):: 141 + 147 142 make -C $KDIR M=$PWD bar.lst 148 143 make -C $KDIR M=$PWD baz.o 149 144 make -C $KDIR M=$PWD foo.ko 150 145 make -C $KDIR M=$PWD ./ 151 146 152 147 153 - === 3. Creating a Kbuild File for an External Module 148 + 3. Creating a Kbuild File for an External Module 149 + ================================================ 154 150 155 151 In the last section we saw the command to build a module for the 156 152 running kernel. The module is not actually built, however, because a 157 153 build file is required. Contained in this file will be the name of 158 154 the module(s) being built, along with the list of requisite source 159 - files. The file may be as simple as a single line: 155 + files. The file may be as simple as a single line:: 160 156 161 157 obj-m := <module_name>.o 162 158 ··· 167 157 and, after linking, will result in the kernel module <module_name>.ko. 168 158 The above line can be put in either a "Kbuild" file or a "Makefile." 169 159 When the module is built from multiple sources, an additional line is 170 - needed listing the files: 160 + needed listing the files:: 171 161 172 162 <module_name>-y := <src1>.o <src2>.o ... 173 163 174 164 NOTE: Further documentation describing the syntax used by kbuild is 175 - located in Documentation/kbuild/makefiles.txt. 165 + located in Documentation/kbuild/makefiles.rst. 176 166 177 167 The examples below demonstrate how to create a build file for the 178 - module 8123.ko, which is built from the following files: 168 + module 8123.ko, which is built from the following files:: 179 169 180 170 8123_if.c 181 171 8123_if.h ··· 191 181 but should be filtered out from kbuild due to possible name 192 182 clashes. 193 183 194 - Example 1: 184 + Example 1:: 185 + 195 186 --> filename: Makefile 196 187 ifneq ($(KERNELRELEASE),) 197 188 # kbuild part of makefile ··· 220 209 line; the second pass is by the kbuild system, which is 221 210 initiated by the parameterized "make" in the default target. 222 211 223 - --- 3.2 Separate Kbuild File and Makefile 212 + 3.2 Separate Kbuild File and Makefile 213 + ------------------------------------- 224 214 225 215 In newer versions of the kernel, kbuild will first look for a 226 216 file named "Kbuild," and only if that is not found, will it 227 217 then look for a makefile. Utilizing a "Kbuild" file allows us 228 218 to split up the makefile from example 1 into two files: 229 219 230 - Example 2: 220 + Example 2:: 221 + 231 222 --> filename: Kbuild 232 223 obj-m := 8123.o 233 224 8123-y := 8123_if.o 8123_pci.o 8123_bin.o ··· 251 238 252 239 The next example shows a backward compatible version. 253 240 254 - Example 3: 241 + Example 3:: 242 + 255 243 --> filename: Kbuild 256 244 obj-m := 8123.o 257 245 8123-y := 8123_if.o 8123_pci.o 8123_bin.o ··· 280 266 makefiles, to be used when the "make" and kbuild parts are 281 267 split into separate files. 282 268 283 - --- 3.3 Binary Blobs 269 + 3.3 Binary Blobs 270 + ---------------- 284 271 285 272 Some external modules need to include an object file as a blob. 286 273 kbuild has support for this, but requires the blob file to be ··· 292 277 293 278 Throughout this section, 8123_bin.o_shipped has been used to 294 279 build the kernel module 8123.ko; it has been included as 295 - 8123_bin.o. 280 + 8123_bin.o:: 296 281 297 282 8123-y := 8123_if.o 8123_pci.o 8123_bin.o 298 283 ··· 300 285 files and the binary file, kbuild will pick up different rules 301 286 when creating the object file for the module. 302 287 303 - --- 3.4 Building Multiple Modules 288 + 3.4 Building Multiple Modules 289 + ============================= 304 290 305 291 kbuild supports building multiple modules with a single build 306 292 file. For example, if you wanted to build two modules, foo.ko 307 - and bar.ko, the kbuild lines would be: 293 + and bar.ko, the kbuild lines would be:: 308 294 309 295 obj-m := foo.o bar.o 310 296 foo-y := <foo_srcs> ··· 314 298 It is that simple! 315 299 316 300 317 - === 4. Include Files 301 + 4. Include Files 302 + ================ 318 303 319 304 Within the kernel, header files are kept in standard locations 320 305 according to the following rule: ··· 327 310 of the kernel that are located in different directories, then 328 311 the file is placed in include/linux/. 329 312 330 - NOTE: There are two notable exceptions to this rule: larger 331 - subsystems have their own directory under include/, such as 332 - include/scsi; and architecture specific headers are located 333 - under arch/$(ARCH)/include/. 313 + NOTE: 314 + There are two notable exceptions to this rule: larger 315 + subsystems have their own directory under include/, such as 316 + include/scsi; and architecture specific headers are located 317 + under arch/$(ARCH)/include/. 334 318 335 - --- 4.1 Kernel Includes 319 + 4.1 Kernel Includes 320 + ------------------- 336 321 337 322 To include a header file located under include/linux/, simply 338 - use: 323 + use:: 339 324 340 325 #include <linux/module.h> 341 326 342 327 kbuild will add options to "gcc" so the relevant directories 343 328 are searched. 344 329 345 - --- 4.2 Single Subdirectory 330 + 4.2 Single Subdirectory 331 + ----------------------- 346 332 347 333 External modules tend to place header files in a separate 348 334 include/ directory where their source is located, although this ··· 354 334 355 335 Using the example from section 3, if we moved 8123_if.h to a 356 336 subdirectory named include, the resulting kbuild file would 357 - look like: 337 + look like:: 358 338 359 339 --> filename: Kbuild 360 340 obj-m := 8123.o ··· 366 346 the path. This is a limitation of kbuild: there must be no 367 347 space present. 368 348 369 - --- 4.3 Several Subdirectories 349 + 4.3 Several Subdirectories 350 + -------------------------- 370 351 371 352 kbuild can handle files that are spread over several directories. 372 - Consider the following example: 353 + Consider the following example:: 373 354 374 - . 375 - |__ src 376 - | |__ complex_main.c 377 - | |__ hal 378 - | |__ hardwareif.c 379 - | |__ include 380 - | |__ hardwareif.h 381 - |__ include 382 - |__ complex.h 355 + . 356 + |__ src 357 + | |__ complex_main.c 358 + | |__ hal 359 + | |__ hardwareif.c 360 + | |__ include 361 + | |__ hardwareif.h 362 + |__ include 363 + |__ complex.h 383 364 384 365 To build the module complex.ko, we then need the following 385 - kbuild file: 366 + kbuild file:: 386 367 387 368 --> filename: Kbuild 388 369 obj-m := complex.o ··· 406 385 file is located. 407 386 408 387 409 - === 5. Module Installation 388 + 5. Module Installation 389 + ====================== 410 390 411 391 Modules which are included in the kernel are installed in the 412 392 directory: ··· 418 396 419 397 /lib/modules/$(KERNELRELEASE)/extra/ 420 398 421 - --- 5.1 INSTALL_MOD_PATH 399 + 5.1 INSTALL_MOD_PATH 400 + -------------------- 422 401 423 402 Above are the default directories but as always some level of 424 403 customization is possible. A prefix can be added to the 425 - installation path using the variable INSTALL_MOD_PATH: 404 + installation path using the variable INSTALL_MOD_PATH:: 426 405 427 406 $ make INSTALL_MOD_PATH=/frodo modules_install 428 407 => Install dir: /frodo/lib/modules/$(KERNELRELEASE)/kernel/ ··· 433 410 calling "make." This has effect when installing both in-tree 434 411 and out-of-tree modules. 435 412 436 - --- 5.2 INSTALL_MOD_DIR 413 + 5.2 INSTALL_MOD_DIR 414 + ------------------- 437 415 438 416 External modules are by default installed to a directory under 439 417 /lib/modules/$(KERNELRELEASE)/extra/, but you may wish to 440 418 locate modules for a specific functionality in a separate 441 419 directory. For this purpose, use INSTALL_MOD_DIR to specify an 442 - alternative name to "extra." 420 + alternative name to "extra.":: 443 421 444 422 $ make INSTALL_MOD_DIR=gandalf -C $KDIR \ 445 423 M=$PWD modules_install 446 424 => Install dir: /lib/modules/$(KERNELRELEASE)/gandalf/ 447 425 448 426 449 - === 6. Module Versioning 427 + 6. Module Versioning 428 + ==================== 450 429 451 430 Module versioning is enabled by the CONFIG_MODVERSIONS tag, and is used 452 431 as a simple ABI consistency check. A CRC value of the full prototype ··· 460 435 Module.symvers contains a list of all exported symbols from a kernel 461 436 build. 462 437 463 - --- 6.1 Symbols From the Kernel (vmlinux + modules) 438 + 6.1 Symbols From the Kernel (vmlinux + modules) 439 + ----------------------------------------------- 464 440 465 441 During a kernel build, a file named Module.symvers will be 466 442 generated. Module.symvers contains all exported symbols from 467 443 the kernel and compiled modules. For each symbol, the 468 444 corresponding CRC value is also stored. 469 445 470 - The syntax of the Module.symvers file is: 446 + The syntax of the Module.symvers file is:: 447 + 471 448 <CRC> <Symbol> <module> 472 449 473 450 0x2d036834 scsi_remove_host drivers/scsi/scsi_mod ··· 478 451 would read 0x00000000. 479 452 480 453 Module.symvers serves two purposes: 454 + 481 455 1) It lists all exported symbols from vmlinux and all modules. 482 456 2) It lists the CRC if CONFIG_MODVERSIONS is enabled. 483 457 484 - --- 6.2 Symbols and External Modules 458 + 6.2 Symbols and External Modules 459 + -------------------------------- 485 460 486 461 When building an external module, the build system needs access 487 462 to the symbols from the kernel to check if all external symbols ··· 510 481 foo.ko needs symbols from bar.ko, you can use a 511 482 common top-level kbuild file so both modules are 512 483 compiled in the same build. Consider the following 513 - directory layout: 484 + directory layout:: 514 485 515 - ./foo/ <= contains foo.ko 516 - ./bar/ <= contains bar.ko 486 + ./foo/ <= contains foo.ko 487 + ./bar/ <= contains bar.ko 517 488 518 - The top-level kbuild file would then look like: 489 + The top-level kbuild file would then look like:: 519 490 520 - #./Kbuild (or ./Makefile): 521 - obj-y := foo/ bar/ 491 + #./Kbuild (or ./Makefile): 492 + obj-y := foo/ bar/ 522 493 523 - And executing 494 + And executing:: 524 495 525 496 $ make -C $KDIR M=$PWD 526 497 ··· 547 518 initialization of its symbol tables. 548 519 549 520 550 - === 7. Tips & Tricks 521 + 7. Tips & Tricks 522 + ================ 551 523 552 - --- 7.1 Testing for CONFIG_FOO_BAR 524 + 7.1 Testing for CONFIG_FOO_BAR 525 + ------------------------------ 553 526 554 - Modules often need to check for certain CONFIG_ options to 527 + Modules often need to check for certain `CONFIG_` options to 555 528 decide if a specific feature is included in the module. In 556 - kbuild this is done by referencing the CONFIG_ variable 557 - directly. 529 + kbuild this is done by referencing the `CONFIG_` variable 530 + directly:: 558 531 559 532 #fs/ext2/Makefile 560 533 obj-$(CONFIG_EXT2_FS) += ext2.o ··· 565 534 ext2-$(CONFIG_EXT2_FS_XATTR) += xattr.o 566 535 567 536 External modules have traditionally used "grep" to check for 568 - specific CONFIG_ settings directly in .config. This usage is 537 + specific `CONFIG_` settings directly in .config. This usage is 569 538 broken. As introduced before, external modules should use 570 539 kbuild for building and can therefore use the same methods as 571 - in-tree modules when testing for CONFIG_ definitions. 572 - 540 + in-tree modules when testing for `CONFIG_` definitions.
+2 -2
Documentation/kernel-hacking/hacking.rst
··· 718 718 - Usually you want a configuration option for your kernel hack. Edit 719 719 ``Kconfig`` in the appropriate directory. The Config language is 720 720 simple to use by cut and paste, and there's complete documentation in 721 - ``Documentation/kbuild/kconfig-language.txt``. 721 + ``Documentation/kbuild/kconfig-language.rst``. 722 722 723 723 In your description of the option, make sure you address both the 724 724 expert user and the user who knows nothing about your feature. ··· 728 728 729 729 - Edit the ``Makefile``: the CONFIG variables are exported here so you 730 730 can usually just add a "obj-$(CONFIG_xxx) += xxx.o" line. The syntax 731 - is documented in ``Documentation/kbuild/makefiles.txt``. 731 + is documented in ``Documentation/kbuild/makefiles.rst``. 732 732 733 733 - Put yourself in ``CREDITS`` if you've done something noteworthy, 734 734 usually beyond a single file (your name should be at the top of the
+1 -1
Documentation/process/coding-style.rst
··· 686 686 ... 687 687 688 688 For full documentation on the configuration files, see the file 689 - Documentation/kbuild/kconfig-language.txt. 689 + Documentation/kbuild/kconfig-language.rst. 690 690 691 691 692 692 11) Data structures
+1 -1
Documentation/process/submit-checklist.rst
··· 39 39 40 40 6) Any new or modified ``CONFIG`` options do not muck up the config menu and 41 41 default to off unless they meet the exception criteria documented in 42 - ``Documentation/kbuild/kconfig-language.txt`` Menu attributes: default value. 42 + ``Documentation/kbuild/kconfig-language.rst`` Menu attributes: default value. 43 43 44 44 7) All new ``Kconfig`` options have help text. 45 45
+2 -2
Documentation/translations/it_IT/kernel-hacking/hacking.rst
··· 755 755 - Solitamente vorrete un'opzione di configurazione per la vostra modifica 756 756 al kernel. Modificate ``Kconfig`` nella cartella giusta. Il linguaggio 757 757 Config è facile con copia ed incolla, e c'è una completa documentazione 758 - nel file ``Documentation/kbuild/kconfig-language.txt``. 758 + nel file ``Documentation/kbuild/kconfig-language.rst``. 759 759 760 760 Nella descrizione della vostra opzione, assicuratevi di parlare sia agli 761 761 utenti esperti sia agli utente che non sanno nulla del vostro lavoro. ··· 767 767 - Modificate il file ``Makefile``: le variabili CONFIG sono esportate qui, 768 768 quindi potete solitamente aggiungere una riga come la seguete 769 769 "obj-$(CONFIG_xxx) += xxx.o". La sintassi è documentata nel file 770 - ``Documentation/kbuild/makefiles.txt``. 770 + ``Documentation/kbuild/makefiles.rst``. 771 771 772 772 - Aggiungete voi stessi in ``CREDITS`` se avete fatto qualcosa di notevole, 773 773 solitamente qualcosa che supera il singolo file (comunque il vostro nome
+1 -1
Documentation/translations/it_IT/process/coding-style.rst
··· 696 696 ... 697 697 698 698 Per la documentazione completa sui file di configurazione, consultate 699 - il documento Documentation/kbuild/kconfig-language.txt 699 + il documento Documentation/kbuild/kconfig-language.rst 700 700 701 701 702 702 11) Strutture dati
+1 -1
Documentation/translations/it_IT/process/submit-checklist.rst
··· 43 43 44 44 6) Le opzioni ``CONFIG``, nuove o modificate, non scombussolano il menu 45 45 di configurazione e sono preimpostate come disabilitate a meno che non 46 - soddisfino i criteri descritti in ``Documentation/kbuild/kconfig-language.txt`` 46 + soddisfino i criteri descritti in ``Documentation/kbuild/kconfig-language.rst`` 47 47 alla punto "Voci di menu: valori predefiniti". 48 48 49 49 7) Tutte le nuove opzioni ``Kconfig`` hanno un messaggio di aiuto.
+1 -1
Documentation/translations/zh_CN/process/coding-style.rst
··· 599 599 depends on ADFS_FS 600 600 ... 601 601 602 - 要查看配置文件的完整文档,请看 Documentation/kbuild/kconfig-language.txt。 602 + 要查看配置文件的完整文档,请看 Documentation/kbuild/kconfig-language.rst。 603 603 604 604 605 605 11) 数据结构
+1 -1
Documentation/translations/zh_CN/process/submit-checklist.rst
··· 38 38 违规行为。 39 39 40 40 6) 任何新的或修改过的 ``CONFIG`` 选项都不会弄脏配置菜单,并默认为关闭,除非 41 - 它们符合 ``Documentation/kbuild/kconfig-language.txt`` 中记录的异常条件, 41 + 它们符合 ``Documentation/kbuild/kconfig-language.rst`` 中记录的异常条件, 42 42 菜单属性:默认值. 43 43 44 44 7) 所有新的 ``kconfig`` 选项都有帮助文本。
+1 -1
Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 # 3 3 # For a description of the syntax of this configuration file, 4 - # see Documentation/kbuild/kconfig-language.txt. 4 + # see Documentation/kbuild/kconfig-language.rst. 5 5 # 6 6 mainmenu "Linux/$(ARCH) $(KERNELVERSION) Kernel Configuration" 7 7
+1 -1
arch/arc/plat-eznps/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 # 3 3 # For a description of the syntax of this configuration file, 4 - # see Documentation/kbuild/kconfig-language.txt. 4 + # see Documentation/kbuild/kconfig-language.rst. 5 5 # 6 6 7 7 menuconfig ARC_PLAT_EZNPS
+1 -1
arch/c6x/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 # 3 3 # For a description of the syntax of this configuration file, 4 - # see Documentation/kbuild/kconfig-language.txt. 4 + # see Documentation/kbuild/kconfig-language.rst. 5 5 # 6 6 7 7 config C6X
+1 -1
arch/microblaze/Kconfig.debug
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 # For a description of the syntax of this configuration file, 3 - # see Documentation/kbuild/kconfig-language.txt. 3 + # see Documentation/kbuild/kconfig-language.rst. 4 4 5 5 config TRACE_IRQFLAGS_SUPPORT 6 6 def_bool y
+1 -1
arch/microblaze/Kconfig.platform
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 # For a description of the syntax of this configuration file, 3 - # see Documentation/kbuild/kconfig-language.txt. 3 + # see Documentation/kbuild/kconfig-language.rst. 4 4 # 5 5 # Platform selection Kconfig menu for MicroBlaze targets 6 6 #
+1 -1
arch/nds32/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 # 3 3 # For a description of the syntax of this configuration file, 4 - # see Documentation/kbuild/kconfig-language.txt. 4 + # see Documentation/kbuild/kconfig-language.rst. 5 5 # 6 6 7 7 config NDS32
+1 -1
arch/openrisc/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 # 3 3 # For a description of the syntax of this configuration file, 4 - # see Documentation/kbuild/kconfig-language.txt. 4 + # see Documentation/kbuild/kconfig-language.rst. 5 5 # 6 6 7 7 config OPENRISC
+1 -1
arch/powerpc/sysdev/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 # For a description of the syntax of this configuration file, 3 - # see Documentation/kbuild/kconfig-language.txt. 3 + # see Documentation/kbuild/kconfig-language.rst. 4 4 # 5 5 6 6 config PPC4xx_PCI_EXPRESS
+1 -1
arch/riscv/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 # 3 3 # For a description of the syntax of this configuration file, 4 - # see Documentation/kbuild/kconfig-language.txt. 4 + # see Documentation/kbuild/kconfig-language.rst. 5 5 # 6 6 7 7 config 64BIT
+1 -1
drivers/auxdisplay/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 # 3 3 # For a description of the syntax of this configuration file, 4 - # see Documentation/kbuild/kconfig-language.txt. 4 + # see Documentation/kbuild/kconfig-language.rst. 5 5 # 6 6 # Auxiliary display drivers configuration. 7 7 #
+1 -1
drivers/firmware/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 # 3 3 # For a description of the syntax of this configuration file, 4 - # see Documentation/kbuild/kconfig-language.txt. 4 + # see Documentation/kbuild/kconfig-language.rst. 5 5 # 6 6 7 7 menu "Firmware Drivers"
+1 -1
drivers/mtd/devices/Kconfig
··· 48 48 49 49 If you want to compile this driver as a module ( = code which can be 50 50 inserted in and removed from the running kernel whenever you want), 51 - say M here and read <file:Documentation/kbuild/modules.txt>. 51 + say M here and read <file:Documentation/kbuild/modules.rst>. 52 52 The module will be called ms02-nv. 53 53 54 54 config MTD_DATAFLASH
+3 -3
drivers/net/ethernet/smsc/Kconfig
··· 49 49 This driver is also available as a module ( = code which can be 50 50 inserted in and removed from the running kernel whenever you want). 51 51 The module will be called smc91x. If you want to compile it as a 52 - module, say M here and read <file:Documentation/kbuild/modules.txt>. 52 + module, say M here and read <file:Documentation/kbuild/modules.rst>. 53 53 54 54 config PCMCIA_SMC91C92 55 55 tristate "SMC 91Cxx PCMCIA support" ··· 86 86 87 87 This driver is also available as a module. The module will be 88 88 called smc911x. If you want to compile it as a module, say M 89 - here and read <file:Documentation/kbuild/modules.txt> 89 + here and read <file:Documentation/kbuild/modules.rst> 90 90 91 91 config SMSC911X 92 92 tristate "SMSC LAN911x/LAN921x families embedded ethernet support" ··· 121 121 122 122 This driver is also available as a module. The module will be 123 123 called smsc9420. If you want to compile it as a module, say M 124 - here and read <file:Documentation/kbuild/modules.txt> 124 + here and read <file:Documentation/kbuild/modules.rst> 125 125 126 126 endif # NET_VENDOR_SMSC
+2 -2
drivers/net/wireless/intel/iwlegacy/Kconfig
··· 32 32 33 33 If you want to compile the driver as a module ( = code which can be 34 34 inserted in and removed from the running kernel whenever you want), 35 - say M here and read <file:Documentation/kbuild/modules.txt>. The 35 + say M here and read <file:Documentation/kbuild/modules.rst>. The 36 36 module will be called iwl4965. 37 37 38 38 config IWL3945 ··· 58 58 59 59 If you want to compile the driver as a module ( = code which can be 60 60 inserted in and removed from the running kernel whenever you want), 61 - say M here and read <file:Documentation/kbuild/modules.txt>. The 61 + say M here and read <file:Documentation/kbuild/modules.rst>. The 62 62 module will be called iwl3945. 63 63 64 64 menu "iwl3945 / iwl4965 Debugging Options"
+1 -1
drivers/net/wireless/intel/iwlwifi/Kconfig
··· 40 40 41 41 If you want to compile the driver as a module ( = code which can be 42 42 inserted in and removed from the running kernel whenever you want), 43 - say M here and read <file:Documentation/kbuild/modules.txt>. The 43 + say M here and read <file:Documentation/kbuild/modules.rst>. The 44 44 module will be called iwlwifi. 45 45 46 46 if IWLWIFI
+1 -1
drivers/parport/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 # 3 3 # For a description of the syntax of this configuration file, 4 - # see Documentation/kbuild/kconfig-language.txt. 4 + # see Documentation/kbuild/kconfig-language.rst. 5 5 # 6 6 # Parport configuration. 7 7 #
+2 -2
drivers/scsi/Kconfig
··· 183 183 184 184 If you want to compile this as a module ( = code which can be 185 185 inserted in and removed from the running kernel whenever you want), 186 - say M here and read <file:Documentation/kbuild/modules.txt> and 186 + say M here and read <file:Documentation/kbuild/modules.rst> and 187 187 <file:Documentation/scsi/scsi.txt>. The module will be called ch.o. 188 188 If unsure, say N. 189 189 ··· 1474 1474 1475 1475 This driver is also available as a module. This module will be 1476 1476 called zfcp. If you want to compile it as a module, say M here 1477 - and read <file:Documentation/kbuild/modules.txt>. 1477 + and read <file:Documentation/kbuild/modules.rst>. 1478 1478 1479 1479 config SCSI_PMCRAID 1480 1480 tristate "PMC SIERRA Linux MaxRAID adapter support"
+1 -1
drivers/staging/sm750fb/Kconfig
··· 12 12 13 13 This driver is also available as a module. The module will be 14 14 called sm750fb. If you want to compile it as a module, say M 15 - here and read <file:Documentation/kbuild/modules.txt>. 15 + here and read <file:Documentation/kbuild/modules.rst>.
+2 -2
drivers/usb/misc/Kconfig
··· 16 16 This code is also available as a module ( = code which can be 17 17 inserted in and removed from the running kernel whenever you want). 18 18 The module will be called audio. If you want to compile it as a 19 - module, say M here and read <file:Documentation/kbuild/modules.txt>. 19 + module, say M here and read <file:Documentation/kbuild/modules.rst>. 20 20 21 21 config USB_EMI26 22 22 tristate "EMI 2|6 USB Audio interface support" ··· 67 67 inserted in and removed from the running kernel whenever you want). 68 68 The module will be called legousbtower. If you want to compile it as 69 69 a module, say M here and read 70 - <file:Documentation/kbuild/modules.txt>. 70 + <file:Documentation/kbuild/modules.rst>. 71 71 72 72 config USB_LCD 73 73 tristate "USB LCD driver support"
+7 -7
drivers/video/fbdev/Kconfig
··· 289 289 290 290 If you want to compile this as a module (=code which can be 291 291 inserted into and removed from the running kernel), say M 292 - here and read <file:Documentation/kbuild/modules.txt>. The module 292 + here and read <file:Documentation/kbuild/modules.rst>. The module 293 293 will be called amba-clcd. 294 294 295 295 config FB_ACORN ··· 1752 1752 This driver is also available as a module ( = code which can be 1753 1753 inserted and removed from the running kernel whenever you want). The 1754 1754 module will be called pxafb. If you want to compile it as a module, 1755 - say M here and read <file:Documentation/kbuild/modules.txt>. 1755 + say M here and read <file:Documentation/kbuild/modules.rst>. 1756 1756 1757 1757 If unsure, say N. 1758 1758 ··· 1833 1833 This driver is also available as a module ( = code which can be 1834 1834 inserted and removed from the running kernel whenever you want). The 1835 1835 module will be called w100fb. If you want to compile it as a module, 1836 - say M here and read <file:Documentation/kbuild/modules.txt>. 1836 + say M here and read <file:Documentation/kbuild/modules.rst>. 1837 1837 1838 1838 If unsure, say N. 1839 1839 ··· 1862 1862 This driver is also available as a module ( = code which can be 1863 1863 inserted and removed from the running kernel whenever you want). The 1864 1864 module will be called tmiofb. If you want to compile it as a module, 1865 - say M here and read <file:Documentation/kbuild/modules.txt>. 1865 + say M here and read <file:Documentation/kbuild/modules.rst>. 1866 1866 1867 1867 If unsure, say N. 1868 1868 ··· 1908 1908 This driver is also available as a module ( = code which can be 1909 1909 inserted and removed from the running kernel whenever you want). The 1910 1910 module will be called s3c2410fb. If you want to compile it as a module, 1911 - say M here and read <file:Documentation/kbuild/modules.txt>. 1911 + say M here and read <file:Documentation/kbuild/modules.rst>. 1912 1912 1913 1913 If unsure, say N. 1914 1914 config FB_S3C2410_DEBUG ··· 1945 1945 This driver is also available as a module ( = code which can be 1946 1946 inserted and removed from the running kernel whenever you want). The 1947 1947 module will be called sm501fb. If you want to compile it as a module, 1948 - say M here and read <file:Documentation/kbuild/modules.txt>. 1948 + say M here and read <file:Documentation/kbuild/modules.rst>. 1949 1949 1950 1950 If unsure, say N. 1951 1951 ··· 2288 2288 2289 2289 This driver is also available as a module. The module will be 2290 2290 called sm712fb. If you want to compile it as a module, say M 2291 - here and read <file:Documentation/kbuild/modules.txt>. 2291 + here and read <file:Documentation/kbuild/modules.rst>. 2292 2292 2293 2293 source "drivers/video/fbdev/omap/Kconfig" 2294 2294 source "drivers/video/fbdev/omap2/Kconfig"
+1 -1
net/bridge/netfilter/Kconfig
··· 114 114 equivalent of the iptables limit match. 115 115 116 116 If you want to compile it as a module, say M here and read 117 - <file:Documentation/kbuild/modules.txt>. If unsure, say `N'. 117 + <file:Documentation/kbuild/modules.rst>. If unsure, say `N'. 118 118 119 119 config BRIDGE_EBT_MARK 120 120 tristate "ebt: mark filter support"
+1 -1
net/ipv4/netfilter/Kconfig
··· 308 308 and OUTPUT chains. 309 309 310 310 If you want to compile it as a module, say M here and read 311 - <file:Documentation/kbuild/modules.txt>. If unsure, say `N'. 311 + <file:Documentation/kbuild/modules.rst>. If unsure, say `N'. 312 312 313 313 # security table for MAC policy 314 314 config IP_NF_SECURITY
+1 -1
net/ipv6/netfilter/Kconfig
··· 241 241 and OUTPUT chains. 242 242 243 243 If you want to compile it as a module, say M here and read 244 - <file:Documentation/kbuild/modules.txt>. If unsure, say `N'. 244 + <file:Documentation/kbuild/modules.rst>. If unsure, say `N'. 245 245 246 246 # security table for MAC policy 247 247 config IP6_NF_SECURITY
+8 -8
net/netfilter/Kconfig
··· 1056 1056 the tables, chains, rules. 1057 1057 1058 1058 If you want to compile it as a module, say M here and read 1059 - <file:Documentation/kbuild/modules.txt>. If unsure, say `N'. 1059 + <file:Documentation/kbuild/modules.rst>. If unsure, say `N'. 1060 1060 1061 1061 config NETFILTER_XT_TARGET_SECMARK 1062 1062 tristate '"SECMARK" target support' ··· 1115 1115 eg. UNICAST, LOCAL, BROADCAST, ... 1116 1116 1117 1117 If you want to compile it as a module, say M here and read 1118 - <file:Documentation/kbuild/modules.txt>. If unsure, say `N'. 1118 + <file:Documentation/kbuild/modules.rst>. If unsure, say `N'. 1119 1119 1120 1120 config NETFILTER_XT_MATCH_BPF 1121 1121 tristate '"bpf" match support' ··· 1160 1160 comments in your iptables ruleset. 1161 1161 1162 1162 If you want to compile it as a module, say M here and read 1163 - <file:Documentation/kbuild/modules.txt>. If unsure, say `N'. 1163 + <file:Documentation/kbuild/modules.rst>. If unsure, say `N'. 1164 1164 1165 1165 config NETFILTER_XT_MATCH_CONNBYTES 1166 1166 tristate '"connbytes" per-connection counter match support' ··· 1171 1171 number of bytes and/or packets for each direction within a connection. 1172 1172 1173 1173 If you want to compile it as a module, say M here and read 1174 - <file:Documentation/kbuild/modules.txt>. If unsure, say `N'. 1174 + <file:Documentation/kbuild/modules.rst>. If unsure, say `N'. 1175 1175 1176 1176 config NETFILTER_XT_MATCH_CONNLABEL 1177 1177 tristate '"connlabel" match support' ··· 1237 1237 and DCCP flags. 1238 1238 1239 1239 If you want to compile it as a module, say M here and read 1240 - <file:Documentation/kbuild/modules.txt>. If unsure, say `N'. 1240 + <file:Documentation/kbuild/modules.rst>. If unsure, say `N'. 1241 1241 1242 1242 config NETFILTER_XT_MATCH_DEVGROUP 1243 1243 tristate '"devgroup" match support' ··· 1473 1473 byte counter. 1474 1474 1475 1475 If you want to compile it as a module, say M here and read 1476 - <file:Documentation/kbuild/modules.txt>. If unsure, say `N'. 1476 + <file:Documentation/kbuild/modules.rst>. If unsure, say `N'. 1477 1477 1478 1478 config NETFILTER_XT_MATCH_RATEEST 1479 1479 tristate '"rateest" match support' ··· 1497 1497 in tc world. 1498 1498 1499 1499 If you want to compile it as a module, say M here and read 1500 - <file:Documentation/kbuild/modules.txt>. If unsure, say `N'. 1500 + <file:Documentation/kbuild/modules.rst>. If unsure, say `N'. 1501 1501 1502 1502 config NETFILTER_XT_MATCH_RECENT 1503 1503 tristate '"recent" match support' ··· 1519 1519 and SCTP chunk types. 1520 1520 1521 1521 If you want to compile it as a module, say M here and read 1522 - <file:Documentation/kbuild/modules.txt>. If unsure, say `N'. 1522 + <file:Documentation/kbuild/modules.rst>. If unsure, say `N'. 1523 1523 1524 1524 config NETFILTER_XT_MATCH_SOCKET 1525 1525 tristate '"socket" match support'
+1 -1
net/tipc/Kconfig
··· 17 17 This protocol support is also available as a module ( = code which 18 18 can be inserted in and removed from the running kernel whenever you 19 19 want). The module will be called tipc. If you want to compile it 20 - as a module, say M here and read <file:Documentation/kbuild/modules.txt>. 20 + as a module, say M here and read <file:Documentation/kbuild/modules.rst>. 21 21 22 22 If in doubt, say N. 23 23
+2 -2
scripts/Kbuild.include
··· 68 68 69 69 ###### 70 70 # gcc support functions 71 - # See documentation in Documentation/kbuild/makefiles.txt 71 + # See documentation in Documentation/kbuild/makefiles.rst 72 72 73 73 # cc-cross-prefix 74 74 # Usage: CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu- m68k-linux-) ··· 210 210 # if_changed_dep - as if_changed, but uses fixdep to reveal dependencies 211 211 # including used config symbols 212 212 # if_changed_rule - as if_changed but execute rule instead 213 - # See Documentation/kbuild/makefiles.txt for more info 213 + # See Documentation/kbuild/makefiles.rst for more info 214 214 215 215 ifneq ($(KBUILD_NOCMDDEP),1) 216 216 # Check if both arguments are the same including their order. Result is empty
+1 -1
scripts/Makefile.host
··· 6 6 # 7 7 # Both C and C++ are supported, but preferred language is C for such utilities. 8 8 # 9 - # Sample syntax (see Documentation/kbuild/makefiles.txt for reference) 9 + # Sample syntax (see Documentation/kbuild/makefiles.rst for reference) 10 10 # hostprogs-y := bin2hex 11 11 # Will compile bin2hex.c and create an executable named bin2hex 12 12 #
+1 -1
scripts/kconfig/symbol.c
··· 1114 1114 } 1115 1115 1116 1116 fprintf(stderr, 1117 - "For a resolution refer to Documentation/kbuild/kconfig-language.txt\n" 1117 + "For a resolution refer to Documentation/kbuild/kconfig-language.rst\n" 1118 1118 "subsection \"Kconfig recursive dependency limitations\"\n" 1119 1119 "\n"); 1120 1120
+7 -7
scripts/kconfig/tests/err_recursive_dep/expected_stderr
··· 1 1 Kconfig:11:error: recursive dependency detected! 2 2 Kconfig:11: symbol B is selected by B 3 - For a resolution refer to Documentation/kbuild/kconfig-language.txt 3 + For a resolution refer to Documentation/kbuild/kconfig-language.rst 4 4 subsection "Kconfig recursive dependency limitations" 5 5 6 6 Kconfig:5:error: recursive dependency detected! 7 7 Kconfig:5: symbol A depends on A 8 - For a resolution refer to Documentation/kbuild/kconfig-language.txt 8 + For a resolution refer to Documentation/kbuild/kconfig-language.rst 9 9 subsection "Kconfig recursive dependency limitations" 10 10 11 11 Kconfig:17:error: recursive dependency detected! 12 12 Kconfig:17: symbol C1 depends on C2 13 13 Kconfig:21: symbol C2 depends on C1 14 - For a resolution refer to Documentation/kbuild/kconfig-language.txt 14 + For a resolution refer to Documentation/kbuild/kconfig-language.rst 15 15 subsection "Kconfig recursive dependency limitations" 16 16 17 17 Kconfig:32:error: recursive dependency detected! 18 18 Kconfig:32: symbol D2 is selected by D1 19 19 Kconfig:27: symbol D1 depends on D2 20 - For a resolution refer to Documentation/kbuild/kconfig-language.txt 20 + For a resolution refer to Documentation/kbuild/kconfig-language.rst 21 21 subsection "Kconfig recursive dependency limitations" 22 22 23 23 Kconfig:37:error: recursive dependency detected! 24 24 Kconfig:37: symbol E1 depends on E2 25 25 Kconfig:42: symbol E2 is implied by E1 26 - For a resolution refer to Documentation/kbuild/kconfig-language.txt 26 + For a resolution refer to Documentation/kbuild/kconfig-language.rst 27 27 subsection "Kconfig recursive dependency limitations" 28 28 29 29 Kconfig:60:error: recursive dependency detected! 30 30 Kconfig:60: symbol G depends on G 31 - For a resolution refer to Documentation/kbuild/kconfig-language.txt 31 + For a resolution refer to Documentation/kbuild/kconfig-language.rst 32 32 subsection "Kconfig recursive dependency limitations" 33 33 34 34 Kconfig:51:error: recursive dependency detected! 35 35 Kconfig:51: symbol F2 depends on F1 36 36 Kconfig:49: symbol F1 default value contains F2 37 - For a resolution refer to Documentation/kbuild/kconfig-language.txt 37 + For a resolution refer to Documentation/kbuild/kconfig-language.rst 38 38 subsection "Kconfig recursive dependency limitations"
+3 -3
sound/oss/dmasound/Kconfig
··· 11 11 This driver is also available as a module ( = code which can be 12 12 inserted in and removed from the running kernel whenever you 13 13 want). If you want to compile it as a module, say M here and read 14 - <file:Documentation/kbuild/modules.txt>. 14 + <file:Documentation/kbuild/modules.rst>. 15 15 16 16 config DMASOUND_PAULA 17 17 tristate "Amiga DMA sound support" ··· 25 25 This driver is also available as a module ( = code which can be 26 26 inserted in and removed from the running kernel whenever you 27 27 want). If you want to compile it as a module, say M here and read 28 - <file:Documentation/kbuild/modules.txt>. 28 + <file:Documentation/kbuild/modules.rst>. 29 29 30 30 config DMASOUND_Q40 31 31 tristate "Q40 sound support" ··· 39 39 This driver is also available as a module ( = code which can be 40 40 inserted in and removed from the running kernel whenever you 41 41 want). If you want to compile it as a module, say M here and read 42 - <file:Documentation/kbuild/modules.txt>. 42 + <file:Documentation/kbuild/modules.rst>. 43 43 44 44 config DMASOUND 45 45 tristate