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