1================
2Kconfig Language
3================
4
5Introduction
6------------
7
8The configuration database is a collection of configuration options
9organized in a tree structure::
10
11	+- Code maturity level options
12	|  +- Prompt for development and/or incomplete code/drivers
13	+- General setup
14	|  +- Networking support
15	|  +- System V IPC
16	|  +- BSD Process Accounting
17	|  +- Sysctl support
18	+- Loadable module support
19	|  +- Enable loadable module support
20	|     +- Set version information on all module symbols
21	|     +- Kernel module loader
22	+- ...
23
24Every entry has its own dependencies. These dependencies are used
25to determine the visibility of an entry. Any child entry is only
26visible if its parent entry is also visible.
27
28Menu entries
29------------
30
31Most entries define a config option; all other entries help to organize
32them. A single configuration option is defined like this::
33
34  config MODVERSIONS
35	bool "Set version information on all module symbols"
36	depends on MODULES
37	help
38	  Usually, modules have to be recompiled whenever you switch to a new
39	  kernel.  ...
40
41Every line starts with a key word and can be followed by multiple
42arguments.  "config" starts a new config entry. The following lines
43define attributes for this config option. Attributes can be the type of
44the config option, input prompt, dependencies, help text and default
45values. A config option can be defined multiple times with the same
46name, but every definition can have only a single input prompt and the
47type must not conflict.
48
49Menu attributes
50---------------
51
52A menu entry can have a number of attributes. Not all of them are
53applicable everywhere (see syntax).
54
55- type definition: "bool"/"tristate"/"string"/"hex"/"int"
56
57  Every config option must have a type. There are only two basic types:
58  tristate and string; the other types are based on these two. The type
59  definition optionally accepts an input prompt, so these two examples
60  are equivalent::
61
62	bool "Networking support"
63
64  and::
65
66	bool
67	prompt "Networking support"
68
69- input prompt: "prompt" <prompt> ["if" <expr>]
70
71  Every menu entry can have at most one prompt, which is used to display
72  to the user. Optionally dependencies only for this prompt can be added
73  with "if". If a prompt is not present, the config option is a non-visible
74  symbol, meaning its value cannot be directly changed by the user (such as
75  altering the value in ``.config``) and the option will not appear in any
76  config menus. Its value can only be set via "default" and "select" (see
77  below).
78
79- default value: "default" <expr> ["if" <expr>]
80
81  A config option can have any number of default values. If multiple
82  default values are visible, only the first defined one is active.
83  Default values are not limited to the menu entry where they are
84  defined. This means the default can be defined somewhere else or be
85  overridden by an earlier definition.
86  The default value is only assigned to the config symbol if no other
87  value was set by the user (via the input prompt above). If an input
88  prompt is visible the default value is presented to the user and can
89  be overridden by him.
90  Optionally, dependencies only for this default value can be added with
91  "if".
92
93 The default value deliberately defaults to 'n' in order to avoid bloating the
94 build. With few exceptions, new config options should not change this. The
95 intent is for "make oldconfig" to add as little as possible to the config from
96 release to release.
97
98 Note:
99	Things that merit "default y/m" include:
100
101	a) A new Kconfig option for something that used to always be built
102	   should be "default y".
103
104	b) A new gatekeeping Kconfig option that hides/shows other Kconfig
105	   options (but does not generate any code of its own), should be
106	   "default y" so people will see those other options.
107
108	c) Sub-driver behavior or similar options for a driver that is
109	   "default n". This allows you to provide sane defaults.
110
111	d) Hardware or infrastructure that everybody expects, such as CONFIG_NET
112	   or CONFIG_BLOCK. These are rare exceptions.
113
114- type definition + default value::
115
116	"def_bool"/"def_tristate" <expr> ["if" <expr>]
117
118  This is a shorthand notation for a type definition plus a value.
119  Optionally dependencies for this default value can be added with "if".
120
121- dependencies: "depends on" <expr>
122
123  This defines a dependency for this menu entry. If multiple
124  dependencies are defined, they are connected with '&&'. Dependencies
125  are applied to all other options within this menu entry (which also
126  accept an "if" expression), so these two examples are equivalent::
127
128	bool "foo" if BAR
129	default y if BAR
130
131  and::
132
133	depends on BAR
134	bool "foo"
135	default y
136
137- reverse dependencies: "select" <symbol> ["if" <expr>]
138
139  While normal dependencies reduce the upper limit of a symbol (see
140  below), reverse dependencies can be used to force a lower limit of
141  another symbol. The value of the current menu symbol is used as the
142  minimal value <symbol> can be set to. If <symbol> is selected multiple
143  times, the limit is set to the largest selection.
144  Reverse dependencies can only be used with boolean or tristate
145  symbols.
146
147  Note:
148	select should be used with care. select will force
149	a symbol to a value without visiting the dependencies.
150	By abusing select you are able to select a symbol FOO even
151	if FOO depends on BAR that is not set.
152	In general use select only for non-visible symbols
153	(no prompts anywhere) and for symbols with no dependencies.
154	That will limit the usefulness but on the other hand avoid
155	the illegal configurations all over.
156
157	If "select" <symbol> is followed by "if" <expr>, <symbol> will be
158	selected by the logical AND of the value of the current menu symbol
159	and <expr>. This means, the lower limit can be downgraded due to the
160	presence of "if" <expr>. This behavior may seem weird, but we rely on
161	it. (The future of this behavior is undecided.)
162
163- weak reverse dependencies: "imply" <symbol> ["if" <expr>]
164
165  This is similar to "select" as it enforces a lower limit on another
166  symbol except that the "implied" symbol's value may still be set to n
167  from a direct dependency or with a visible prompt.
168
169  Given the following example::
170
171    config FOO
172	tristate "foo"
173	imply BAZ
174
175    config BAZ
176	tristate "baz"
177	depends on BAR
178
179  The following values are possible:
180
181	===		===		=============	==============
182	FOO		BAR		BAZ's default	choice for BAZ
183	===		===		=============	==============
184	n		y		n		N/m/y
185	m		y		m		M/y/n
186	y		y		y		Y/m/n
187	n		m		n		N/m
188	m		m		m		M/n
189	y		m		m		M/n
190	y		n		*		N
191	===		===		=============	==============
192
193  This is useful e.g. with multiple drivers that want to indicate their
194  ability to hook into a secondary subsystem while allowing the user to
195  configure that subsystem out without also having to unset these drivers.
196
197  Note: If the feature provided by BAZ is highly desirable for FOO,
198  FOO should imply not only BAZ, but also its dependency BAR::
199
200    config FOO
201	tristate "foo"
202	imply BAR
203	imply BAZ
204
205  Note: If "imply" <symbol> is followed by "if" <expr>, the default of <symbol>
206  will be the logical AND of the value of the current menu symbol and <expr>.
207  (The future of this behavior is undecided.)
208
209- limiting menu display: "visible if" <expr>
210
211  This attribute is only applicable to menu blocks, if the condition is
212  false, the menu block is not displayed to the user (the symbols
213  contained there can still be selected by other symbols, though). It is
214  similar to a conditional "prompt" attribute for individual menu
215  entries. Default value of "visible" is true.
216
217- numerical ranges: "range" <symbol> <symbol> ["if" <expr>]
218
219  This allows to limit the range of possible input values for int
220  and hex symbols. The user can only input a value which is larger than
221  or equal to the first symbol and smaller than or equal to the second
222  symbol.
223
224- help text: "help"
225
226  This defines a help text. The end of the help text is determined by
227  the indentation level, this means it ends at the first line which has
228  a smaller indentation than the first line of the help text.
229
230- module attribute: "modules"
231  This declares the symbol to be used as the MODULES symbol, which
232  enables the third modular state for all config symbols.
233  At most one symbol may have the "modules" option set.
234
235Menu dependencies
236-----------------
237
238Dependencies define the visibility of a menu entry and can also reduce
239the input range of tristate symbols. The tristate logic used in the
240expressions uses one more state than normal boolean logic to express the
241module state. Dependency expressions have the following syntax::
242
243  <expr> ::= <symbol>                           (1)
244           <symbol> '=' <symbol>                (2)
245           <symbol> '!=' <symbol>               (3)
246           <symbol1> '<' <symbol2>              (4)
247           <symbol1> '>' <symbol2>              (4)
248           <symbol1> '<=' <symbol2>             (4)
249           <symbol1> '>=' <symbol2>             (4)
250           '(' <expr> ')'                       (5)
251           '!' <expr>                           (6)
252           <expr> '&&' <expr>                   (7)
253           <expr> '||' <expr>                   (8)
254
255Expressions are listed in decreasing order of precedence.
256
257(1) Convert the symbol into an expression. Boolean and tristate symbols
258    are simply converted into the respective expression values. All
259    other symbol types result in 'n'.
260(2) If the values of both symbols are equal, it returns 'y',
261    otherwise 'n'.
262(3) If the values of both symbols are equal, it returns 'n',
263    otherwise 'y'.
264(4) If value of <symbol1> is respectively lower, greater, lower-or-equal,
265    or greater-or-equal than value of <symbol2>, it returns 'y',
266    otherwise 'n'.
267(5) Returns the value of the expression. Used to override precedence.
268(6) Returns the result of (2-/expr/).
269(7) Returns the result of min(/expr/, /expr/).
270(8) Returns the result of max(/expr/, /expr/).
271
272An expression can have a value of 'n', 'm' or 'y' (or 0, 1, 2
273respectively for calculations). A menu entry becomes visible when its
274expression evaluates to 'm' or 'y'.
275
276There are two types of symbols: constant and non-constant symbols.
277Non-constant symbols are the most common ones and are defined with the
278'config' statement. Non-constant symbols consist entirely of alphanumeric
279characters or underscores.
280Constant symbols are only part of expressions. Constant symbols are
281always surrounded by single or double quotes. Within the quote, any
282other character is allowed and the quotes can be escaped using '\'.
283
284Menu structure
285--------------
286
287The position of a menu entry in the tree is determined in two ways. First
288it can be specified explicitly::
289
290  menu "Network device support"
291	depends on NET
292
293  config NETDEVICES
294	...
295
296  endmenu
297
298All entries within the "menu" ... "endmenu" block become a submenu of
299"Network device support". All subentries inherit the dependencies from
300the menu entry, e.g. this means the dependency "NET" is added to the
301dependency list of the config option NETDEVICES.
302
303The other way to generate the menu structure is done by analyzing the
304dependencies. If a menu entry somehow depends on the previous entry, it
305can be made a submenu of it. First, the previous (parent) symbol must
306be part of the dependency list and then one of these two conditions
307must be true:
308
309- the child entry must become invisible, if the parent is set to 'n'
310- the child entry must only be visible, if the parent is visible::
311
312    config MODULES
313	bool "Enable loadable module support"
314
315    config MODVERSIONS
316	bool "Set version information on all module symbols"
317	depends on MODULES
318
319    comment "module support disabled"
320	depends on !MODULES
321
322MODVERSIONS directly depends on MODULES, this means it's only visible if
323MODULES is different from 'n'. The comment on the other hand is only
324visible when MODULES is set to 'n'.
325
326
327Kconfig syntax
328--------------
329
330The configuration file describes a series of menu entries, where every
331line starts with a keyword (except help texts). The following keywords
332end a menu entry:
333
334- config
335- menuconfig
336- choice/endchoice
337- comment
338- menu/endmenu
339- if/endif
340- source
341
342The first five also start the definition of a menu entry.
343
344config::
345
346	"config" <symbol>
347	<config options>
348
349This defines a config symbol <symbol> and accepts any of above
350attributes as options.
351
352menuconfig::
353
354	"menuconfig" <symbol>
355	<config options>
356
357This is similar to the simple config entry above, but it also gives a
358hint to front ends, that all suboptions should be displayed as a
359separate list of options. To make sure all the suboptions will really
360show up under the menuconfig entry and not outside of it, every item
361from the <config options> list must depend on the menuconfig symbol.
362In practice, this is achieved by using one of the next two constructs::
363
364  (1):
365  menuconfig M
366  if M
367      config C1
368      config C2
369  endif
370
371  (2):
372  menuconfig M
373  config C1
374      depends on M
375  config C2
376      depends on M
377
378In the following examples (3) and (4), C1 and C2 still have the M
379dependency, but will not appear under menuconfig M anymore, because
380of C0, which doesn't depend on M::
381
382  (3):
383  menuconfig M
384      config C0
385  if M
386      config C1
387      config C2
388  endif
389
390  (4):
391  menuconfig M
392  config C0
393  config C1
394      depends on M
395  config C2
396      depends on M
397
398choices::
399
400	"choice"
401	<choice options>
402	<choice block>
403	"endchoice"
404
405This defines a choice group and accepts "prompt", "default", "depends on", and
406"help" attributes as options.
407
408A choice only allows a single config entry to be selected.
409
410comment::
411
412	"comment" <prompt>
413	<comment options>
414
415This defines a comment which is displayed to the user during the
416configuration process and is also echoed to the output files. The only
417possible options are dependencies.
418
419menu::
420
421	"menu" <prompt>
422	<menu options>
423	<menu block>
424	"endmenu"
425
426This defines a menu block, see "Menu structure" above for more
427information. The only possible options are dependencies and "visible"
428attributes.
429
430if::
431
432	"if" <expr>
433	<if block>
434	"endif"
435
436This defines an if block. The dependency expression <expr> is appended
437to all enclosed menu entries.
438
439source::
440
441	"source" <prompt>
442
443This reads the specified configuration file. This file is always parsed.
444
445mainmenu::
446
447	"mainmenu" <prompt>
448
449This sets the config program's title bar if the config program chooses
450to use it. It should be placed at the top of the configuration, before any
451other statement.
452
453'#' Kconfig source file comment:
454
455An unquoted '#' character anywhere in a source file line indicates
456the beginning of a source file comment.  The remainder of that line
457is a comment.
458
459
460Kconfig hints
461-------------
462This is a collection of Kconfig tips, most of which aren't obvious at
463first glance and most of which have become idioms in several Kconfig
464files.
465
466Adding common features and make the usage configurable
467~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
468It is a common idiom to implement a feature/functionality that are
469relevant for some architectures but not all.
470The recommended way to do so is to use a config variable named HAVE_*
471that is defined in a common Kconfig file and selected by the relevant
472architectures.
473An example is the generic IOMAP functionality.
474
475We would in lib/Kconfig see::
476
477  # Generic IOMAP is used to ...
478  config HAVE_GENERIC_IOMAP
479
480  config GENERIC_IOMAP
481	depends on HAVE_GENERIC_IOMAP && FOO
482
483And in lib/Makefile we would see::
484
485	obj-$(CONFIG_GENERIC_IOMAP) += iomap.o
486
487For each architecture using the generic IOMAP functionality we would see::
488
489  config X86
490	select ...
491	select HAVE_GENERIC_IOMAP
492	select ...
493
494Note: we use the existing config option and avoid creating a new
495config variable to select HAVE_GENERIC_IOMAP.
496
497Note: the use of the internal config variable HAVE_GENERIC_IOMAP, it is
498introduced to overcome the limitation of select which will force a
499config option to 'y' no matter the dependencies.
500The dependencies are moved to the symbol GENERIC_IOMAP and we avoid the
501situation where select forces a symbol equals to 'y'.
502
503Adding features that need compiler support
504~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
505
506There are several features that need compiler support. The recommended way
507to describe the dependency on the compiler feature is to use "depends on"
508followed by a test macro::
509
510  config STACKPROTECTOR
511	bool "Stack Protector buffer overflow detection"
512	depends on $(cc-option,-fstack-protector)
513	...
514
515If you need to expose a compiler capability to makefiles and/or C source files,
516`CC_HAS_` is the recommended prefix for the config option::
517
518  config CC_HAS_FOO
519	def_bool $(success,$(srctree)/scripts/cc-check-foo.sh $(CC))
520
521Build as module only
522~~~~~~~~~~~~~~~~~~~~
523To restrict a component build to module-only, qualify its config symbol
524with "depends on m".  E.g.::
525
526  config FOO
527	depends on BAR && m
528
529limits FOO to module (=m) or disabled (=n).
530
531Compile-testing
532~~~~~~~~~~~~~~~
533If a config symbol has a dependency, but the code controlled by the config
534symbol can still be compiled if the dependency is not met, it is encouraged to
535increase build coverage by adding an "|| COMPILE_TEST" clause to the
536dependency. This is especially useful for drivers for more exotic hardware, as
537it allows continuous-integration systems to compile-test the code on a more
538common system, and detect bugs that way.
539Note that compile-tested code should avoid crashing when run on a system where
540the dependency is not met.
541
542Architecture and platform dependencies
543~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
544Due to the presence of stubs, most drivers can now be compiled on most
545architectures. However, this does not mean it makes sense to have all drivers
546available everywhere, as the actual hardware may only exist on specific
547architectures and platforms. This is especially true for on-SoC IP cores,
548which may be limited to a specific vendor or SoC family.
549
550To prevent asking the user about drivers that cannot be used on the system(s)
551the user is compiling a kernel for, and if it makes sense, config symbols
552controlling the compilation of a driver should contain proper dependencies,
553limiting the visibility of the symbol to (a superset of) the platform(s) the
554driver can be used on. The dependency can be an architecture (e.g. ARM) or
555platform (e.g. ARCH_OMAP4) dependency. This makes life simpler not only for
556distro config owners, but also for every single developer or user who
557configures a kernel.
558
559Such a dependency can be relaxed by combining it with the compile-testing rule
560above, leading to:
561
562  config FOO
563	bool "Support for foo hardware"
564	depends on ARCH_FOO_VENDOR || COMPILE_TEST
565
566Optional dependencies
567~~~~~~~~~~~~~~~~~~~~~
568
569Some drivers are able to optionally use a feature from another module
570or build cleanly with that module disabled, but cause a link failure
571when trying to use that loadable module from a built-in driver.
572
573The most common way to express this optional dependency in Kconfig logic
574uses the slightly counterintuitive::
575
576  config FOO
577	tristate "Support for foo hardware"
578	depends on BAR || !BAR
579
580This means that there is either a dependency on BAR that disallows
581the combination of FOO=y with BAR=m, or BAR is completely disabled. The BAR
582module must provide all the stubs for !BAR case.
583
584For a more formalized approach if there are multiple drivers that have
585the same dependency, a helper symbol can be used, like::
586
587  config FOO
588	tristate "Support for foo hardware"
589	depends on BAR_OPTIONAL
590
591  config BAR_OPTIONAL
592	def_tristate BAR || !BAR
593
594Much less favorable way to express optional dependency is IS_REACHABLE() within
595the module code, useful for example when the module BAR does not provide
596!BAR stubs::
597
598	foo_init()
599	{
600		if (IS_REACHABLE(CONFIG_BAR))
601			bar_register(&foo);
602		...
603	}
604
605IS_REACHABLE() is generally discouraged, because the code will be silently
606discarded, when CONFIG_BAR=m and this code is built-in. This is not what users
607usually expect when enabling BAR as module.
608
609Kconfig recursive dependency limitations
610~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
611
612If you've hit the Kconfig error: "recursive dependency detected" you've run
613into a recursive dependency issue with Kconfig, a recursive dependency can be
614summarized as a circular dependency. The kconfig tools need to ensure that
615Kconfig files comply with specified configuration requirements. In order to do
616that kconfig must determine the values that are possible for all Kconfig
617symbols, this is currently not possible if there is a circular relation
618between two or more Kconfig symbols. For more details refer to the "Simple
619Kconfig recursive issue" subsection below. Kconfig does not do recursive
620dependency resolution; this has a few implications for Kconfig file writers.
621We'll first explain why this issues exists and then provide an example
622technical limitation which this brings upon Kconfig developers. Eager
623developers wishing to try to address this limitation should read the next
624subsections.
625
626Simple Kconfig recursive issue
627~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
628
629Read: Documentation/kbuild/Kconfig.recursion-issue-01
630
631Test with::
632
633  make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-01 allnoconfig
634
635Cumulative Kconfig recursive issue
636~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
637
638Read: Documentation/kbuild/Kconfig.recursion-issue-02
639
640Test with::
641
642  make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-02 allnoconfig
643
644Practical solutions to kconfig recursive issue
645~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
646
647Developers who run into the recursive Kconfig issue have two options
648at their disposal. We document them below and also provide a list of
649historical issues resolved through these different solutions.
650
651  a) Remove any superfluous "select FOO" or "depends on FOO"
652  b) Match dependency semantics:
653
654	b1) Swap all "select FOO" to "depends on FOO" or,
655
656	b2) Swap all "depends on FOO" to "select FOO"
657
658The resolution to a) can be tested with the sample Kconfig file
659Documentation/kbuild/Kconfig.recursion-issue-01 through the removal
660of the "select CORE" from CORE_BELL_A_ADVANCED as that is implicit already
661since CORE_BELL_A depends on CORE. At times it may not be possible to remove
662some dependency criteria, for such cases you can work with solution b).
663
664The two different resolutions for b) can be tested in the sample Kconfig file
665Documentation/kbuild/Kconfig.recursion-issue-02.
666
667Below is a list of examples of prior fixes for these types of recursive issues;
668all errors appear to involve one or more "select" statements and one or more
669"depends on".
670
671============    ===================================
672commit          fix
673============    ===================================
67406b718c01208    select A -> depends on A
675c22eacfe82f9    depends on A -> depends on B
6766a91e854442c    select A -> depends on A
677118c565a8f2e    select A -> select B
678f004e5594705    select A -> depends on A
679c7861f37b4c6    depends on A -> (null)
68080c69915e5fb    select A -> (null)              (1)
681c2218e26c0d0    select A -> depends on A        (1)
682d6ae99d04e1c    select A -> depends on A
68395ca19cf8cbf    select A -> depends on A
6848f057d7bca54    depends on A -> (null)
6858f057d7bca54    depends on A -> select A
686a0701f04846e    select A -> depends on A
6870c8b92f7f259    depends on A -> (null)
688e4e9e0540928    select A -> depends on A        (2)
6897453ea886e87    depends on A > (null)           (1)
6907b1fff7e4fdf    select A -> depends on A
69186c747d2a4f0    select A -> depends on A
692d9f9ab51e55e    select A -> depends on A
6930c51a4d8abd6    depends on A -> select A        (3)
694e98062ed6dc4    select A -> depends on A        (3)
69591e5d284a7f1    select A -> (null)
696============    ===================================
697
698(1) Partial (or no) quote of error.
699(2) That seems to be the gist of that fix.
700(3) Same error.
701
702Future kconfig work
703~~~~~~~~~~~~~~~~~~~
704
705Work on kconfig is welcomed on both areas of clarifying semantics and on
706evaluating the use of a full SAT solver for it. A full SAT solver can be
707desirable to enable more complex dependency mappings and / or queries,
708for instance one possible use case for a SAT solver could be that of handling
709the current known recursive dependency issues. It is not known if this would
710address such issues but such evaluation is desirable. If support for a full SAT
711solver proves too complex or that it cannot address recursive dependency issues
712Kconfig should have at least clear and well defined semantics which also
713addresses and documents limitations or requirements such as the ones dealing
714with recursive dependencies.
715
716Further work on both of these areas is welcomed on Kconfig. We elaborate
717on both of these in the next two subsections.
718
719Semantics of Kconfig
720~~~~~~~~~~~~~~~~~~~~
721
722The use of Kconfig is broad, Linux is now only one of Kconfig's users:
723one study has completed a broad analysis of Kconfig use in 12 projects [0]_.
724Despite its widespread use, and although this document does a reasonable job
725in documenting basic Kconfig syntax a more precise definition of Kconfig
726semantics is welcomed. One project deduced Kconfig semantics through
727the use of the xconfig configurator [1]_. Work should be done to confirm if
728the deduced semantics matches our intended Kconfig design goals.
729Another project formalized a denotational semantics of a core subset of
730the Kconfig language [10]_.
731
732Having well defined semantics can be useful for tools for practical
733evaluation of dependencies, for instance one such case was work to
734express in boolean abstraction of the inferred semantics of Kconfig to
735translate Kconfig logic into boolean formulas and run a SAT solver on this to
736find dead code / features (always inactive), 114 dead features were found in
737Linux using this methodology [1]_ (Section 8: Threats to validity).
738The kismet tool, based on the semantics in [10]_, finds abuses of reverse
739dependencies and has led to dozens of committed fixes to Linux Kconfig files [11]_.
740
741Confirming this could prove useful as Kconfig stands as one of the leading
742industrial variability modeling languages [1]_ [2]_. Its study would help
743evaluate practical uses of such languages, their use was only theoretical
744and real world requirements were not well understood. As it stands though
745only reverse engineering techniques have been used to deduce semantics from
746variability modeling languages such as Kconfig [3]_.
747
748.. [0] https://www.eng.uwaterloo.ca/~shshe/kconfig_semantics.pdf
749.. [1] https://gsd.uwaterloo.ca/sites/default/files/vm-2013-berger.pdf
750.. [2] https://gsd.uwaterloo.ca/sites/default/files/ase241-berger_0.pdf
751.. [3] https://gsd.uwaterloo.ca/sites/default/files/icse2011.pdf
752
753Full SAT solver for Kconfig
754~~~~~~~~~~~~~~~~~~~~~~~~~~~
755
756Although SAT solvers [4]_ haven't yet been used by Kconfig directly, as noted
757in the previous subsection, work has been done however to express in boolean
758abstraction the inferred semantics of Kconfig to translate Kconfig logic into
759boolean formulas and run a SAT solver on it [5]_. Another known related project
760is CADOS [6]_ (former VAMOS [7]_) and the tools, mainly undertaker [8]_, which
761has been introduced first with [9]_.  The basic concept of undertaker is to
762extract variability models from Kconfig and put them together with a
763propositional formula extracted from CPP #ifdefs and build-rules into a SAT
764solver in order to find dead code, dead files, and dead symbols. If using a SAT
765solver is desirable on Kconfig one approach would be to evaluate repurposing
766such efforts somehow on Kconfig. There is enough interest from mentors of
767existing projects to not only help advise how to integrate this work upstream
768but also help maintain it long term. Interested developers should visit:
769
770https://kernelnewbies.org/KernelProjects/kconfig-sat
771
772.. [4] https://www.cs.cornell.edu/~sabhar/chapters/SATSolvers-KR-Handbook.pdf
773.. [5] https://gsd.uwaterloo.ca/sites/default/files/vm-2013-berger.pdf
774.. [6] https://cados.cs.fau.de
775.. [7] https://vamos.cs.fau.de
776.. [8] https://undertaker.cs.fau.de
777.. [9] https://www4.cs.fau.de/Publications/2011/tartler_11_eurosys.pdf
778.. [10] https://paulgazzillo.com/papers/esecfse21.pdf
779.. [11] https://github.com/paulgazz/kmax
780