aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-01-29 06:46:14 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-01-29 06:46:14 -0500
commit5ea293a9048d3a58cb0c840fa719d85ad14cba47 (patch)
tree88d1dd1eece2cfcbd858ff2c00fb0240dcfab3c7 /Documentation
parent03bc26cfefd6db756e6bc7fcda11dc17ada7be16 (diff)
parentd3883ecebbf9e095b9e379dabbbe8b2c1ee7a41c (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild
* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild: (79 commits) Remove references to "make dep" kconfig: document use of HAVE_* Introduce new section reference annotations tags: __ref, __refdata, __refconst kbuild: warn about ld added unique sections kbuild: add verbose option to Section mismatch reporting in modpost kconfig: tristate choices with mixed tristate and boolean values asm-generic/vmlix.lds.h: simplify __mem{init,exit}* dependencies remove __attribute_used__ kbuild: support ARCH=x86 in buildtar kconfig: remove "enable" kbuild: simplified warning report in modpost kbuild: introduce a few helpers in modpost kbuild: use simpler section mismatch warnings in modpost kbuild: link vmlinux.o before kallsyms passes kbuild: introduce new option to enhance section mismatch analysis Use separate sections for __dev/__cpu/__mem code/data compiler.h: introduce __section() all archs: consolidate init and exit sections in vmlinux.lds.h kbuild: check section names consistently in modpost kbuild: introduce blacklisting in modpost ...
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/kbuild/kconfig-language.txt111
1 files changed, 105 insertions, 6 deletions
diff --git a/Documentation/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.txt
index 616043a6da9..649cb879989 100644
--- a/Documentation/kbuild/kconfig-language.txt
+++ b/Documentation/kbuild/kconfig-language.txt
@@ -24,7 +24,7 @@ visible if its parent entry is also visible.
24Menu entries 24Menu entries
25------------ 25------------
26 26
27Most entries define a config option, all other entries help to organize 27Most entries define a config option; all other entries help to organize
28them. A single configuration option is defined like this: 28them. A single configuration option is defined like this:
29 29
30config MODVERSIONS 30config MODVERSIONS
@@ -50,7 +50,7 @@ applicable everywhere (see syntax).
50 50
51- type definition: "bool"/"tristate"/"string"/"hex"/"int" 51- type definition: "bool"/"tristate"/"string"/"hex"/"int"
52 Every config option must have a type. There are only two basic types: 52 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 53 tristate and string; the other types are based on these two. The type
54 definition optionally accepts an input prompt, so these two examples 54 definition optionally accepts an input prompt, so these two examples
55 are equivalent: 55 are equivalent:
56 56
@@ -108,7 +108,7 @@ applicable everywhere (see syntax).
108 equal to 'y' without visiting the dependencies. So abusing 108 equal to 'y' without visiting the dependencies. So abusing
109 select you are able to select a symbol FOO even if FOO depends 109 select you are able to select a symbol FOO even if FOO depends
110 on BAR that is not set. In general use select only for 110 on BAR that is not set. In general use select only for
111 non-visible symbols (no promts anywhere) and for symbols with 111 non-visible symbols (no prompts anywhere) and for symbols with
112 no dependencies. That will limit the usefulness but on the 112 no dependencies. That will limit the usefulness but on the
113 other hand avoid the illegal configurations all over. kconfig 113 other hand avoid the illegal configurations all over. kconfig
114 should one day warn about such things. 114 should one day warn about such things.
@@ -127,6 +127,27 @@ applicable everywhere (see syntax).
127 used to help visually separate configuration logic from help within 127 used to help visually separate configuration logic from help within
128 the file as an aid to developers. 128 the file as an aid to developers.
129 129
130- misc options: "option" <symbol>[=<value>]
131 Various less common options can be defined via this option syntax,
132 which can modify the behaviour of the menu entry and its config
133 symbol. These options are currently possible:
134
135 - "defconfig_list"
136 This declares a list of default entries which can be used when
137 looking for the default configuration (which is used when the main
138 .config doesn't exists yet.)
139
140 - "modules"
141 This declares the symbol to be used as the MODULES symbol, which
142 enables the third modular state for all config symbols.
143
144 - "env"=<value>
145 This imports the environment variable into Kconfig. It behaves like
146 a default, except that the value comes from the environment, this
147 also means that the behaviour when mixing it with normal defaults is
148 undefined at this point. The symbol is currently not exported back
149 to the build environment (if this is desired, it can be done via
150 another symbol).
130 151
131Menu dependencies 152Menu dependencies
132----------------- 153-----------------
@@ -162,9 +183,9 @@ An expression can have a value of 'n', 'm' or 'y' (or 0, 1, 2
162respectively for calculations). A menu entry becomes visible when it's 183respectively for calculations). A menu entry becomes visible when it's
163expression evaluates to 'm' or 'y'. 184expression evaluates to 'm' or 'y'.
164 185
165There are two types of symbols: constant and nonconstant symbols. 186There are two types of symbols: constant and non-constant symbols.
166Nonconstant symbols are the most common ones and are defined with the 187Non-constant symbols are the most common ones and are defined with the
167'config' statement. Nonconstant symbols consist entirely of alphanumeric 188'config' statement. Non-constant symbols consist entirely of alphanumeric
168characters or underscores. 189characters or underscores.
169Constant symbols are only part of expressions. Constant symbols are 190Constant symbols are only part of expressions. Constant symbols are
170always surrounded by single or double quotes. Within the quote, any 191always surrounded by single or double quotes. Within the quote, any
@@ -301,3 +322,81 @@ mainmenu:
301 322
302This sets the config program's title bar if the config program chooses 323This sets the config program's title bar if the config program chooses
303to use it. 324to use it.
325
326
327Kconfig hints
328-------------
329This is a collection of Kconfig tips, most of which aren't obvious at
330first glance and most of which have become idioms in several Kconfig
331files.
332
333Adding common features and make the usage configurable
334~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
335It is a common idiom to implement a feature/functionality that are
336relevant for some architectures but not all.
337The recommended way to do so is to use a config variable named HAVE_*
338that is defined in a common Kconfig file and selected by the relevant
339architectures.
340An example is the generic IOMAP functionality.
341
342We would in lib/Kconfig see:
343
344# Generic IOMAP is used to ...
345config HAVE_GENERIC_IOMAP
346
347config GENERIC_IOMAP
348 depends on HAVE_GENERIC_IOMAP && FOO
349
350And in lib/Makefile we would see:
351obj-$(CONFIG_GENERIC_IOMAP) += iomap.o
352
353For each architecture using the generic IOMAP functionality we would see:
354
355config X86
356 select ...
357 select HAVE_GENERIC_IOMAP
358 select ...
359
360Note: we use the existing config option and avoid creating a new
361config variable to select HAVE_GENERIC_IOMAP.
362
363Note: the use of the internal config variable HAVE_GENERIC_IOMAP, it is
364introduced to overcome the limitation of select which will force a
365config option to 'y' no matter the dependencies.
366The dependencies are moved to the symbol GENERIC_IOMAP and we avoid the
367situation where select forces a symbol equals to 'y'.
368
369Build as module only
370~~~~~~~~~~~~~~~~~~~~
371To restrict a component build to module-only, qualify its config symbol
372with "depends on m". E.g.:
373
374config FOO
375 depends on BAR && m
376
377limits FOO to module (=m) or disabled (=n).
378
379
380Build limited by a third config symbol which may be =y or =m
381~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
382A common idiom that we see (and sometimes have problems with) is this:
383
384When option C in B (module or subsystem) uses interfaces from A (module
385or subsystem), and both A and B are tristate (could be =y or =m if they
386were independent of each other, but they aren't), then we need to limit
387C such that it cannot be built statically if A is built as a loadable
388module. (C already depends on B, so there is no dependency issue to
389take care of here.)
390
391If A is linked statically into the kernel image, C can be built
392statically or as loadable module(s). However, if A is built as loadable
393module(s), then C must be restricted to loadable module(s) also. This
394can be expressed in kconfig language as:
395
396config C
397 depends on A = y || A = B
398
399or for real examples, use this command in a kernel tree:
400
401$ find . -name Kconfig\* | xargs grep -ns "depends on.*=.*||.*=" | grep -v orig
402