xref: /nrf52832-nimble/rt-thread/tools/kconfig-frontends/docs/kconfig-language.txt (revision 104654410c56c573564690304ae786df310c91fc)
1*10465441SEvalZeroIntroduction
2*10465441SEvalZero------------
3*10465441SEvalZero
4*10465441SEvalZeroThe configuration database is a collection of configuration options
5*10465441SEvalZeroorganized in a tree structure:
6*10465441SEvalZero
7*10465441SEvalZero	+- Code maturity level options
8*10465441SEvalZero	|  +- Prompt for development and/or incomplete code/drivers
9*10465441SEvalZero	+- General setup
10*10465441SEvalZero	|  +- Networking support
11*10465441SEvalZero	|  +- System V IPC
12*10465441SEvalZero	|  +- BSD Process Accounting
13*10465441SEvalZero	|  +- Sysctl support
14*10465441SEvalZero	+- Loadable module support
15*10465441SEvalZero	|  +- Enable loadable module support
16*10465441SEvalZero	|     +- Set version information on all module symbols
17*10465441SEvalZero	|     +- Kernel module loader
18*10465441SEvalZero	+- ...
19*10465441SEvalZero
20*10465441SEvalZeroEvery entry has its own dependencies. These dependencies are used
21*10465441SEvalZeroto determine the visibility of an entry. Any child entry is only
22*10465441SEvalZerovisible if its parent entry is also visible.
23*10465441SEvalZero
24*10465441SEvalZeroMenu entries
25*10465441SEvalZero------------
26*10465441SEvalZero
27*10465441SEvalZeroMost entries define a config option; all other entries help to organize
28*10465441SEvalZerothem. A single configuration option is defined like this:
29*10465441SEvalZero
30*10465441SEvalZeroconfig MODVERSIONS
31*10465441SEvalZero	bool "Set version information on all module symbols"
32*10465441SEvalZero	depends on MODULES
33*10465441SEvalZero	help
34*10465441SEvalZero	  Usually, modules have to be recompiled whenever you switch to a new
35*10465441SEvalZero	  kernel.  ...
36*10465441SEvalZero
37*10465441SEvalZeroEvery line starts with a key word and can be followed by multiple
38*10465441SEvalZeroarguments.  "config" starts a new config entry. The following lines
39*10465441SEvalZerodefine attributes for this config option. Attributes can be the type of
40*10465441SEvalZerothe config option, input prompt, dependencies, help text and default
41*10465441SEvalZerovalues. A config option can be defined multiple times with the same
42*10465441SEvalZeroname, but every definition can have only a single input prompt and the
43*10465441SEvalZerotype must not conflict.
44*10465441SEvalZero
45*10465441SEvalZeroMenu attributes
46*10465441SEvalZero---------------
47*10465441SEvalZero
48*10465441SEvalZeroA menu entry can have a number of attributes. Not all of them are
49*10465441SEvalZeroapplicable everywhere (see syntax).
50*10465441SEvalZero
51*10465441SEvalZero- type definition: "bool"/"tristate"/"string"/"hex"/"int"
52*10465441SEvalZero  Every config option must have a type. There are only two basic types:
53*10465441SEvalZero  tristate and string; the other types are based on these two. The type
54*10465441SEvalZero  definition optionally accepts an input prompt, so these two examples
55*10465441SEvalZero  are equivalent:
56*10465441SEvalZero
57*10465441SEvalZero	bool "Networking support"
58*10465441SEvalZero  and
59*10465441SEvalZero	bool
60*10465441SEvalZero	prompt "Networking support"
61*10465441SEvalZero
62*10465441SEvalZero- input prompt: "prompt" <prompt> ["if" <expr>]
63*10465441SEvalZero  Every menu entry can have at most one prompt, which is used to display
64*10465441SEvalZero  to the user. Optionally dependencies only for this prompt can be added
65*10465441SEvalZero  with "if".
66*10465441SEvalZero
67*10465441SEvalZero- default value: "default" <expr> ["if" <expr>]
68*10465441SEvalZero  A config option can have any number of default values. If multiple
69*10465441SEvalZero  default values are visible, only the first defined one is active.
70*10465441SEvalZero  Default values are not limited to the menu entry where they are
71*10465441SEvalZero  defined. This means the default can be defined somewhere else or be
72*10465441SEvalZero  overridden by an earlier definition.
73*10465441SEvalZero  The default value is only assigned to the config symbol if no other
74*10465441SEvalZero  value was set by the user (via the input prompt above). If an input
75*10465441SEvalZero  prompt is visible the default value is presented to the user and can
76*10465441SEvalZero  be overridden by him.
77*10465441SEvalZero  Optionally, dependencies only for this default value can be added with
78*10465441SEvalZero  "if".
79*10465441SEvalZero
80*10465441SEvalZero- type definition + default value:
81*10465441SEvalZero	"def_bool"/"def_tristate" <expr> ["if" <expr>]
82*10465441SEvalZero  This is a shorthand notation for a type definition plus a value.
83*10465441SEvalZero  Optionally dependencies for this default value can be added with "if".
84*10465441SEvalZero
85*10465441SEvalZero- dependencies: "depends on" <expr>
86*10465441SEvalZero  This defines a dependency for this menu entry. If multiple
87*10465441SEvalZero  dependencies are defined, they are connected with '&&'. Dependencies
88*10465441SEvalZero  are applied to all other options within this menu entry (which also
89*10465441SEvalZero  accept an "if" expression), so these two examples are equivalent:
90*10465441SEvalZero
91*10465441SEvalZero	bool "foo" if BAR
92*10465441SEvalZero	default y if BAR
93*10465441SEvalZero  and
94*10465441SEvalZero	depends on BAR
95*10465441SEvalZero	bool "foo"
96*10465441SEvalZero	default y
97*10465441SEvalZero
98*10465441SEvalZero- reverse dependencies: "select" <symbol> ["if" <expr>]
99*10465441SEvalZero  While normal dependencies reduce the upper limit of a symbol (see
100*10465441SEvalZero  below), reverse dependencies can be used to force a lower limit of
101*10465441SEvalZero  another symbol. The value of the current menu symbol is used as the
102*10465441SEvalZero  minimal value <symbol> can be set to. If <symbol> is selected multiple
103*10465441SEvalZero  times, the limit is set to the largest selection.
104*10465441SEvalZero  Reverse dependencies can only be used with boolean or tristate
105*10465441SEvalZero  symbols.
106*10465441SEvalZero  Note:
107*10465441SEvalZero	select should be used with care. select will force
108*10465441SEvalZero	a symbol to a value without visiting the dependencies.
109*10465441SEvalZero	By abusing select you are able to select a symbol FOO even
110*10465441SEvalZero	if FOO depends on BAR that is not set.
111*10465441SEvalZero	In general use select only for non-visible symbols
112*10465441SEvalZero	(no prompts anywhere) and for symbols with no dependencies.
113*10465441SEvalZero	That will limit the usefulness but on the other hand avoid
114*10465441SEvalZero	the illegal configurations all over.
115*10465441SEvalZero
116*10465441SEvalZero- weak reverse dependencies: "imply" <symbol> ["if" <expr>]
117*10465441SEvalZero  This is similar to "select" as it enforces a lower limit on another
118*10465441SEvalZero  symbol except that the "implied" symbol's value may still be set to n
119*10465441SEvalZero  from a direct dependency or with a visible prompt.
120*10465441SEvalZero
121*10465441SEvalZero  Given the following example:
122*10465441SEvalZero
123*10465441SEvalZero  config FOO
124*10465441SEvalZero	tristate
125*10465441SEvalZero	imply BAZ
126*10465441SEvalZero
127*10465441SEvalZero  config BAZ
128*10465441SEvalZero	tristate
129*10465441SEvalZero	depends on BAR
130*10465441SEvalZero
131*10465441SEvalZero  The following values are possible:
132*10465441SEvalZero
133*10465441SEvalZero	FOO		BAR		BAZ's default	choice for BAZ
134*10465441SEvalZero	---		---		-------------	--------------
135*10465441SEvalZero	n		y		n		N/m/y
136*10465441SEvalZero	m		y		m		M/y/n
137*10465441SEvalZero	y		y		y		Y/n
138*10465441SEvalZero	y		n		*		N
139*10465441SEvalZero
140*10465441SEvalZero  This is useful e.g. with multiple drivers that want to indicate their
141*10465441SEvalZero  ability to hook into a secondary subsystem while allowing the user to
142*10465441SEvalZero  configure that subsystem out without also having to unset these drivers.
143*10465441SEvalZero
144*10465441SEvalZero- limiting menu display: "visible if" <expr>
145*10465441SEvalZero  This attribute is only applicable to menu blocks, if the condition is
146*10465441SEvalZero  false, the menu block is not displayed to the user (the symbols
147*10465441SEvalZero  contained there can still be selected by other symbols, though). It is
148*10465441SEvalZero  similar to a conditional "prompt" attribute for individual menu
149*10465441SEvalZero  entries. Default value of "visible" is true.
150*10465441SEvalZero
151*10465441SEvalZero- numerical ranges: "range" <symbol> <symbol> ["if" <expr>]
152*10465441SEvalZero  This allows to limit the range of possible input values for int
153*10465441SEvalZero  and hex symbols. The user can only input a value which is larger than
154*10465441SEvalZero  or equal to the first symbol and smaller than or equal to the second
155*10465441SEvalZero  symbol.
156*10465441SEvalZero
157*10465441SEvalZero- help text: "help" or "---help---"
158*10465441SEvalZero  This defines a help text. The end of the help text is determined by
159*10465441SEvalZero  the indentation level, this means it ends at the first line which has
160*10465441SEvalZero  a smaller indentation than the first line of the help text.
161*10465441SEvalZero  "---help---" and "help" do not differ in behaviour, "---help---" is
162*10465441SEvalZero  used to help visually separate configuration logic from help within
163*10465441SEvalZero  the file as an aid to developers.
164*10465441SEvalZero
165*10465441SEvalZero- misc options: "option" <symbol>[=<value>]
166*10465441SEvalZero  Various less common options can be defined via this option syntax,
167*10465441SEvalZero  which can modify the behaviour of the menu entry and its config
168*10465441SEvalZero  symbol. These options are currently possible:
169*10465441SEvalZero
170*10465441SEvalZero  - "defconfig_list"
171*10465441SEvalZero    This declares a list of default entries which can be used when
172*10465441SEvalZero    looking for the default configuration (which is used when the main
173*10465441SEvalZero    .config doesn't exists yet.)
174*10465441SEvalZero
175*10465441SEvalZero  - "modules"
176*10465441SEvalZero    This declares the symbol to be used as the MODULES symbol, which
177*10465441SEvalZero    enables the third modular state for all config symbols.
178*10465441SEvalZero    At most one symbol may have the "modules" option set.
179*10465441SEvalZero
180*10465441SEvalZero  - "env"=<value>
181*10465441SEvalZero    This imports the environment variable into Kconfig. It behaves like
182*10465441SEvalZero    a default, except that the value comes from the environment, this
183*10465441SEvalZero    also means that the behaviour when mixing it with normal defaults is
184*10465441SEvalZero    undefined at this point. The symbol is currently not exported back
185*10465441SEvalZero    to the build environment (if this is desired, it can be done via
186*10465441SEvalZero    another symbol).
187*10465441SEvalZero
188*10465441SEvalZero  - "allnoconfig_y"
189*10465441SEvalZero    This declares the symbol as one that should have the value y when
190*10465441SEvalZero    using "allnoconfig". Used for symbols that hide other symbols.
191*10465441SEvalZero
192*10465441SEvalZeroMenu dependencies
193*10465441SEvalZero-----------------
194*10465441SEvalZero
195*10465441SEvalZeroDependencies define the visibility of a menu entry and can also reduce
196*10465441SEvalZerothe input range of tristate symbols. The tristate logic used in the
197*10465441SEvalZeroexpressions uses one more state than normal boolean logic to express the
198*10465441SEvalZeromodule state. Dependency expressions have the following syntax:
199*10465441SEvalZero
200*10465441SEvalZero<expr> ::= <symbol>                             (1)
201*10465441SEvalZero           <symbol> '=' <symbol>                (2)
202*10465441SEvalZero           <symbol> '!=' <symbol>               (3)
203*10465441SEvalZero           '(' <expr> ')'                       (4)
204*10465441SEvalZero           '!' <expr>                           (5)
205*10465441SEvalZero           <expr> '&&' <expr>                   (6)
206*10465441SEvalZero           <expr> '||' <expr>                   (7)
207*10465441SEvalZero
208*10465441SEvalZeroExpressions are listed in decreasing order of precedence.
209*10465441SEvalZero
210*10465441SEvalZero(1) Convert the symbol into an expression. Boolean and tristate symbols
211*10465441SEvalZero    are simply converted into the respective expression values. All
212*10465441SEvalZero    other symbol types result in 'n'.
213*10465441SEvalZero(2) If the values of both symbols are equal, it returns 'y',
214*10465441SEvalZero    otherwise 'n'.
215*10465441SEvalZero(3) If the values of both symbols are equal, it returns 'n',
216*10465441SEvalZero    otherwise 'y'.
217*10465441SEvalZero(4) Returns the value of the expression. Used to override precedence.
218*10465441SEvalZero(5) Returns the result of (2-/expr/).
219*10465441SEvalZero(6) Returns the result of min(/expr/, /expr/).
220*10465441SEvalZero(7) Returns the result of max(/expr/, /expr/).
221*10465441SEvalZero
222*10465441SEvalZeroAn expression can have a value of 'n', 'm' or 'y' (or 0, 1, 2
223*10465441SEvalZerorespectively for calculations). A menu entry becomes visible when its
224*10465441SEvalZeroexpression evaluates to 'm' or 'y'.
225*10465441SEvalZero
226*10465441SEvalZeroThere are two types of symbols: constant and non-constant symbols.
227*10465441SEvalZeroNon-constant symbols are the most common ones and are defined with the
228*10465441SEvalZero'config' statement. Non-constant symbols consist entirely of alphanumeric
229*10465441SEvalZerocharacters or underscores.
230*10465441SEvalZeroConstant symbols are only part of expressions. Constant symbols are
231*10465441SEvalZeroalways surrounded by single or double quotes. Within the quote, any
232*10465441SEvalZeroother character is allowed and the quotes can be escaped using '\'.
233*10465441SEvalZero
234*10465441SEvalZeroMenu structure
235*10465441SEvalZero--------------
236*10465441SEvalZero
237*10465441SEvalZeroThe position of a menu entry in the tree is determined in two ways. First
238*10465441SEvalZeroit can be specified explicitly:
239*10465441SEvalZero
240*10465441SEvalZeromenu "Network device support"
241*10465441SEvalZero	depends on NET
242*10465441SEvalZero
243*10465441SEvalZeroconfig NETDEVICES
244*10465441SEvalZero	...
245*10465441SEvalZero
246*10465441SEvalZeroendmenu
247*10465441SEvalZero
248*10465441SEvalZeroAll entries within the "menu" ... "endmenu" block become a submenu of
249*10465441SEvalZero"Network device support". All subentries inherit the dependencies from
250*10465441SEvalZerothe menu entry, e.g. this means the dependency "NET" is added to the
251*10465441SEvalZerodependency list of the config option NETDEVICES.
252*10465441SEvalZero
253*10465441SEvalZeroThe other way to generate the menu structure is done by analyzing the
254*10465441SEvalZerodependencies. If a menu entry somehow depends on the previous entry, it
255*10465441SEvalZerocan be made a submenu of it. First, the previous (parent) symbol must
256*10465441SEvalZerobe part of the dependency list and then one of these two conditions
257*10465441SEvalZeromust be true:
258*10465441SEvalZero- the child entry must become invisible, if the parent is set to 'n'
259*10465441SEvalZero- the child entry must only be visible, if the parent is visible
260*10465441SEvalZero
261*10465441SEvalZeroconfig MODULES
262*10465441SEvalZero	bool "Enable loadable module support"
263*10465441SEvalZero
264*10465441SEvalZeroconfig MODVERSIONS
265*10465441SEvalZero	bool "Set version information on all module symbols"
266*10465441SEvalZero	depends on MODULES
267*10465441SEvalZero
268*10465441SEvalZerocomment "module support disabled"
269*10465441SEvalZero	depends on !MODULES
270*10465441SEvalZero
271*10465441SEvalZeroMODVERSIONS directly depends on MODULES, this means it's only visible if
272*10465441SEvalZeroMODULES is different from 'n'. The comment on the other hand is only
273*10465441SEvalZerovisible when MODULES is set to 'n'.
274*10465441SEvalZero
275*10465441SEvalZero
276*10465441SEvalZeroKconfig syntax
277*10465441SEvalZero--------------
278*10465441SEvalZero
279*10465441SEvalZeroThe configuration file describes a series of menu entries, where every
280*10465441SEvalZeroline starts with a keyword (except help texts). The following keywords
281*10465441SEvalZeroend a menu entry:
282*10465441SEvalZero- config
283*10465441SEvalZero- menuconfig
284*10465441SEvalZero- choice/endchoice
285*10465441SEvalZero- comment
286*10465441SEvalZero- menu/endmenu
287*10465441SEvalZero- if/endif
288*10465441SEvalZero- source
289*10465441SEvalZeroThe first five also start the definition of a menu entry.
290*10465441SEvalZero
291*10465441SEvalZeroconfig:
292*10465441SEvalZero
293*10465441SEvalZero	"config" <symbol>
294*10465441SEvalZero	<config options>
295*10465441SEvalZero
296*10465441SEvalZeroThis defines a config symbol <symbol> and accepts any of above
297*10465441SEvalZeroattributes as options.
298*10465441SEvalZero
299*10465441SEvalZeromenuconfig:
300*10465441SEvalZero	"menuconfig" <symbol>
301*10465441SEvalZero	<config options>
302*10465441SEvalZero
303*10465441SEvalZeroThis is similar to the simple config entry above, but it also gives a
304*10465441SEvalZerohint to front ends, that all suboptions should be displayed as a
305*10465441SEvalZeroseparate list of options. To make sure all the suboptions will really
306*10465441SEvalZeroshow up under the menuconfig entry and not outside of it, every item
307*10465441SEvalZerofrom the <config options> list must depend on the menuconfig symbol.
308*10465441SEvalZeroIn practice, this is achieved by using one of the next two constructs:
309*10465441SEvalZero
310*10465441SEvalZero(1):
311*10465441SEvalZeromenuconfig M
312*10465441SEvalZeroif M
313*10465441SEvalZero    config C1
314*10465441SEvalZero    config C2
315*10465441SEvalZeroendif
316*10465441SEvalZero
317*10465441SEvalZero(2):
318*10465441SEvalZeromenuconfig M
319*10465441SEvalZeroconfig C1
320*10465441SEvalZero    depends on M
321*10465441SEvalZeroconfig C2
322*10465441SEvalZero    depends on M
323*10465441SEvalZero
324*10465441SEvalZeroIn the following examples (3) and (4), C1 and C2 still have the M
325*10465441SEvalZerodependency, but will not appear under menuconfig M anymore, because
326*10465441SEvalZeroof C0, which doesn't depend on M:
327*10465441SEvalZero
328*10465441SEvalZero(3):
329*10465441SEvalZeromenuconfig M
330*10465441SEvalZero    config C0
331*10465441SEvalZeroif M
332*10465441SEvalZero    config C1
333*10465441SEvalZero    config C2
334*10465441SEvalZeroendif
335*10465441SEvalZero
336*10465441SEvalZero(4):
337*10465441SEvalZeromenuconfig M
338*10465441SEvalZeroconfig C0
339*10465441SEvalZeroconfig C1
340*10465441SEvalZero    depends on M
341*10465441SEvalZeroconfig C2
342*10465441SEvalZero    depends on M
343*10465441SEvalZero
344*10465441SEvalZerochoices:
345*10465441SEvalZero
346*10465441SEvalZero	"choice" [symbol]
347*10465441SEvalZero	<choice options>
348*10465441SEvalZero	<choice block>
349*10465441SEvalZero	"endchoice"
350*10465441SEvalZero
351*10465441SEvalZeroThis defines a choice group and accepts any of the above attributes as
352*10465441SEvalZerooptions. A choice can only be of type bool or tristate.  If no type is
353*10465441SEvalZerospecified for a choice, it's type will be determined by the type of
354*10465441SEvalZerothe first choice element in the group or remain unknown if none of the
355*10465441SEvalZerochoice elements have a type specified, as well.
356*10465441SEvalZero
357*10465441SEvalZeroWhile a boolean choice only allows a single config entry to be
358*10465441SEvalZeroselected, a tristate choice also allows any number of config entries
359*10465441SEvalZeroto be set to 'm'. This can be used if multiple drivers for a single
360*10465441SEvalZerohardware exists and only a single driver can be compiled/loaded into
361*10465441SEvalZerothe kernel, but all drivers can be compiled as modules.
362*10465441SEvalZero
363*10465441SEvalZeroA choice accepts another option "optional", which allows to set the
364*10465441SEvalZerochoice to 'n' and no entry needs to be selected.
365*10465441SEvalZeroIf no [symbol] is associated with a choice, then you can not have multiple
366*10465441SEvalZerodefinitions of that choice. If a [symbol] is associated to the choice,
367*10465441SEvalZerothen you may define the same choice (ie. with the same entries) in another
368*10465441SEvalZeroplace.
369*10465441SEvalZero
370*10465441SEvalZerocomment:
371*10465441SEvalZero
372*10465441SEvalZero	"comment" <prompt>
373*10465441SEvalZero	<comment options>
374*10465441SEvalZero
375*10465441SEvalZeroThis defines a comment which is displayed to the user during the
376*10465441SEvalZeroconfiguration process and is also echoed to the output files. The only
377*10465441SEvalZeropossible options are dependencies.
378*10465441SEvalZero
379*10465441SEvalZeromenu:
380*10465441SEvalZero
381*10465441SEvalZero	"menu" <prompt>
382*10465441SEvalZero	<menu options>
383*10465441SEvalZero	<menu block>
384*10465441SEvalZero	"endmenu"
385*10465441SEvalZero
386*10465441SEvalZeroThis defines a menu block, see "Menu structure" above for more
387*10465441SEvalZeroinformation. The only possible options are dependencies and "visible"
388*10465441SEvalZeroattributes.
389*10465441SEvalZero
390*10465441SEvalZeroif:
391*10465441SEvalZero
392*10465441SEvalZero	"if" <expr>
393*10465441SEvalZero	<if block>
394*10465441SEvalZero	"endif"
395*10465441SEvalZero
396*10465441SEvalZeroThis defines an if block. The dependency expression <expr> is appended
397*10465441SEvalZeroto all enclosed menu entries.
398*10465441SEvalZero
399*10465441SEvalZerosource:
400*10465441SEvalZero
401*10465441SEvalZero	"source" <prompt>
402*10465441SEvalZero
403*10465441SEvalZeroThis reads the specified configuration file. This file is always parsed.
404*10465441SEvalZero
405*10465441SEvalZeromainmenu:
406*10465441SEvalZero
407*10465441SEvalZero	"mainmenu" <prompt>
408*10465441SEvalZero
409*10465441SEvalZeroThis sets the config program's title bar if the config program chooses
410*10465441SEvalZeroto use it. It should be placed at the top of the configuration, before any
411*10465441SEvalZeroother statement.
412*10465441SEvalZero
413*10465441SEvalZero
414*10465441SEvalZeroKconfig hints
415*10465441SEvalZero-------------
416*10465441SEvalZeroThis is a collection of Kconfig tips, most of which aren't obvious at
417*10465441SEvalZerofirst glance and most of which have become idioms in several Kconfig
418*10465441SEvalZerofiles.
419*10465441SEvalZero
420*10465441SEvalZeroAdding common features and make the usage configurable
421*10465441SEvalZero~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
422*10465441SEvalZeroIt is a common idiom to implement a feature/functionality that are
423*10465441SEvalZerorelevant for some architectures but not all.
424*10465441SEvalZeroThe recommended way to do so is to use a config variable named HAVE_*
425*10465441SEvalZerothat is defined in a common Kconfig file and selected by the relevant
426*10465441SEvalZeroarchitectures.
427*10465441SEvalZeroAn example is the generic IOMAP functionality.
428*10465441SEvalZero
429*10465441SEvalZeroWe would in lib/Kconfig see:
430*10465441SEvalZero
431*10465441SEvalZero# Generic IOMAP is used to ...
432*10465441SEvalZeroconfig HAVE_GENERIC_IOMAP
433*10465441SEvalZero
434*10465441SEvalZeroconfig GENERIC_IOMAP
435*10465441SEvalZero	depends on HAVE_GENERIC_IOMAP && FOO
436*10465441SEvalZero
437*10465441SEvalZeroAnd in lib/Makefile we would see:
438*10465441SEvalZeroobj-$(CONFIG_GENERIC_IOMAP) += iomap.o
439*10465441SEvalZero
440*10465441SEvalZeroFor each architecture using the generic IOMAP functionality we would see:
441*10465441SEvalZero
442*10465441SEvalZeroconfig X86
443*10465441SEvalZero	select ...
444*10465441SEvalZero	select HAVE_GENERIC_IOMAP
445*10465441SEvalZero	select ...
446*10465441SEvalZero
447*10465441SEvalZeroNote: we use the existing config option and avoid creating a new
448*10465441SEvalZeroconfig variable to select HAVE_GENERIC_IOMAP.
449*10465441SEvalZero
450*10465441SEvalZeroNote: the use of the internal config variable HAVE_GENERIC_IOMAP, it is
451*10465441SEvalZerointroduced to overcome the limitation of select which will force a
452*10465441SEvalZeroconfig option to 'y' no matter the dependencies.
453*10465441SEvalZeroThe dependencies are moved to the symbol GENERIC_IOMAP and we avoid the
454*10465441SEvalZerosituation where select forces a symbol equals to 'y'.
455*10465441SEvalZero
456*10465441SEvalZeroBuild as module only
457*10465441SEvalZero~~~~~~~~~~~~~~~~~~~~
458*10465441SEvalZeroTo restrict a component build to module-only, qualify its config symbol
459*10465441SEvalZerowith "depends on m".  E.g.:
460*10465441SEvalZero
461*10465441SEvalZeroconfig FOO
462*10465441SEvalZero	depends on BAR && m
463*10465441SEvalZero
464*10465441SEvalZerolimits FOO to module (=m) or disabled (=n).
465*10465441SEvalZero
466*10465441SEvalZeroKconfig recursive dependency limitations
467*10465441SEvalZero~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
468*10465441SEvalZero
469*10465441SEvalZeroIf you've hit the Kconfig error: "recursive dependency detected" you've run
470*10465441SEvalZerointo a recursive dependency issue with Kconfig, a recursive dependency can be
471*10465441SEvalZerosummarized as a circular dependency. The kconfig tools need to ensure that
472*10465441SEvalZeroKconfig files comply with specified configuration requirements. In order to do
473*10465441SEvalZerothat kconfig must determine the values that are possible for all Kconfig
474*10465441SEvalZerosymbols, this is currently not possible if there is a circular relation
475*10465441SEvalZerobetween two or more Kconfig symbols. For more details refer to the "Simple
476*10465441SEvalZeroKconfig recursive issue" subsection below. Kconfig does not do recursive
477*10465441SEvalZerodependency resolution; this has a few implications for Kconfig file writers.
478*10465441SEvalZeroWe'll first explain why this issues exists and then provide an example
479*10465441SEvalZerotechnical limitation which this brings upon Kconfig developers. Eager
480*10465441SEvalZerodevelopers wishing to try to address this limitation should read the next
481*10465441SEvalZerosubsections.
482*10465441SEvalZero
483*10465441SEvalZeroSimple Kconfig recursive issue
484*10465441SEvalZero~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
485*10465441SEvalZero
486*10465441SEvalZeroRead: Documentation/kbuild/Kconfig.recursion-issue-01
487*10465441SEvalZero
488*10465441SEvalZeroTest with:
489*10465441SEvalZero
490*10465441SEvalZeromake KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-01 allnoconfig
491*10465441SEvalZero
492*10465441SEvalZeroCumulative Kconfig recursive issue
493*10465441SEvalZero~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
494*10465441SEvalZero
495*10465441SEvalZeroRead: Documentation/kbuild/Kconfig.recursion-issue-02
496*10465441SEvalZero
497*10465441SEvalZeroTest with:
498*10465441SEvalZero
499*10465441SEvalZeromake KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-02 allnoconfig
500*10465441SEvalZero
501*10465441SEvalZeroPractical solutions to kconfig recursive issue
502*10465441SEvalZero~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
503*10465441SEvalZero
504*10465441SEvalZeroDevelopers who run into the recursive Kconfig issue have three options
505*10465441SEvalZeroat their disposal. We document them below and also provide a list of
506*10465441SEvalZerohistorical issues resolved through these different solutions.
507*10465441SEvalZero
508*10465441SEvalZero  a) Remove any superfluous "select FOO" or "depends on FOO"
509*10465441SEvalZero  b) Match dependency semantics:
510*10465441SEvalZero	b1) Swap all "select FOO" to "depends on FOO" or,
511*10465441SEvalZero	b2) Swap all "depends on FOO" to "select FOO"
512*10465441SEvalZero  c) Consider the use of "imply" instead of "select"
513*10465441SEvalZero
514*10465441SEvalZeroThe resolution to a) can be tested with the sample Kconfig file
515*10465441SEvalZeroDocumentation/kbuild/Kconfig.recursion-issue-01 through the removal
516*10465441SEvalZeroof the "select CORE" from CORE_BELL_A_ADVANCED as that is implicit already
517*10465441SEvalZerosince CORE_BELL_A depends on CORE. At times it may not be possible to remove
518*10465441SEvalZerosome dependency criteria, for such cases you can work with solution b).
519*10465441SEvalZero
520*10465441SEvalZeroThe two different resolutions for b) can be tested in the sample Kconfig file
521*10465441SEvalZeroDocumentation/kbuild/Kconfig.recursion-issue-02.
522*10465441SEvalZero
523*10465441SEvalZeroBelow is a list of examples of prior fixes for these types of recursive issues;
524*10465441SEvalZeroall errors appear to involve one or more select's and one or more "depends on".
525*10465441SEvalZero
526*10465441SEvalZerocommit          fix
527*10465441SEvalZero======          ===
528*10465441SEvalZero06b718c01208    select A -> depends on A
529*10465441SEvalZeroc22eacfe82f9    depends on A -> depends on B
530*10465441SEvalZero6a91e854442c    select A -> depends on A
531*10465441SEvalZero118c565a8f2e    select A -> select B
532*10465441SEvalZerof004e5594705    select A -> depends on A
533*10465441SEvalZeroc7861f37b4c6    depends on A -> (null)
534*10465441SEvalZero80c69915e5fb    select A -> (null)              (1)
535*10465441SEvalZeroc2218e26c0d0    select A -> depends on A        (1)
536*10465441SEvalZerod6ae99d04e1c    select A -> depends on A
537*10465441SEvalZero95ca19cf8cbf    select A -> depends on A
538*10465441SEvalZero8f057d7bca54    depends on A -> (null)
539*10465441SEvalZero8f057d7bca54    depends on A -> select A
540*10465441SEvalZeroa0701f04846e    select A -> depends on A
541*10465441SEvalZero0c8b92f7f259    depends on A -> (null)
542*10465441SEvalZeroe4e9e0540928    select A -> depends on A        (2)
543*10465441SEvalZero7453ea886e87    depends on A > (null)           (1)
544*10465441SEvalZero7b1fff7e4fdf    select A -> depends on A
545*10465441SEvalZero86c747d2a4f0    select A -> depends on A
546*10465441SEvalZerod9f9ab51e55e    select A -> depends on A
547*10465441SEvalZero0c51a4d8abd6    depends on A -> select A        (3)
548*10465441SEvalZeroe98062ed6dc4    select A -> depends on A        (3)
549*10465441SEvalZero91e5d284a7f1    select A -> (null)
550*10465441SEvalZero
551*10465441SEvalZero(1) Partial (or no) quote of error.
552*10465441SEvalZero(2) That seems to be the gist of that fix.
553*10465441SEvalZero(3) Same error.
554*10465441SEvalZero
555*10465441SEvalZeroFuture kconfig work
556*10465441SEvalZero~~~~~~~~~~~~~~~~~~~
557*10465441SEvalZero
558*10465441SEvalZeroWork on kconfig is welcomed on both areas of clarifying semantics and on
559*10465441SEvalZeroevaluating the use of a full SAT solver for it. A full SAT solver can be
560*10465441SEvalZerodesirable to enable more complex dependency mappings and / or queries,
561*10465441SEvalZerofor instance on possible use case for a SAT solver could be that of handling
562*10465441SEvalZerothe current known recursive dependency issues. It is not known if this would
563*10465441SEvalZeroaddress such issues but such evaluation is desirable. If support for a full SAT
564*10465441SEvalZerosolver proves too complex or that it cannot address recursive dependency issues
565*10465441SEvalZeroKconfig should have at least clear and well defined semantics which also
566*10465441SEvalZeroaddresses and documents limitations or requirements such as the ones dealing
567*10465441SEvalZerowith recursive dependencies.
568*10465441SEvalZero
569*10465441SEvalZeroFurther work on both of these areas is welcomed on Kconfig. We elaborate
570*10465441SEvalZeroon both of these in the next two subsections.
571*10465441SEvalZero
572*10465441SEvalZeroSemantics of Kconfig
573*10465441SEvalZero~~~~~~~~~~~~~~~~~~~~
574*10465441SEvalZero
575*10465441SEvalZeroThe use of Kconfig is broad, Linux is now only one of Kconfig's users:
576*10465441SEvalZeroone study has completed a broad analysis of Kconfig use in 12 projects [0].
577*10465441SEvalZeroDespite its widespread use, and although this document does a reasonable job
578*10465441SEvalZeroin documenting basic Kconfig syntax a more precise definition of Kconfig
579*10465441SEvalZerosemantics is welcomed. One project deduced Kconfig semantics through
580*10465441SEvalZerothe use of the xconfig configurator [1]. Work should be done to confirm if
581*10465441SEvalZerothe deduced semantics matches our intended Kconfig design goals.
582*10465441SEvalZero
583*10465441SEvalZeroHaving well defined semantics can be useful for tools for practical
584*10465441SEvalZeroevaluation of depenencies, for instance one such use known case was work to
585*10465441SEvalZeroexpress in boolean abstraction of the inferred semantics of Kconfig to
586*10465441SEvalZerotranslate Kconfig logic into boolean formulas and run a SAT solver on this to
587*10465441SEvalZerofind dead code / features (always inactive), 114 dead features were found in
588*10465441SEvalZeroLinux using this methodology [1] (Section 8: Threats to validity).
589*10465441SEvalZero
590*10465441SEvalZeroConfirming this could prove useful as Kconfig stands as one of the the leading
591*10465441SEvalZeroindustrial variability modeling languages [1] [2]. Its study would help
592*10465441SEvalZeroevaluate practical uses of such languages, their use was only theoretical
593*10465441SEvalZeroand real world requirements were not well understood. As it stands though
594*10465441SEvalZeroonly reverse engineering techniques have been used to deduce semantics from
595*10465441SEvalZerovariability modeling languages such as Kconfig [3].
596*10465441SEvalZero
597*10465441SEvalZero[0] http://www.eng.uwaterloo.ca/~shshe/kconfig_semantics.pdf
598*10465441SEvalZero[1] http://gsd.uwaterloo.ca/sites/default/files/vm-2013-berger.pdf
599*10465441SEvalZero[2] http://gsd.uwaterloo.ca/sites/default/files/ase241-berger_0.pdf
600*10465441SEvalZero[3] http://gsd.uwaterloo.ca/sites/default/files/icse2011.pdf
601*10465441SEvalZero
602*10465441SEvalZeroFull SAT solver for Kconfig
603*10465441SEvalZero~~~~~~~~~~~~~~~~~~~~~~~~~~~
604*10465441SEvalZero
605*10465441SEvalZeroAlthough SAT solvers [0] haven't yet been used by Kconfig directly, as noted in
606*10465441SEvalZerothe previous subsection, work has been done however to express in boolean
607*10465441SEvalZeroabstraction the inferred semantics of Kconfig to translate Kconfig logic into
608*10465441SEvalZeroboolean formulas and run a SAT solver on it [1]. Another known related project
609*10465441SEvalZerois CADOS [2] (former VAMOS [3]) and the tools, mainly undertaker [4], which has
610*10465441SEvalZerobeen introduced first with [5].  The basic concept of undertaker is to exract
611*10465441SEvalZerovariability models from Kconfig, and put them together with a propositional
612*10465441SEvalZeroformula extracted from CPP #ifdefs and build-rules into a SAT solver in order
613*10465441SEvalZeroto find dead code, dead files, and dead symbols. If using a SAT solver is
614*10465441SEvalZerodesirable on Kconfig one approach would be to evaluate repurposing such efforts
615*10465441SEvalZerosomehow on Kconfig. There is enough interest from mentors of existing projects
616*10465441SEvalZeroto not only help advise how to integrate this work upstream but also help
617*10465441SEvalZeromaintain it long term. Interested developers should visit:
618*10465441SEvalZero
619*10465441SEvalZerohttp://kernelnewbies.org/KernelProjects/kconfig-sat
620*10465441SEvalZero
621*10465441SEvalZero[0] http://www.cs.cornell.edu/~sabhar/chapters/SATSolvers-KR-Handbook.pdf
622*10465441SEvalZero[1] http://gsd.uwaterloo.ca/sites/default/files/vm-2013-berger.pdf
623*10465441SEvalZero[2] https://cados.cs.fau.de
624*10465441SEvalZero[3] https://vamos.cs.fau.de
625*10465441SEvalZero[4] https://undertaker.cs.fau.de
626*10465441SEvalZero[5] https://www4.cs.fau.de/Publications/2011/tartler_11_eurosys.pdf
627