Commit cd238eff authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab Committed by Jonathan Corbet

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

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

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

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

At its new index.rst, let's add a :orphan: while this is not linked to
the main index.rst file, in order to avoid build warnings.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent d7b461c5
......@@ -227,7 +227,7 @@ Configuring the kernel
"make tinyconfig" Configure the tiniest possible kernel.
You can find more information on using the Linux kernel config tools
in Documentation/kbuild/kconfig.txt.
in Documentation/kbuild/kconfig.rst.
- NOTES on ``make config``:
......
=============================================
Exporting kernel headers for use by userspace
=============================================
......@@ -22,14 +23,14 @@ older kernel.
The "make headers_install" command can be run in the top level directory of the
kernel source code (or using a standard out-of-tree build). It takes two
optional arguments:
optional arguments::
make headers_install ARCH=i386 INSTALL_HDR_PATH=/usr
ARCH indicates which architecture to produce headers for, and defaults to the
current architecture. The linux/asm directory of the exported kernel headers
is platform-specific, to see a complete list of supported architectures use
the command:
the command::
ls -d include/asm-* | sed 's/.*-//'
......
:orphan:
===================
Kernel Build System
===================
.. toctree::
:maxdepth: 1
kconfig-language
kconfig-macro-language
kbuild
kconfig
makefiles
modules
headers_install
issues
.. only:: subproject and html
Indices
=======
* :ref:`genindex`
Recursion issue #1
------------------
.. include:: Kconfig.recursion-issue-01
:literal:
Recursion issue #2
------------------
.. include:: Kconfig.recursion-issue-02
:literal:
======
Kbuild
======
Output files
============
modules.order
--------------------------------------------------
-------------
This file records the order in which modules appear in Makefiles. This
is used by modprobe to deterministically resolve aliases that match
multiple modules.
modules.builtin
--------------------------------------------------
---------------
This file lists all modules that are built into the kernel. This is used
by modprobe to not fail when trying to load something builtin.
......@@ -18,84 +24,90 @@ Unlike modinfo of a separate module, all fields are prefixed with module name.
Environment variables
=====================
KCPPFLAGS
--------------------------------------------------
---------
Additional options to pass when preprocessing. The preprocessing options
will be used in all cases where kbuild does preprocessing including
building C files and assembler files.
KAFLAGS
--------------------------------------------------
-------
Additional options to the assembler (for built-in and modules).
AFLAGS_MODULE
--------------------------------------------------
-------------
Additional module specific options to use for $(AS).
AFLAGS_KERNEL
--------------------------------------------------
-------------
Additional options for $(AS) when used for assembler
code for code that is compiled as built-in.
KCFLAGS
--------------------------------------------------
-------
Additional options to the C compiler (for built-in and modules).
CFLAGS_KERNEL
--------------------------------------------------
-------------
Additional options for $(CC) when used to compile
code that is compiled as built-in.
CFLAGS_MODULE
--------------------------------------------------
-------------
Additional module specific options to use for $(CC).
LDFLAGS_MODULE
--------------------------------------------------
--------------
Additional options used for $(LD) when linking modules.
HOSTCFLAGS
--------------------------------------------------
----------
Additional flags to be passed to $(HOSTCC) when building host programs.
HOSTCXXFLAGS
--------------------------------------------------
------------
Additional flags to be passed to $(HOSTCXX) when building host programs.
HOSTLDFLAGS
--------------------------------------------------
-----------
Additional flags to be passed when linking host programs.
HOSTLDLIBS
--------------------------------------------------
----------
Additional libraries to link against when building host programs.
KBUILD_KCONFIG
--------------------------------------------------
--------------
Set the top-level Kconfig file to the value of this environment
variable. The default name is "Kconfig".
KBUILD_VERBOSE
--------------------------------------------------
--------------
Set the kbuild verbosity. Can be assigned same values as "V=...".
See make help for the full list.
Setting "V=..." takes precedence over KBUILD_VERBOSE.
KBUILD_EXTMOD
--------------------------------------------------
-------------
Set the directory to look for the kernel source when building external
modules.
Setting "M=..." takes precedence over KBUILD_EXTMOD.
KBUILD_OUTPUT
--------------------------------------------------
-------------
Specify the output directory when building the kernel.
The output directory can also be specified using "O=...".
Setting "O=..." takes precedence over KBUILD_OUTPUT.
KBUILD_DEBARCH
--------------------------------------------------
--------------
For the deb-pkg target, allows overriding the normal heuristics deployed by
deb-pkg. Normally deb-pkg attempts to guess the right architecture based on
the 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
architecture.
ARCH
--------------------------------------------------
----
Set ARCH to the architecture to be built.
In most cases the name of the architecture is the same as the
directory name found in the arch/ directory.
But some architectures such as x86 and sparc have aliases.
x86: i386 for 32 bit, x86_64 for 64 bit
sh: sh for 32 bit, sh64 for 64 bit
sparc: sparc32 for 32 bit, sparc64 for 64 bit
- x86: i386 for 32 bit, x86_64 for 64 bit
- sh: sh for 32 bit, sh64 for 64 bit
- sparc: sparc32 for 32 bit, sparc64 for 64 bit
CROSS_COMPILE
--------------------------------------------------
-------------
Specify an optional fixed part of the binutils filename.
CROSS_COMPILE can be a part of the filename or the full path.
CROSS_COMPILE is also used for ccache in some setups.
CF
--------------------------------------------------
--
Additional options for sparse.
CF is often used on the command-line like this:
CF is often used on the command-line like this::
make CF=-Wbitwise C=2
INSTALL_PATH
--------------------------------------------------
------------
INSTALL_PATH specifies where to place the updated kernel and system map
images. Default is /boot, but you can set it to other values.
INSTALLKERNEL
--------------------------------------------------
-------------
Install script called when using "make install".
The default name is "installkernel".
The script will be called with the following arguments:
$1 - kernel version
$2 - kernel image file
$3 - kernel map file
$4 - default install path (use root directory if blank)
- $1 - kernel version
- $2 - kernel image file
- $3 - kernel map file
- $4 - default install path (use root directory if blank)
The implementation of "make install" is architecture specific
and it may differ from the above.
......@@ -149,32 +165,33 @@ INSTALLKERNEL is provided to enable the possibility to
specify a custom installer when cross compiling a kernel.
MODLIB
--------------------------------------------------
------
Specify where to install modules.
The default value is:
The default value is::
$(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
The value can be overridden in which case the default value is ignored.
INSTALL_MOD_PATH
--------------------------------------------------
----------------
INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
relocations required by build roots. This is not defined in the
makefile but the argument can be passed to make if needed.
INSTALL_MOD_STRIP
--------------------------------------------------
-----------------
INSTALL_MOD_STRIP, if defined, will cause modules to be
stripped after they are installed. If INSTALL_MOD_STRIP is '1', then
the default option --strip-debug will be used. Otherwise,
INSTALL_MOD_STRIP value will be used as the options to the strip command.
INSTALL_HDR_PATH
--------------------------------------------------
----------------
INSTALL_HDR_PATH specifies where to install user space headers when
executing "make headers_*".
The default value is:
The default value is::
$(objtree)/usr
......@@ -184,65 +201,65 @@ The output directory is often set using "O=..." on the commandline.
The value can be overridden in which case the default value is ignored.
KBUILD_SIGN_PIN
--------------------------------------------------
---------------
This variable allows a passphrase or PIN to be passed to the sign-file
utility when signing kernel modules, if the private key requires such.
KBUILD_MODPOST_WARN
--------------------------------------------------
-------------------
KBUILD_MODPOST_WARN can be set to avoid errors in case of undefined
symbols in the final module linking stage. It changes such errors
into warnings.
KBUILD_MODPOST_NOFINAL
--------------------------------------------------
----------------------
KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
This is solely useful to speed up test compiles.
KBUILD_EXTRA_SYMBOLS
--------------------------------------------------
--------------------
For modules that use symbols from other modules.
See more details in modules.txt.
ALLSOURCE_ARCHS
--------------------------------------------------
---------------
For tags/TAGS/cscope targets, you can specify more than one arch
to be included in the databases, separated by blank space. E.g.:
to be included in the databases, separated by blank space. E.g.::
$ make ALLSOURCE_ARCHS="x86 mips arm" tags
To get all available archs you can also specify all. E.g.:
To get all available archs you can also specify all. E.g.::
$ make ALLSOURCE_ARCHS=all tags
KBUILD_ENABLE_EXTRA_GCC_CHECKS
--------------------------------------------------
------------------------------
If enabled over the make command line with "W=1", it turns on additional
gcc -W... options for more extensive build-time checking.
KBUILD_BUILD_TIMESTAMP
--------------------------------------------------
----------------------
Setting this to a date string overrides the timestamp used in the
UTS_VERSION definition (uname -v in the running kernel). The value has to
be a string that can be passed to date -d. The default value
is the output of the date command at one point during build.
KBUILD_BUILD_USER, KBUILD_BUILD_HOST
--------------------------------------------------
------------------------------------
These two variables allow to override the user@host string displayed during
boot and in /proc/version. The default value is the output of the commands
whoami and host, respectively.
KBUILD_LDS
--------------------------------------------------
----------
The linker script with full path. Assigned by the top-level Makefile.
KBUILD_VMLINUX_OBJS
--------------------------------------------------
-------------------
All object files for vmlinux. They are linked to vmlinux in the same
order as listed in KBUILD_VMLINUX_OBJS.
KBUILD_VMLINUX_LIBS
--------------------------------------------------
-------------------
All .a "lib" files for vmlinux. KBUILD_VMLINUX_OBJS and KBUILD_VMLINUX_LIBS
together specify all the object files used to link vmlinux.
======================
Kconfig macro language
======================
Concept
-------
......@@ -7,7 +11,7 @@ targets and prerequisites. The other is a macro language for performing textual
substitution.
There is clear distinction between the two language stages. For example, you
can write a makefile like follows:
can write a makefile like follows::
APP := foo
SRC := foo.c
......@@ -17,7 +21,7 @@ can write a makefile like follows:
$(CC) -o $(APP) $(SRC)
The macro language replaces the variable references with their expanded form,
and handles as if the source file were input like follows:
and handles as if the source file were input like follows::
foo: foo.c
gcc -o foo foo.c
......@@ -26,7 +30,7 @@ Then, Make analyzes the dependency graph and determines the targets to be
updated.
The idea is quite similar in Kconfig - it is possible to describe a Kconfig
file like this:
file like this::
CC := gcc
......@@ -34,7 +38,7 @@ file like this:
def_bool $(shell, $(srctree)/scripts/gcc-check-foo.sh $(CC))
The macro language in Kconfig processes the source file into the following
intermediate:
intermediate::
config CC_HAS_FOO
def_bool y
......@@ -69,7 +73,7 @@ variable. The righthand side of += is expanded immediately if the lefthand
side was originally defined as a simple variable. Otherwise, its evaluation is
deferred.
The variable reference can take parameters, in the following form:
The variable reference can take parameters, in the following form::
$(name,arg1,arg2,arg3)
......@@ -141,7 +145,7 @@ Make vs Kconfig
Kconfig adopts Make-like macro language, but the function call syntax is
slightly different.
A function call in Make looks like this:
A function call in Make looks like this::
$(func-name arg1,arg2,arg3)
......@@ -149,14 +153,14 @@ The function name and the first argument are separated by at least one
whitespace. Then, leading whitespaces are trimmed from the first argument,
while whitespaces in the other arguments are kept. You need to use a kind of
trick to start the first parameter with spaces. For example, if you want
to make "info" function print " hello", you can write like follows:
to make "info" function print " hello", you can write like follows::
empty :=
space := $(empty) $(empty)
$(info $(space)$(space)hello)
Kconfig uses only commas for delimiters, and keeps all whitespaces in the
function call. Some people prefer putting a space after each comma delimiter:
function call. Some people prefer putting a space after each comma delimiter::
$(func-name, arg1, arg2, arg3)
......@@ -166,7 +170,7 @@ Make - for example, $(subst .c, .o, $(sources)) is a typical mistake; it
replaces ".c" with " .o".
In Make, a user-defined function is referenced by using a built-in function,
'call', like this:
'call', like this::
$(call my-func,arg1,arg2,arg3)
......@@ -179,12 +183,12 @@ Likewise, $(info hello, world) prints "hello, world" to stdout. You could say
this is _useful_ inconsistency.
In Kconfig, for simpler implementation and grammatical consistency, commas that
appear in the $( ) context are always delimiters. It means
appear in the $( ) context are always delimiters. It means::
$(shell, echo hello, world)
is an error because it is passing two parameters where the 'shell' function
accepts only one. To pass commas in arguments, you can use the following trick:
accepts only one. To pass commas in arguments, you can use the following trick::
comma := ,
$(shell, echo hello$(comma) world)
......@@ -195,7 +199,7 @@ Caveats
A variable (or function) cannot be expanded across tokens. So, you cannot use
a variable as a shorthand for an expression that consists of multiple tokens.
The following works:
The following works::
RANGE_MIN := 1
RANGE_MAX := 3
......@@ -204,7 +208,7 @@ The following works:
int "foo"
range $(RANGE_MIN) $(RANGE_MAX)
But, the following does not work:
But, the following does not work::
RANGES := 1 3
......@@ -213,7 +217,7 @@ But, the following does not work:
range $(RANGES)
A variable cannot be expanded to any keyword in Kconfig. The following does
not work:
not work::
MY_TYPE := tristate
......@@ -223,7 +227,8 @@ not work:
Obviously from the design, $(shell command) is expanded in the textual
substitution phase. You cannot pass symbols to the 'shell' function.
The following does not work as expected.
The following does not work as expected::
config ENDIAN_FLAG
string
......@@ -234,7 +239,7 @@ The following does not work as expected.
def_bool $(shell $(srctree)/scripts/gcc-check-flag ENDIAN_FLAG)
Instead, you can do like follows so that any function call is statically
expanded.
expanded::
config CC_HAS_ENDIAN_FLAG
bool
......
......@@ -718,7 +718,7 @@ make a neat patch, there's administrative work to be done:
- Usually you want a configuration option for your kernel hack. Edit
``Kconfig`` in the appropriate directory. The Config language is
simple to use by cut and paste, and there's complete documentation in
``Documentation/kbuild/kconfig-language.txt``.
``Documentation/kbuild/kconfig-language.rst``.
In your description of the option, make sure you address both the
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:
- Edit the ``Makefile``: the CONFIG variables are exported here so you
can usually just add a "obj-$(CONFIG_xxx) += xxx.o" line. The syntax
is documented in ``Documentation/kbuild/makefiles.txt``.
is documented in ``Documentation/kbuild/makefiles.rst``.
- Put yourself in ``CREDITS`` if you've done something noteworthy,
usually beyond a single file (your name should be at the top of the
......
......@@ -686,7 +686,7 @@ filesystems) should advertise this prominently in their prompt string::
...
For full documentation on the configuration files, see the file
Documentation/kbuild/kconfig-language.txt.
Documentation/kbuild/kconfig-language.rst.
11) Data structures
......
......@@ -39,7 +39,7 @@ and elsewhere regarding submitting Linux kernel patches.
6) Any new or modified ``CONFIG`` options do not muck up the config menu and
default to off unless they meet the exception criteria documented in
``Documentation/kbuild/kconfig-language.txt`` Menu attributes: default value.
``Documentation/kbuild/kconfig-language.rst`` Menu attributes: default value.
7) All new ``Kconfig`` options have help text.
......
......@@ -755,7 +755,7 @@ anche per avere patch pulite, c'è del lavoro amministrativo da fare:
- Solitamente vorrete un'opzione di configurazione per la vostra modifica
al kernel. Modificate ``Kconfig`` nella cartella giusta. Il linguaggio
Config è facile con copia ed incolla, e c'è una completa documentazione
nel file ``Documentation/kbuild/kconfig-language.txt``.
nel file ``Documentation/kbuild/kconfig-language.rst``.
Nella descrizione della vostra opzione, assicuratevi di parlare sia agli
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:
- Modificate il file ``Makefile``: le variabili CONFIG sono esportate qui,
quindi potete solitamente aggiungere una riga come la seguete
"obj-$(CONFIG_xxx) += xxx.o". La sintassi è documentata nel file
``Documentation/kbuild/makefiles.txt``.
``Documentation/kbuild/makefiles.rst``.
- Aggiungete voi stessi in ``CREDITS`` se avete fatto qualcosa di notevole,
solitamente qualcosa che supera il singolo file (comunque il vostro nome
......
......@@ -696,7 +696,7 @@ nella stringa di titolo::
...
Per la documentazione completa sui file di configurazione, consultate
il documento Documentation/kbuild/kconfig-language.txt
il documento Documentation/kbuild/kconfig-language.rst
11) Strutture dati
......
......@@ -43,7 +43,7 @@ sottomissione delle patch, in particolare
6) Le opzioni ``CONFIG``, nuove o modificate, non scombussolano il menu
di configurazione e sono preimpostate come disabilitate a meno che non
soddisfino i criteri descritti in ``Documentation/kbuild/kconfig-language.txt``
soddisfino i criteri descritti in ``Documentation/kbuild/kconfig-language.rst``
alla punto "Voci di menu: valori predefiniti".
7) Tutte le nuove opzioni ``Kconfig`` hanno un messaggio di aiuto.
......
......@@ -599,7 +599,7 @@ Documentation/doc-guide/ 和 scripts/kernel-doc 以获得详细信息。
depends on ADFS_FS
...
要查看配置文件的完整文档,请看 Documentation/kbuild/kconfig-language.txt。
要查看配置文件的完整文档,请看 Documentation/kbuild/kconfig-language.rst。
11) 数据结构
......
......@@ -38,7 +38,7 @@ Linux内核补丁提交清单
违规行为。
6) 任何新的或修改过的 ``CONFIG`` 选项都不会弄脏配置菜单,并默认为关闭,除非
它们符合 ``Documentation/kbuild/kconfig-language.txt`` 中记录的异常条件,
它们符合 ``Documentation/kbuild/kconfig-language.rst`` 中记录的异常条件,
菜单属性:默认值.
7) 所有新的 ``kconfig`` 选项都有帮助文本。
......
# SPDX-License-Identifier: GPL-2.0
#
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
# see Documentation/kbuild/kconfig-language.rst.
#
mainmenu "Linux/$(ARCH) $(KERNELVERSION) Kernel Configuration"
......
# SPDX-License-Identifier: GPL-2.0
#
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
# see Documentation/kbuild/kconfig-language.rst.
#
menuconfig ARC_PLAT_EZNPS
......
# SPDX-License-Identifier: GPL-2.0
#
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
# see Documentation/kbuild/kconfig-language.rst.
#
config C6X
......
# SPDX-License-Identifier: GPL-2.0-only
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
# see Documentation/kbuild/kconfig-language.rst.
config TRACE_IRQFLAGS_SUPPORT
def_bool y
# SPDX-License-Identifier: GPL-2.0-only
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
# see Documentation/kbuild/kconfig-language.rst.
#
# Platform selection Kconfig menu for MicroBlaze targets
#
......
# SPDX-License-Identifier: GPL-2.0-only
#
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
# see Documentation/kbuild/kconfig-language.rst.
#
config NDS32
......
# SPDX-License-Identifier: GPL-2.0
#
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
# see Documentation/kbuild/kconfig-language.rst.
#
config OPENRISC
......
# SPDX-License-Identifier: GPL-2.0
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
# see Documentation/kbuild/kconfig-language.rst.
#
config PPC4xx_PCI_EXPRESS
......
# SPDX-License-Identifier: GPL-2.0-only
#
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
# see Documentation/kbuild/kconfig-language.rst.
#
config 64BIT
......
# SPDX-License-Identifier: GPL-2.0