xref: /linux/Documentation/kbuild/kconfig-language.rst (revision cd238effefa28fac177e51dcf5e9d1a8b59c3c6b)
1*cd238effSMauro Carvalho Chehab================
2*cd238effSMauro Carvalho ChehabKconfig Language
3*cd238effSMauro Carvalho Chehab================
4*cd238effSMauro Carvalho Chehab
5*cd238effSMauro Carvalho ChehabIntroduction
6*cd238effSMauro Carvalho Chehab------------
7*cd238effSMauro Carvalho Chehab
8*cd238effSMauro Carvalho ChehabThe configuration database is a collection of configuration options
9*cd238effSMauro Carvalho Chehaborganized in a tree structure::
10*cd238effSMauro Carvalho Chehab
11*cd238effSMauro Carvalho Chehab	+- Code maturity level options
12*cd238effSMauro Carvalho Chehab	|  +- Prompt for development and/or incomplete code/drivers
13*cd238effSMauro Carvalho Chehab	+- General setup
14*cd238effSMauro Carvalho Chehab	|  +- Networking support
15*cd238effSMauro Carvalho Chehab	|  +- System V IPC
16*cd238effSMauro Carvalho Chehab	|  +- BSD Process Accounting
17*cd238effSMauro Carvalho Chehab	|  +- Sysctl support
18*cd238effSMauro Carvalho Chehab	+- Loadable module support
19*cd238effSMauro Carvalho Chehab	|  +- Enable loadable module support
20*cd238effSMauro Carvalho Chehab	|     +- Set version information on all module symbols
21*cd238effSMauro Carvalho Chehab	|     +- Kernel module loader
22*cd238effSMauro Carvalho Chehab	+- ...
23*cd238effSMauro Carvalho Chehab
24*cd238effSMauro Carvalho ChehabEvery entry has its own dependencies. These dependencies are used
25*cd238effSMauro Carvalho Chehabto determine the visibility of an entry. Any child entry is only
26*cd238effSMauro Carvalho Chehabvisible if its parent entry is also visible.
27*cd238effSMauro Carvalho Chehab
28*cd238effSMauro Carvalho ChehabMenu entries
29*cd238effSMauro Carvalho Chehab------------
30*cd238effSMauro Carvalho Chehab
31*cd238effSMauro Carvalho ChehabMost entries define a config option; all other entries help to organize
32*cd238effSMauro Carvalho Chehabthem. A single configuration option is defined like this::
33*cd238effSMauro Carvalho Chehab
34*cd238effSMauro Carvalho Chehab  config MODVERSIONS
35*cd238effSMauro Carvalho Chehab	bool "Set version information on all module symbols"
36*cd238effSMauro Carvalho Chehab	depends on MODULES
37*cd238effSMauro Carvalho Chehab	help
38*cd238effSMauro Carvalho Chehab	  Usually, modules have to be recompiled whenever you switch to a new
39*cd238effSMauro Carvalho Chehab	  kernel.  ...
40*cd238effSMauro Carvalho Chehab
41*cd238effSMauro Carvalho ChehabEvery line starts with a key word and can be followed by multiple
42*cd238effSMauro Carvalho Chehabarguments.  "config" starts a new config entry. The following lines
43*cd238effSMauro Carvalho Chehabdefine attributes for this config option. Attributes can be the type of
44*cd238effSMauro Carvalho Chehabthe config option, input prompt, dependencies, help text and default
45*cd238effSMauro Carvalho Chehabvalues. A config option can be defined multiple times with the same
46*cd238effSMauro Carvalho Chehabname, but every definition can have only a single input prompt and the
47*cd238effSMauro Carvalho Chehabtype must not conflict.
48*cd238effSMauro Carvalho Chehab
49*cd238effSMauro Carvalho ChehabMenu attributes
50*cd238effSMauro Carvalho Chehab---------------
51*cd238effSMauro Carvalho Chehab
52*cd238effSMauro Carvalho ChehabA menu entry can have a number of attributes. Not all of them are
53*cd238effSMauro Carvalho Chehabapplicable everywhere (see syntax).
54*cd238effSMauro Carvalho Chehab
55*cd238effSMauro Carvalho Chehab- type definition: "bool"/"tristate"/"string"/"hex"/"int"
56*cd238effSMauro Carvalho Chehab  Every config option must have a type. There are only two basic types:
57*cd238effSMauro Carvalho Chehab  tristate and string; the other types are based on these two. The type
58*cd238effSMauro Carvalho Chehab  definition optionally accepts an input prompt, so these two examples
59*cd238effSMauro Carvalho Chehab  are equivalent::
60*cd238effSMauro Carvalho Chehab
61*cd238effSMauro Carvalho Chehab	bool "Networking support"
62*cd238effSMauro Carvalho Chehab
63*cd238effSMauro Carvalho Chehab  and::
64*cd238effSMauro Carvalho Chehab
65*cd238effSMauro Carvalho Chehab	bool
66*cd238effSMauro Carvalho Chehab	prompt "Networking support"
67*cd238effSMauro Carvalho Chehab
68*cd238effSMauro Carvalho Chehab- input prompt: "prompt" <prompt> ["if" <expr>]
69*cd238effSMauro Carvalho Chehab  Every menu entry can have at most one prompt, which is used to display
70*cd238effSMauro Carvalho Chehab  to the user. Optionally dependencies only for this prompt can be added
71*cd238effSMauro Carvalho Chehab  with "if".
72*cd238effSMauro Carvalho Chehab
73*cd238effSMauro Carvalho Chehab- default value: "default" <expr> ["if" <expr>]
74*cd238effSMauro Carvalho Chehab  A config option can have any number of default values. If multiple
75*cd238effSMauro Carvalho Chehab  default values are visible, only the first defined one is active.
76*cd238effSMauro Carvalho Chehab  Default values are not limited to the menu entry where they are
77*cd238effSMauro Carvalho Chehab  defined. This means the default can be defined somewhere else or be
78*cd238effSMauro Carvalho Chehab  overridden by an earlier definition.
79*cd238effSMauro Carvalho Chehab  The default value is only assigned to the config symbol if no other
80*cd238effSMauro Carvalho Chehab  value was set by the user (via the input prompt above). If an input
81*cd238effSMauro Carvalho Chehab  prompt is visible the default value is presented to the user and can
82*cd238effSMauro Carvalho Chehab  be overridden by him.
83*cd238effSMauro Carvalho Chehab  Optionally, dependencies only for this default value can be added with
84*cd238effSMauro Carvalho Chehab  "if".
85*cd238effSMauro Carvalho Chehab
86*cd238effSMauro Carvalho Chehab The default value deliberately defaults to 'n' in order to avoid bloating the
87*cd238effSMauro Carvalho Chehab build. With few exceptions, new config options should not change this. The
88*cd238effSMauro Carvalho Chehab intent is for "make oldconfig" to add as little as possible to the config from
89*cd238effSMauro Carvalho Chehab release to release.
90*cd238effSMauro Carvalho Chehab
91*cd238effSMauro Carvalho Chehab Note:
92*cd238effSMauro Carvalho Chehab	Things that merit "default y/m" include:
93*cd238effSMauro Carvalho Chehab
94*cd238effSMauro Carvalho Chehab	a) A new Kconfig option for something that used to always be built
95*cd238effSMauro Carvalho Chehab	   should be "default y".
96*cd238effSMauro Carvalho Chehab
97*cd238effSMauro Carvalho Chehab	b) A new gatekeeping Kconfig option that hides/shows other Kconfig
98*cd238effSMauro Carvalho Chehab	   options (but does not generate any code of its own), should be
99*cd238effSMauro Carvalho Chehab	   "default y" so people will see those other options.
100*cd238effSMauro Carvalho Chehab
101*cd238effSMauro Carvalho Chehab	c) Sub-driver behavior or similar options for a driver that is
102*cd238effSMauro Carvalho Chehab	   "default n". This allows you to provide sane defaults.
103*cd238effSMauro Carvalho Chehab
104*cd238effSMauro Carvalho Chehab	d) Hardware or infrastructure that everybody expects, such as CONFIG_NET
105*cd238effSMauro Carvalho Chehab	   or CONFIG_BLOCK. These are rare exceptions.
106*cd238effSMauro Carvalho Chehab
107*cd238effSMauro Carvalho Chehab- type definition + default value::
108*cd238effSMauro Carvalho Chehab
109*cd238effSMauro Carvalho Chehab	"def_bool"/"def_tristate" <expr> ["if" <expr>]
110*cd238effSMauro Carvalho Chehab
111*cd238effSMauro Carvalho Chehab  This is a shorthand notation for a type definition plus a value.
112*cd238effSMauro Carvalho Chehab  Optionally dependencies for this default value can be added with "if".
113*cd238effSMauro Carvalho Chehab
114*cd238effSMauro Carvalho Chehab- dependencies: "depends on" <expr>
115*cd238effSMauro Carvalho Chehab  This defines a dependency for this menu entry. If multiple
116*cd238effSMauro Carvalho Chehab  dependencies are defined, they are connected with '&&'. Dependencies
117*cd238effSMauro Carvalho Chehab  are applied to all other options within this menu entry (which also
118*cd238effSMauro Carvalho Chehab  accept an "if" expression), so these two examples are equivalent::
119*cd238effSMauro Carvalho Chehab
120*cd238effSMauro Carvalho Chehab	bool "foo" if BAR
121*cd238effSMauro Carvalho Chehab	default y if BAR
122*cd238effSMauro Carvalho Chehab
123*cd238effSMauro Carvalho Chehab  and::
124*cd238effSMauro Carvalho Chehab
125*cd238effSMauro Carvalho Chehab	depends on BAR
126*cd238effSMauro Carvalho Chehab	bool "foo"
127*cd238effSMauro Carvalho Chehab	default y
128*cd238effSMauro Carvalho Chehab
129*cd238effSMauro Carvalho Chehab- reverse dependencies: "select" <symbol> ["if" <expr>]
130*cd238effSMauro Carvalho Chehab  While normal dependencies reduce the upper limit of a symbol (see
131*cd238effSMauro Carvalho Chehab  below), reverse dependencies can be used to force a lower limit of
132*cd238effSMauro Carvalho Chehab  another symbol. The value of the current menu symbol is used as the
133*cd238effSMauro Carvalho Chehab  minimal value <symbol> can be set to. If <symbol> is selected multiple
134*cd238effSMauro Carvalho Chehab  times, the limit is set to the largest selection.
135*cd238effSMauro Carvalho Chehab  Reverse dependencies can only be used with boolean or tristate
136*cd238effSMauro Carvalho Chehab  symbols.
137*cd238effSMauro Carvalho Chehab
138*cd238effSMauro Carvalho Chehab  Note:
139*cd238effSMauro Carvalho Chehab	select should be used with care. select will force
140*cd238effSMauro Carvalho Chehab	a symbol to a value without visiting the dependencies.
141*cd238effSMauro Carvalho Chehab	By abusing select you are able to select a symbol FOO even
142*cd238effSMauro Carvalho Chehab	if FOO depends on BAR that is not set.
143*cd238effSMauro Carvalho Chehab	In general use select only for non-visible symbols
144*cd238effSMauro Carvalho Chehab	(no prompts anywhere) and for symbols with no dependencies.
145*cd238effSMauro Carvalho Chehab	That will limit the usefulness but on the other hand avoid
146*cd238effSMauro Carvalho Chehab	the illegal configurations all over.
147*cd238effSMauro Carvalho Chehab
148*cd238effSMauro Carvalho Chehab- weak reverse dependencies: "imply" <symbol> ["if" <expr>]
149*cd238effSMauro Carvalho Chehab  This is similar to "select" as it enforces a lower limit on another
150*cd238effSMauro Carvalho Chehab  symbol except that the "implied" symbol's value may still be set to n
151*cd238effSMauro Carvalho Chehab  from a direct dependency or with a visible prompt.
152*cd238effSMauro Carvalho Chehab
153*cd238effSMauro Carvalho Chehab  Given the following example::
154*cd238effSMauro Carvalho Chehab
155*cd238effSMauro Carvalho Chehab    config FOO
156*cd238effSMauro Carvalho Chehab	tristate
157*cd238effSMauro Carvalho Chehab	imply BAZ
158*cd238effSMauro Carvalho Chehab
159*cd238effSMauro Carvalho Chehab    config BAZ
160*cd238effSMauro Carvalho Chehab	tristate
161*cd238effSMauro Carvalho Chehab	depends on BAR
162*cd238effSMauro Carvalho Chehab
163*cd238effSMauro Carvalho Chehab  The following values are possible:
164*cd238effSMauro Carvalho Chehab
165*cd238effSMauro Carvalho Chehab	===		===		=============	==============
166*cd238effSMauro Carvalho Chehab	FOO		BAR		BAZ's default	choice for BAZ
167*cd238effSMauro Carvalho Chehab	===		===		=============	==============
168*cd238effSMauro Carvalho Chehab	n		y		n		N/m/y
169*cd238effSMauro Carvalho Chehab	m		y		m		M/y/n
170*cd238effSMauro Carvalho Chehab	y		y		y		Y/n
171*cd238effSMauro Carvalho Chehab	y		n		*		N
172*cd238effSMauro Carvalho Chehab	===		===		=============	==============
173*cd238effSMauro Carvalho Chehab
174*cd238effSMauro Carvalho Chehab  This is useful e.g. with multiple drivers that want to indicate their
175*cd238effSMauro Carvalho Chehab  ability to hook into a secondary subsystem while allowing the user to
176*cd238effSMauro Carvalho Chehab  configure that subsystem out without also having to unset these drivers.
177*cd238effSMauro Carvalho Chehab
178*cd238effSMauro Carvalho Chehab- limiting menu display: "visible if" <expr>
179*cd238effSMauro Carvalho Chehab  This attribute is only applicable to menu blocks, if the condition is
180*cd238effSMauro Carvalho Chehab  false, the menu block is not displayed to the user (the symbols
181*cd238effSMauro Carvalho Chehab  contained there can still be selected by other symbols, though). It is
182*cd238effSMauro Carvalho Chehab  similar to a conditional "prompt" attribute for individual menu
183*cd238effSMauro Carvalho Chehab  entries. Default value of "visible" is true.
184*cd238effSMauro Carvalho Chehab
185*cd238effSMauro Carvalho Chehab- numerical ranges: "range" <symbol> <symbol> ["if" <expr>]
186*cd238effSMauro Carvalho Chehab  This allows to limit the range of possible input values for int
187*cd238effSMauro Carvalho Chehab  and hex symbols. The user can only input a value which is larger than
188*cd238effSMauro Carvalho Chehab  or equal to the first symbol and smaller than or equal to the second
189*cd238effSMauro Carvalho Chehab  symbol.
190*cd238effSMauro Carvalho Chehab
191*cd238effSMauro Carvalho Chehab- help text: "help" or "---help---"
192*cd238effSMauro Carvalho Chehab  This defines a help text. The end of the help text is determined by
193*cd238effSMauro Carvalho Chehab  the indentation level, this means it ends at the first line which has
194*cd238effSMauro Carvalho Chehab  a smaller indentation than the first line of the help text.
195*cd238effSMauro Carvalho Chehab  "---help---" and "help" do not differ in behaviour, "---help---" is
196*cd238effSMauro Carvalho Chehab  used to help visually separate configuration logic from help within
197*cd238effSMauro Carvalho Chehab  the file as an aid to developers.
198*cd238effSMauro Carvalho Chehab
199*cd238effSMauro Carvalho Chehab- misc options: "option" <symbol>[=<value>]
200*cd238effSMauro Carvalho Chehab  Various less common options can be defined via this option syntax,
201*cd238effSMauro Carvalho Chehab  which can modify the behaviour of the menu entry and its config
202*cd238effSMauro Carvalho Chehab  symbol. These options are currently possible:
203*cd238effSMauro Carvalho Chehab
204*cd238effSMauro Carvalho Chehab  - "defconfig_list"
205*cd238effSMauro Carvalho Chehab    This declares a list of default entries which can be used when
206*cd238effSMauro Carvalho Chehab    looking for the default configuration (which is used when the main
207*cd238effSMauro Carvalho Chehab    .config doesn't exists yet.)
208*cd238effSMauro Carvalho Chehab
209*cd238effSMauro Carvalho Chehab  - "modules"
210*cd238effSMauro Carvalho Chehab    This declares the symbol to be used as the MODULES symbol, which
211*cd238effSMauro Carvalho Chehab    enables the third modular state for all config symbols.
212*cd238effSMauro Carvalho Chehab    At most one symbol may have the "modules" option set.
213*cd238effSMauro Carvalho Chehab
214*cd238effSMauro Carvalho Chehab  - "allnoconfig_y"
215*cd238effSMauro Carvalho Chehab    This declares the symbol as one that should have the value y when
216*cd238effSMauro Carvalho Chehab    using "allnoconfig". Used for symbols that hide other symbols.
217*cd238effSMauro Carvalho Chehab
218*cd238effSMauro Carvalho ChehabMenu dependencies
219*cd238effSMauro Carvalho Chehab-----------------
220*cd238effSMauro Carvalho Chehab
221*cd238effSMauro Carvalho ChehabDependencies define the visibility of a menu entry and can also reduce
222*cd238effSMauro Carvalho Chehabthe input range of tristate symbols. The tristate logic used in the
223*cd238effSMauro Carvalho Chehabexpressions uses one more state than normal boolean logic to express the
224*cd238effSMauro Carvalho Chehabmodule state. Dependency expressions have the following syntax::
225*cd238effSMauro Carvalho Chehab
226*cd238effSMauro Carvalho Chehab  <expr> ::= <symbol>                           (1)
227*cd238effSMauro Carvalho Chehab           <symbol> '=' <symbol>                (2)
228*cd238effSMauro Carvalho Chehab           <symbol> '!=' <symbol>               (3)
229*cd238effSMauro Carvalho Chehab           <symbol1> '<' <symbol2>              (4)
230*cd238effSMauro Carvalho Chehab           <symbol1> '>' <symbol2>              (4)
231*cd238effSMauro Carvalho Chehab           <symbol1> '<=' <symbol2>             (4)
232*cd238effSMauro Carvalho Chehab           <symbol1> '>=' <symbol2>             (4)
233*cd238effSMauro Carvalho Chehab           '(' <expr> ')'                       (5)
234*cd238effSMauro Carvalho Chehab           '!' <expr>                           (6)
235*cd238effSMauro Carvalho Chehab           <expr> '&&' <expr>                   (7)
236*cd238effSMauro Carvalho Chehab           <expr> '||' <expr>                   (8)
237*cd238effSMauro Carvalho Chehab
238*cd238effSMauro Carvalho ChehabExpressions are listed in decreasing order of precedence.
239*cd238effSMauro Carvalho Chehab
240*cd238effSMauro Carvalho Chehab(1) Convert the symbol into an expression. Boolean and tristate symbols
241*cd238effSMauro Carvalho Chehab    are simply converted into the respective expression values. All
242*cd238effSMauro Carvalho Chehab    other symbol types result in 'n'.
243*cd238effSMauro Carvalho Chehab(2) If the values of both symbols are equal, it returns 'y',
244*cd238effSMauro Carvalho Chehab    otherwise 'n'.
245*cd238effSMauro Carvalho Chehab(3) If the values of both symbols are equal, it returns 'n',
246*cd238effSMauro Carvalho Chehab    otherwise 'y'.
247*cd238effSMauro Carvalho Chehab(4) If value of <symbol1> is respectively lower, greater, lower-or-equal,
248*cd238effSMauro Carvalho Chehab    or greater-or-equal than value of <symbol2>, it returns 'y',
249*cd238effSMauro Carvalho Chehab    otherwise 'n'.
250*cd238effSMauro Carvalho Chehab(5) Returns the value of the expression. Used to override precedence.
251*cd238effSMauro Carvalho Chehab(6) Returns the result of (2-/expr/).
252*cd238effSMauro Carvalho Chehab(7) Returns the result of min(/expr/, /expr/).
253*cd238effSMauro Carvalho Chehab(8) Returns the result of max(/expr/, /expr/).
254*cd238effSMauro Carvalho Chehab
255*cd238effSMauro Carvalho ChehabAn expression can have a value of 'n', 'm' or 'y' (or 0, 1, 2
256*cd238effSMauro Carvalho Chehabrespectively for calculations). A menu entry becomes visible when its
257*cd238effSMauro Carvalho Chehabexpression evaluates to 'm' or 'y'.
258*cd238effSMauro Carvalho Chehab
259*cd238effSMauro Carvalho ChehabThere are two types of symbols: constant and non-constant symbols.
260*cd238effSMauro Carvalho ChehabNon-constant symbols are the most common ones and are defined with the
261*cd238effSMauro Carvalho Chehab'config' statement. Non-constant symbols consist entirely of alphanumeric
262*cd238effSMauro Carvalho Chehabcharacters or underscores.
263*cd238effSMauro Carvalho ChehabConstant symbols are only part of expressions. Constant symbols are
264*cd238effSMauro Carvalho Chehabalways surrounded by single or double quotes. Within the quote, any
265*cd238effSMauro Carvalho Chehabother character is allowed and the quotes can be escaped using '\'.
266*cd238effSMauro Carvalho Chehab
267*cd238effSMauro Carvalho ChehabMenu structure
268*cd238effSMauro Carvalho Chehab--------------
269*cd238effSMauro Carvalho Chehab
270*cd238effSMauro Carvalho ChehabThe position of a menu entry in the tree is determined in two ways. First
271*cd238effSMauro Carvalho Chehabit can be specified explicitly::
272*cd238effSMauro Carvalho Chehab
273*cd238effSMauro Carvalho Chehab  menu "Network device support"
274*cd238effSMauro Carvalho Chehab	depends on NET
275*cd238effSMauro Carvalho Chehab
276*cd238effSMauro Carvalho Chehab  config NETDEVICES
277*cd238effSMauro Carvalho Chehab	...
278*cd238effSMauro Carvalho Chehab
279*cd238effSMauro Carvalho Chehab  endmenu
280*cd238effSMauro Carvalho Chehab
281*cd238effSMauro Carvalho ChehabAll entries within the "menu" ... "endmenu" block become a submenu of
282*cd238effSMauro Carvalho Chehab"Network device support". All subentries inherit the dependencies from
283*cd238effSMauro Carvalho Chehabthe menu entry, e.g. this means the dependency "NET" is added to the
284*cd238effSMauro Carvalho Chehabdependency list of the config option NETDEVICES.
285*cd238effSMauro Carvalho Chehab
286*cd238effSMauro Carvalho ChehabThe other way to generate the menu structure is done by analyzing the
287*cd238effSMauro Carvalho Chehabdependencies. If a menu entry somehow depends on the previous entry, it
288*cd238effSMauro Carvalho Chehabcan be made a submenu of it. First, the previous (parent) symbol must
289*cd238effSMauro Carvalho Chehabbe part of the dependency list and then one of these two conditions
290*cd238effSMauro Carvalho Chehabmust be true:
291*cd238effSMauro Carvalho Chehab
292*cd238effSMauro Carvalho Chehab- the child entry must become invisible, if the parent is set to 'n'
293*cd238effSMauro Carvalho Chehab- the child entry must only be visible, if the parent is visible::
294*cd238effSMauro Carvalho Chehab
295*cd238effSMauro Carvalho Chehab    config MODULES
296*cd238effSMauro Carvalho Chehab	bool "Enable loadable module support"
297*cd238effSMauro Carvalho Chehab
298*cd238effSMauro Carvalho Chehab    config MODVERSIONS
299*cd238effSMauro Carvalho Chehab	bool "Set version information on all module symbols"
300*cd238effSMauro Carvalho Chehab	depends on MODULES
301*cd238effSMauro Carvalho Chehab
302*cd238effSMauro Carvalho Chehab    comment "module support disabled"
303*cd238effSMauro Carvalho Chehab	depends on !MODULES
304*cd238effSMauro Carvalho Chehab
305*cd238effSMauro Carvalho ChehabMODVERSIONS directly depends on MODULES, this means it's only visible if
306*cd238effSMauro Carvalho ChehabMODULES is different from 'n'. The comment on the other hand is only
307*cd238effSMauro Carvalho Chehabvisible when MODULES is set to 'n'.
308*cd238effSMauro Carvalho Chehab
309*cd238effSMauro Carvalho Chehab
310*cd238effSMauro Carvalho ChehabKconfig syntax
311*cd238effSMauro Carvalho Chehab--------------
312*cd238effSMauro Carvalho Chehab
313*cd238effSMauro Carvalho ChehabThe configuration file describes a series of menu entries, where every
314*cd238effSMauro Carvalho Chehabline starts with a keyword (except help texts). The following keywords
315*cd238effSMauro Carvalho Chehabend a menu entry:
316*cd238effSMauro Carvalho Chehab
317*cd238effSMauro Carvalho Chehab- config
318*cd238effSMauro Carvalho Chehab- menuconfig
319*cd238effSMauro Carvalho Chehab- choice/endchoice
320*cd238effSMauro Carvalho Chehab- comment
321*cd238effSMauro Carvalho Chehab- menu/endmenu
322*cd238effSMauro Carvalho Chehab- if/endif
323*cd238effSMauro Carvalho Chehab- source
324*cd238effSMauro Carvalho Chehab
325*cd238effSMauro Carvalho ChehabThe first five also start the definition of a menu entry.
326*cd238effSMauro Carvalho Chehab
327*cd238effSMauro Carvalho Chehabconfig::
328*cd238effSMauro Carvalho Chehab	"config" <symbol>
329*cd238effSMauro Carvalho Chehab	<config options>
330*cd238effSMauro Carvalho Chehab
331*cd238effSMauro Carvalho ChehabThis defines a config symbol <symbol> and accepts any of above
332*cd238effSMauro Carvalho Chehabattributes as options.
333*cd238effSMauro Carvalho Chehab
334*cd238effSMauro Carvalho Chehabmenuconfig::
335*cd238effSMauro Carvalho Chehab	"menuconfig" <symbol>
336*cd238effSMauro Carvalho Chehab	<config options>
337*cd238effSMauro Carvalho Chehab
338*cd238effSMauro Carvalho ChehabThis is similar to the simple config entry above, but it also gives a
339*cd238effSMauro Carvalho Chehabhint to front ends, that all suboptions should be displayed as a
340*cd238effSMauro Carvalho Chehabseparate list of options. To make sure all the suboptions will really
341*cd238effSMauro Carvalho Chehabshow up under the menuconfig entry and not outside of it, every item
342*cd238effSMauro Carvalho Chehabfrom the <config options> list must depend on the menuconfig symbol.
343*cd238effSMauro Carvalho ChehabIn practice, this is achieved by using one of the next two constructs::
344*cd238effSMauro Carvalho Chehab
345*cd238effSMauro Carvalho Chehab  (1):
346*cd238effSMauro Carvalho Chehab  menuconfig M
347*cd238effSMauro Carvalho Chehab  if M
348*cd238effSMauro Carvalho Chehab      config C1
349*cd238effSMauro Carvalho Chehab      config C2
350*cd238effSMauro Carvalho Chehab  endif
351*cd238effSMauro Carvalho Chehab
352*cd238effSMauro Carvalho Chehab  (2):
353*cd238effSMauro Carvalho Chehab  menuconfig M
354*cd238effSMauro Carvalho Chehab  config C1
355*cd238effSMauro Carvalho Chehab      depends on M
356*cd238effSMauro Carvalho Chehab  config C2
357*cd238effSMauro Carvalho Chehab      depends on M
358*cd238effSMauro Carvalho Chehab
359*cd238effSMauro Carvalho ChehabIn the following examples (3) and (4), C1 and C2 still have the M
360*cd238effSMauro Carvalho Chehabdependency, but will not appear under menuconfig M anymore, because
361*cd238effSMauro Carvalho Chehabof C0, which doesn't depend on M::
362*cd238effSMauro Carvalho Chehab
363*cd238effSMauro Carvalho Chehab  (3):
364*cd238effSMauro Carvalho Chehab  menuconfig M
365*cd238effSMauro Carvalho Chehab      config C0
366*cd238effSMauro Carvalho Chehab  if M
367*cd238effSMauro Carvalho Chehab      config C1
368*cd238effSMauro Carvalho Chehab      config C2
369*cd238effSMauro Carvalho Chehab  endif
370*cd238effSMauro Carvalho Chehab
371*cd238effSMauro Carvalho Chehab  (4):
372*cd238effSMauro Carvalho Chehab  menuconfig M
373*cd238effSMauro Carvalho Chehab  config C0
374*cd238effSMauro Carvalho Chehab  config C1
375*cd238effSMauro Carvalho Chehab      depends on M
376*cd238effSMauro Carvalho Chehab  config C2
377*cd238effSMauro Carvalho Chehab      depends on M
378*cd238effSMauro Carvalho Chehab
379*cd238effSMauro Carvalho Chehabchoices::
380*cd238effSMauro Carvalho Chehab
381*cd238effSMauro Carvalho Chehab	"choice" [symbol]
382*cd238effSMauro Carvalho Chehab	<choice options>
383*cd238effSMauro Carvalho Chehab	<choice block>
384*cd238effSMauro Carvalho Chehab	"endchoice"
385*cd238effSMauro Carvalho Chehab
386*cd238effSMauro Carvalho ChehabThis defines a choice group and accepts any of the above attributes as
387*cd238effSMauro Carvalho Chehaboptions. A choice can only be of type bool or tristate.  If no type is
388*cd238effSMauro Carvalho Chehabspecified for a choice, its type will be determined by the type of
389*cd238effSMauro Carvalho Chehabthe first choice element in the group or remain unknown if none of the
390*cd238effSMauro Carvalho Chehabchoice elements have a type specified, as well.
391*cd238effSMauro Carvalho Chehab
392*cd238effSMauro Carvalho ChehabWhile a boolean choice only allows a single config entry to be
393*cd238effSMauro Carvalho Chehabselected, a tristate choice also allows any number of config entries
394*cd238effSMauro Carvalho Chehabto be set to 'm'. This can be used if multiple drivers for a single
395*cd238effSMauro Carvalho Chehabhardware exists and only a single driver can be compiled/loaded into
396*cd238effSMauro Carvalho Chehabthe kernel, but all drivers can be compiled as modules.
397*cd238effSMauro Carvalho Chehab
398*cd238effSMauro Carvalho ChehabA choice accepts another option "optional", which allows to set the
399*cd238effSMauro Carvalho Chehabchoice to 'n' and no entry needs to be selected.
400*cd238effSMauro Carvalho ChehabIf no [symbol] is associated with a choice, then you can not have multiple
401*cd238effSMauro Carvalho Chehabdefinitions of that choice. If a [symbol] is associated to the choice,
402*cd238effSMauro Carvalho Chehabthen you may define the same choice (i.e. with the same entries) in another
403*cd238effSMauro Carvalho Chehabplace.
404*cd238effSMauro Carvalho Chehab
405*cd238effSMauro Carvalho Chehabcomment::
406*cd238effSMauro Carvalho Chehab
407*cd238effSMauro Carvalho Chehab	"comment" <prompt>
408*cd238effSMauro Carvalho Chehab	<comment options>
409*cd238effSMauro Carvalho Chehab
410*cd238effSMauro Carvalho ChehabThis defines a comment which is displayed to the user during the
411*cd238effSMauro Carvalho Chehabconfiguration process and is also echoed to the output files. The only
412*cd238effSMauro Carvalho Chehabpossible options are dependencies.
413*cd238effSMauro Carvalho Chehab
414*cd238effSMauro Carvalho Chehabmenu::
415*cd238effSMauro Carvalho Chehab
416*cd238effSMauro Carvalho Chehab	"menu" <prompt>
417*cd238effSMauro Carvalho Chehab	<menu options>
418*cd238effSMauro Carvalho Chehab	<menu block>
419*cd238effSMauro Carvalho Chehab	"endmenu"
420*cd238effSMauro Carvalho Chehab
421*cd238effSMauro Carvalho ChehabThis defines a menu block, see "Menu structure" above for more
422*cd238effSMauro Carvalho Chehabinformation. The only possible options are dependencies and "visible"
423*cd238effSMauro Carvalho Chehabattributes.
424*cd238effSMauro Carvalho Chehab
425*cd238effSMauro Carvalho Chehabif::
426*cd238effSMauro Carvalho Chehab
427*cd238effSMauro Carvalho Chehab	"if" <expr>
428*cd238effSMauro Carvalho Chehab	<if block>
429*cd238effSMauro Carvalho Chehab	"endif"
430*cd238effSMauro Carvalho Chehab
431*cd238effSMauro Carvalho ChehabThis defines an if block. The dependency expression <expr> is appended
432*cd238effSMauro Carvalho Chehabto all enclosed menu entries.
433*cd238effSMauro Carvalho Chehab
434*cd238effSMauro Carvalho Chehabsource::
435*cd238effSMauro Carvalho Chehab
436*cd238effSMauro Carvalho Chehab	"source" <prompt>
437*cd238effSMauro Carvalho Chehab
438*cd238effSMauro Carvalho ChehabThis reads the specified configuration file. This file is always parsed.
439*cd238effSMauro Carvalho Chehab
440*cd238effSMauro Carvalho Chehabmainmenu::
441*cd238effSMauro Carvalho Chehab
442*cd238effSMauro Carvalho Chehab	"mainmenu" <prompt>
443*cd238effSMauro Carvalho Chehab
444*cd238effSMauro Carvalho ChehabThis sets the config program's title bar if the config program chooses
445*cd238effSMauro Carvalho Chehabto use it. It should be placed at the top of the configuration, before any
446*cd238effSMauro Carvalho Chehabother statement.
447*cd238effSMauro Carvalho Chehab
448*cd238effSMauro Carvalho Chehab'#' Kconfig source file comment:
449*cd238effSMauro Carvalho Chehab
450*cd238effSMauro Carvalho ChehabAn unquoted '#' character anywhere in a source file line indicates
451*cd238effSMauro Carvalho Chehabthe beginning of a source file comment.  The remainder of that line
452*cd238effSMauro Carvalho Chehabis a comment.
453*cd238effSMauro Carvalho Chehab
454*cd238effSMauro Carvalho Chehab
455*cd238effSMauro Carvalho ChehabKconfig hints
456*cd238effSMauro Carvalho Chehab-------------
457*cd238effSMauro Carvalho ChehabThis is a collection of Kconfig tips, most of which aren't obvious at
458*cd238effSMauro Carvalho Chehabfirst glance and most of which have become idioms in several Kconfig
459*cd238effSMauro Carvalho Chehabfiles.
460*cd238effSMauro Carvalho Chehab
461*cd238effSMauro Carvalho ChehabAdding common features and make the usage configurable
462*cd238effSMauro Carvalho Chehab~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
463*cd238effSMauro Carvalho ChehabIt is a common idiom to implement a feature/functionality that are
464*cd238effSMauro Carvalho Chehabrelevant for some architectures but not all.
465*cd238effSMauro Carvalho ChehabThe recommended way to do so is to use a config variable named HAVE_*
466*cd238effSMauro Carvalho Chehabthat is defined in a common Kconfig file and selected by the relevant
467*cd238effSMauro Carvalho Chehabarchitectures.
468*cd238effSMauro Carvalho ChehabAn example is the generic IOMAP functionality.
469*cd238effSMauro Carvalho Chehab
470*cd238effSMauro Carvalho ChehabWe would in lib/Kconfig see::
471*cd238effSMauro Carvalho Chehab
472*cd238effSMauro Carvalho Chehab  # Generic IOMAP is used to ...
473*cd238effSMauro Carvalho Chehab  config HAVE_GENERIC_IOMAP
474*cd238effSMauro Carvalho Chehab
475*cd238effSMauro Carvalho Chehab  config GENERIC_IOMAP
476*cd238effSMauro Carvalho Chehab	depends on HAVE_GENERIC_IOMAP && FOO
477*cd238effSMauro Carvalho Chehab
478*cd238effSMauro Carvalho ChehabAnd in lib/Makefile we would see::
479*cd238effSMauro Carvalho Chehab
480*cd238effSMauro Carvalho Chehab	obj-$(CONFIG_GENERIC_IOMAP) += iomap.o
481*cd238effSMauro Carvalho Chehab
482*cd238effSMauro Carvalho ChehabFor each architecture using the generic IOMAP functionality we would see::
483*cd238effSMauro Carvalho Chehab
484*cd238effSMauro Carvalho Chehab  config X86
485*cd238effSMauro Carvalho Chehab	select ...
486*cd238effSMauro Carvalho Chehab	select HAVE_GENERIC_IOMAP
487*cd238effSMauro Carvalho Chehab	select ...
488*cd238effSMauro Carvalho Chehab
489*cd238effSMauro Carvalho ChehabNote: we use the existing config option and avoid creating a new
490*cd238effSMauro Carvalho Chehabconfig variable to select HAVE_GENERIC_IOMAP.
491*cd238effSMauro Carvalho Chehab
492*cd238effSMauro Carvalho ChehabNote: the use of the internal config variable HAVE_GENERIC_IOMAP, it is
493*cd238effSMauro Carvalho Chehabintroduced to overcome the limitation of select which will force a
494*cd238effSMauro Carvalho Chehabconfig option to 'y' no matter the dependencies.
495*cd238effSMauro Carvalho ChehabThe dependencies are moved to the symbol GENERIC_IOMAP and we avoid the
496*cd238effSMauro Carvalho Chehabsituation where select forces a symbol equals to 'y'.
497*cd238effSMauro Carvalho Chehab
498*cd238effSMauro Carvalho ChehabAdding features that need compiler support
499*cd238effSMauro Carvalho Chehab~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
500*cd238effSMauro Carvalho Chehab
501*cd238effSMauro Carvalho ChehabThere are several features that need compiler support. The recommended way
502*cd238effSMauro Carvalho Chehabto describe the dependency on the compiler feature is to use "depends on"
503*cd238effSMauro Carvalho Chehabfollowed by a test macro::
504*cd238effSMauro Carvalho Chehab
505*cd238effSMauro Carvalho Chehab  config STACKPROTECTOR
506*cd238effSMauro Carvalho Chehab	bool "Stack Protector buffer overflow detection"
507*cd238effSMauro Carvalho Chehab	depends on $(cc-option,-fstack-protector)
508*cd238effSMauro Carvalho Chehab	...
509*cd238effSMauro Carvalho Chehab
510*cd238effSMauro Carvalho ChehabIf you need to expose a compiler capability to makefiles and/or C source files,
511*cd238effSMauro Carvalho Chehab`CC_HAS_` is the recommended prefix for the config option::
512*cd238effSMauro Carvalho Chehab
513*cd238effSMauro Carvalho Chehab  config CC_HAS_STACKPROTECTOR_NONE
514*cd238effSMauro Carvalho Chehab	def_bool $(cc-option,-fno-stack-protector)
515*cd238effSMauro Carvalho Chehab
516*cd238effSMauro Carvalho ChehabBuild as module only
517*cd238effSMauro Carvalho Chehab~~~~~~~~~~~~~~~~~~~~
518*cd238effSMauro Carvalho ChehabTo restrict a component build to module-only, qualify its config symbol
519*cd238effSMauro Carvalho Chehabwith "depends on m".  E.g.::
520*cd238effSMauro Carvalho Chehab
521*cd238effSMauro Carvalho Chehab  config FOO
522*cd238effSMauro Carvalho Chehab	depends on BAR && m
523*cd238effSMauro Carvalho Chehab
524*cd238effSMauro Carvalho Chehablimits FOO to module (=m) or disabled (=n).
525*cd238effSMauro Carvalho Chehab
526*cd238effSMauro Carvalho ChehabKconfig recursive dependency limitations
527*cd238effSMauro Carvalho Chehab~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
528*cd238effSMauro Carvalho Chehab
529*cd238effSMauro Carvalho ChehabIf you've hit the Kconfig error: "recursive dependency detected" you've run
530*cd238effSMauro Carvalho Chehabinto a recursive dependency issue with Kconfig, a recursive dependency can be
531*cd238effSMauro Carvalho Chehabsummarized as a circular dependency. The kconfig tools need to ensure that
532*cd238effSMauro Carvalho ChehabKconfig files comply with specified configuration requirements. In order to do
533*cd238effSMauro Carvalho Chehabthat kconfig must determine the values that are possible for all Kconfig
534*cd238effSMauro Carvalho Chehabsymbols, this is currently not possible if there is a circular relation
535*cd238effSMauro Carvalho Chehabbetween two or more Kconfig symbols. For more details refer to the "Simple
536*cd238effSMauro Carvalho ChehabKconfig recursive issue" subsection below. Kconfig does not do recursive
537*cd238effSMauro Carvalho Chehabdependency resolution; this has a few implications for Kconfig file writers.
538*cd238effSMauro Carvalho ChehabWe'll first explain why this issues exists and then provide an example
539*cd238effSMauro Carvalho Chehabtechnical limitation which this brings upon Kconfig developers. Eager
540*cd238effSMauro Carvalho Chehabdevelopers wishing to try to address this limitation should read the next
541*cd238effSMauro Carvalho Chehabsubsections.
542*cd238effSMauro Carvalho Chehab
543*cd238effSMauro Carvalho ChehabSimple Kconfig recursive issue
544*cd238effSMauro Carvalho Chehab~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
545*cd238effSMauro Carvalho Chehab
546*cd238effSMauro Carvalho ChehabRead: Documentation/kbuild/Kconfig.recursion-issue-01
547*cd238effSMauro Carvalho Chehab
548*cd238effSMauro Carvalho ChehabTest with::
549*cd238effSMauro Carvalho Chehab
550*cd238effSMauro Carvalho Chehab  make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-01 allnoconfig
551*cd238effSMauro Carvalho Chehab
552*cd238effSMauro Carvalho ChehabCumulative Kconfig recursive issue
553*cd238effSMauro Carvalho Chehab~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
554*cd238effSMauro Carvalho Chehab
555*cd238effSMauro Carvalho ChehabRead: Documentation/kbuild/Kconfig.recursion-issue-02
556*cd238effSMauro Carvalho Chehab
557*cd238effSMauro Carvalho ChehabTest with::
558*cd238effSMauro Carvalho Chehab
559*cd238effSMauro Carvalho Chehab  make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-02 allnoconfig
560*cd238effSMauro Carvalho Chehab
561*cd238effSMauro Carvalho ChehabPractical solutions to kconfig recursive issue
562*cd238effSMauro Carvalho Chehab~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
563*cd238effSMauro Carvalho Chehab
564*cd238effSMauro Carvalho ChehabDevelopers who run into the recursive Kconfig issue have two options
565*cd238effSMauro Carvalho Chehabat their disposal. We document them below and also provide a list of
566*cd238effSMauro Carvalho Chehabhistorical issues resolved through these different solutions.
567*cd238effSMauro Carvalho Chehab
568*cd238effSMauro Carvalho Chehab  a) Remove any superfluous "select FOO" or "depends on FOO"
569*cd238effSMauro Carvalho Chehab  b) Match dependency semantics:
570*cd238effSMauro Carvalho Chehab
571*cd238effSMauro Carvalho Chehab	b1) Swap all "select FOO" to "depends on FOO" or,
572*cd238effSMauro Carvalho Chehab
573*cd238effSMauro Carvalho Chehab	b2) Swap all "depends on FOO" to "select FOO"
574*cd238effSMauro Carvalho Chehab
575*cd238effSMauro Carvalho ChehabThe resolution to a) can be tested with the sample Kconfig file
576*cd238effSMauro Carvalho ChehabDocumentation/kbuild/Kconfig.recursion-issue-01 through the removal
577*cd238effSMauro Carvalho Chehabof the "select CORE" from CORE_BELL_A_ADVANCED as that is implicit already
578*cd238effSMauro Carvalho Chehabsince CORE_BELL_A depends on CORE. At times it may not be possible to remove
579*cd238effSMauro Carvalho Chehabsome dependency criteria, for such cases you can work with solution b).
580*cd238effSMauro Carvalho Chehab
581*cd238effSMauro Carvalho ChehabThe two different resolutions for b) can be tested in the sample Kconfig file
582*cd238effSMauro Carvalho ChehabDocumentation/kbuild/Kconfig.recursion-issue-02.
583*cd238effSMauro Carvalho Chehab
584*cd238effSMauro Carvalho ChehabBelow is a list of examples of prior fixes for these types of recursive issues;
585*cd238effSMauro Carvalho Chehaball errors appear to involve one or more select's and one or more "depends on".
586*cd238effSMauro Carvalho Chehab
587*cd238effSMauro Carvalho Chehab============    ===================================
588*cd238effSMauro Carvalho Chehabcommit          fix
589*cd238effSMauro Carvalho Chehab============    ===================================
590*cd238effSMauro Carvalho Chehab06b718c01208    select A -> depends on A
591*cd238effSMauro Carvalho Chehabc22eacfe82f9    depends on A -> depends on B
592*cd238effSMauro Carvalho Chehab6a91e854442c    select A -> depends on A
593*cd238effSMauro Carvalho Chehab118c565a8f2e    select A -> select B
594*cd238effSMauro Carvalho Chehabf004e5594705    select A -> depends on A
595*cd238effSMauro Carvalho Chehabc7861f37b4c6    depends on A -> (null)
596*cd238effSMauro Carvalho Chehab80c69915e5fb    select A -> (null)              (1)
597*cd238effSMauro Carvalho Chehabc2218e26c0d0    select A -> depends on A        (1)
598*cd238effSMauro Carvalho Chehabd6ae99d04e1c    select A -> depends on A
599*cd238effSMauro Carvalho Chehab95ca19cf8cbf    select A -> depends on A
600*cd238effSMauro Carvalho Chehab8f057d7bca54    depends on A -> (null)
601*cd238effSMauro Carvalho Chehab8f057d7bca54    depends on A -> select A
602*cd238effSMauro Carvalho Chehaba0701f04846e    select A -> depends on A
603*cd238effSMauro Carvalho Chehab0c8b92f7f259    depends on A -> (null)
604*cd238effSMauro Carvalho Chehabe4e9e0540928    select A -> depends on A        (2)
605*cd238effSMauro Carvalho Chehab7453ea886e87    depends on A > (null)           (1)
606*cd238effSMauro Carvalho Chehab7b1fff7e4fdf    select A -> depends on A
607*cd238effSMauro Carvalho Chehab86c747d2a4f0    select A -> depends on A
608*cd238effSMauro Carvalho Chehabd9f9ab51e55e    select A -> depends on A
609*cd238effSMauro Carvalho Chehab0c51a4d8abd6    depends on A -> select A        (3)
610*cd238effSMauro Carvalho Chehabe98062ed6dc4    select A -> depends on A        (3)
611*cd238effSMauro Carvalho Chehab91e5d284a7f1    select A -> (null)
612*cd238effSMauro Carvalho Chehab============    ===================================
613*cd238effSMauro Carvalho Chehab
614*cd238effSMauro Carvalho Chehab(1) Partial (or no) quote of error.
615*cd238effSMauro Carvalho Chehab(2) That seems to be the gist of that fix.
616*cd238effSMauro Carvalho Chehab(3) Same error.
617*cd238effSMauro Carvalho Chehab
618*cd238effSMauro Carvalho ChehabFuture kconfig work
619*cd238effSMauro Carvalho Chehab~~~~~~~~~~~~~~~~~~~
620*cd238effSMauro Carvalho Chehab
621*cd238effSMauro Carvalho ChehabWork on kconfig is welcomed on both areas of clarifying semantics and on
622*cd238effSMauro Carvalho Chehabevaluating the use of a full SAT solver for it. A full SAT solver can be
623*cd238effSMauro Carvalho Chehabdesirable to enable more complex dependency mappings and / or queries,
624*cd238effSMauro Carvalho Chehabfor instance on possible use case for a SAT solver could be that of handling
625*cd238effSMauro Carvalho Chehabthe current known recursive dependency issues. It is not known if this would
626*cd238effSMauro Carvalho Chehabaddress such issues but such evaluation is desirable. If support for a full SAT
627*cd238effSMauro Carvalho Chehabsolver proves too complex or that it cannot address recursive dependency issues
628*cd238effSMauro Carvalho ChehabKconfig should have at least clear and well defined semantics which also
629*cd238effSMauro Carvalho Chehabaddresses and documents limitations or requirements such as the ones dealing
630*cd238effSMauro Carvalho Chehabwith recursive dependencies.
631*cd238effSMauro Carvalho Chehab
632*cd238effSMauro Carvalho ChehabFurther work on both of these areas is welcomed on Kconfig. We elaborate
633*cd238effSMauro Carvalho Chehabon both of these in the next two subsections.
634*cd238effSMauro Carvalho Chehab
635*cd238effSMauro Carvalho ChehabSemantics of Kconfig
636*cd238effSMauro Carvalho Chehab~~~~~~~~~~~~~~~~~~~~
637*cd238effSMauro Carvalho Chehab
638*cd238effSMauro Carvalho ChehabThe use of Kconfig is broad, Linux is now only one of Kconfig's users:
639*cd238effSMauro Carvalho Chehabone study has completed a broad analysis of Kconfig use in 12 projects [0]_.
640*cd238effSMauro Carvalho ChehabDespite its widespread use, and although this document does a reasonable job
641*cd238effSMauro Carvalho Chehabin documenting basic Kconfig syntax a more precise definition of Kconfig
642*cd238effSMauro Carvalho Chehabsemantics is welcomed. One project deduced Kconfig semantics through
643*cd238effSMauro Carvalho Chehabthe use of the xconfig configurator [1]_. Work should be done to confirm if
644*cd238effSMauro Carvalho Chehabthe deduced semantics matches our intended Kconfig design goals.
645*cd238effSMauro Carvalho Chehab
646*cd238effSMauro Carvalho ChehabHaving well defined semantics can be useful for tools for practical
647*cd238effSMauro Carvalho Chehabevaluation of depenencies, for instance one such use known case was work to
648*cd238effSMauro Carvalho Chehabexpress in boolean abstraction of the inferred semantics of Kconfig to
649*cd238effSMauro Carvalho Chehabtranslate Kconfig logic into boolean formulas and run a SAT solver on this to
650*cd238effSMauro Carvalho Chehabfind dead code / features (always inactive), 114 dead features were found in
651*cd238effSMauro Carvalho ChehabLinux using this methodology [1]_ (Section 8: Threats to validity).
652*cd238effSMauro Carvalho Chehab
653*cd238effSMauro Carvalho ChehabConfirming this could prove useful as Kconfig stands as one of the the leading
654*cd238effSMauro Carvalho Chehabindustrial variability modeling languages [1]_ [2]_. Its study would help
655*cd238effSMauro Carvalho Chehabevaluate practical uses of such languages, their use was only theoretical
656*cd238effSMauro Carvalho Chehaband real world requirements were not well understood. As it stands though
657*cd238effSMauro Carvalho Chehabonly reverse engineering techniques have been used to deduce semantics from
658*cd238effSMauro Carvalho Chehabvariability modeling languages such as Kconfig [3]_.
659*cd238effSMauro Carvalho Chehab
660*cd238effSMauro Carvalho Chehab.. [0] http://www.eng.uwaterloo.ca/~shshe/kconfig_semantics.pdf
661*cd238effSMauro Carvalho Chehab.. [1] http://gsd.uwaterloo.ca/sites/default/files/vm-2013-berger.pdf
662*cd238effSMauro Carvalho Chehab.. [2] http://gsd.uwaterloo.ca/sites/default/files/ase241-berger_0.pdf
663*cd238effSMauro Carvalho Chehab.. [3] http://gsd.uwaterloo.ca/sites/default/files/icse2011.pdf
664*cd238effSMauro Carvalho Chehab
665*cd238effSMauro Carvalho ChehabFull SAT solver for Kconfig
666*cd238effSMauro Carvalho Chehab~~~~~~~~~~~~~~~~~~~~~~~~~~~
667*cd238effSMauro Carvalho Chehab
668*cd238effSMauro Carvalho ChehabAlthough SAT solvers [4]_ haven't yet been used by Kconfig directly, as noted
669*cd238effSMauro Carvalho Chehabin the previous subsection, work has been done however to express in boolean
670*cd238effSMauro Carvalho Chehababstraction the inferred semantics of Kconfig to translate Kconfig logic into
671*cd238effSMauro Carvalho Chehabboolean formulas and run a SAT solver on it [5]_. Another known related project
672*cd238effSMauro Carvalho Chehabis CADOS [6]_ (former VAMOS [7]_) and the tools, mainly undertaker [8]_, which
673*cd238effSMauro Carvalho Chehabhas been introduced first with [9]_.  The basic concept of undertaker is to
674*cd238effSMauro Carvalho Chehabexract variability models from Kconfig, and put them together with a
675*cd238effSMauro Carvalho Chehabpropositional formula extracted from CPP #ifdefs and build-rules into a SAT
676*cd238effSMauro Carvalho Chehabsolver in order to find dead code, dead files, and dead symbols. If using a SAT
677*cd238effSMauro Carvalho Chehabsolver is desirable on Kconfig one approach would be to evaluate repurposing
678*cd238effSMauro Carvalho Chehabsuch efforts somehow on Kconfig. There is enough interest from mentors of
679*cd238effSMauro Carvalho Chehabexisting projects to not only help advise how to integrate this work upstream
680*cd238effSMauro Carvalho Chehabbut also help maintain it long term. Interested developers should visit:
681*cd238effSMauro Carvalho Chehab
682*cd238effSMauro Carvalho Chehabhttp://kernelnewbies.org/KernelProjects/kconfig-sat
683*cd238effSMauro Carvalho Chehab
684*cd238effSMauro Carvalho Chehab.. [4] http://www.cs.cornell.edu/~sabhar/chapters/SATSolvers-KR-Handbook.pdf
685*cd238effSMauro Carvalho Chehab.. [5] http://gsd.uwaterloo.ca/sites/default/files/vm-2013-berger.pdf
686*cd238effSMauro Carvalho Chehab.. [6] https://cados.cs.fau.de
687*cd238effSMauro Carvalho Chehab.. [7] https://vamos.cs.fau.de
688*cd238effSMauro Carvalho Chehab.. [8] https://undertaker.cs.fau.de
689*cd238effSMauro Carvalho Chehab.. [9] https://www4.cs.fau.de/Publications/2011/tartler_11_eurosys.pdf
690