xref: /linux/Documentation/kbuild/kconfig-language.rst (revision 55d0969c451159cff86949b38c39171cab962069)
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 combination of FOO=y and BAZ=m causes a link error,
198  you can guard the function call with IS_REACHABLE()::
199
200	foo_init()
201	{
202		if (IS_REACHABLE(CONFIG_BAZ))
203			baz_register(&foo);
204		...
205	}
206
207  Note: If the feature provided by BAZ is highly desirable for FOO,
208  FOO should imply not only BAZ, but also its dependency BAR::
209
210    config FOO
211	tristate "foo"
212	imply BAR
213	imply BAZ
214
215  Note: If "imply" <symbol> is followed by "if" <expr>, the default of <symbol>
216  will be the logical AND of the value of the current menu symbol and <expr>.
217  (The future of this behavior is undecided.)
218
219- limiting menu display: "visible if" <expr>
220
221  This attribute is only applicable to menu blocks, if the condition is
222  false, the menu block is not displayed to the user (the symbols
223  contained there can still be selected by other symbols, though). It is
224  similar to a conditional "prompt" attribute for individual menu
225  entries. Default value of "visible" is true.
226
227- numerical ranges: "range" <symbol> <symbol> ["if" <expr>]
228
229  This allows to limit the range of possible input values for int
230  and hex symbols. The user can only input a value which is larger than
231  or equal to the first symbol and smaller than or equal to the second
232  symbol.
233
234- help text: "help"
235
236  This defines a help text. The end of the help text is determined by
237  the indentation level, this means it ends at the first line which has
238  a smaller indentation than the first line of the help text.
239
240- module attribute: "modules"
241  This declares the symbol to be used as the MODULES symbol, which
242  enables the third modular state for all config symbols.
243  At most one symbol may have the "modules" option set.
244
245Menu dependencies
246-----------------
247
248Dependencies define the visibility of a menu entry and can also reduce
249the input range of tristate symbols. The tristate logic used in the
250expressions uses one more state than normal boolean logic to express the
251module state. Dependency expressions have the following syntax::
252
253  <expr> ::= <symbol>                           (1)
254           <symbol> '=' <symbol>                (2)
255           <symbol> '!=' <symbol>               (3)
256           <symbol1> '<' <symbol2>              (4)
257           <symbol1> '>' <symbol2>              (4)
258           <symbol1> '<=' <symbol2>             (4)
259           <symbol1> '>=' <symbol2>             (4)
260           '(' <expr> ')'                       (5)
261           '!' <expr>                           (6)
262           <expr> '&&' <expr>                   (7)
263           <expr> '||' <expr>                   (8)
264
265Expressions are listed in decreasing order of precedence.
266
267(1) Convert the symbol into an expression. Boolean and tristate symbols
268    are simply converted into the respective expression values. All
269    other symbol types result in 'n'.
270(2) If the values of both symbols are equal, it returns 'y',
271    otherwise 'n'.
272(3) If the values of both symbols are equal, it returns 'n',
273    otherwise 'y'.
274(4) If value of <symbol1> is respectively lower, greater, lower-or-equal,
275    or greater-or-equal than value of <symbol2>, it returns 'y',
276    otherwise 'n'.
277(5) Returns the value of the expression. Used to override precedence.
278(6) Returns the result of (2-/expr/).
279(7) Returns the result of min(/expr/, /expr/).
280(8) Returns the result of max(/expr/, /expr/).
281
282An expression can have a value of 'n', 'm' or 'y' (or 0, 1, 2
283respectively for calculations). A menu entry becomes visible when its
284expression evaluates to 'm' or 'y'.
285
286There are two types of symbols: constant and non-constant symbols.
287Non-constant symbols are the most common ones and are defined with the
288'config' statement. Non-constant symbols consist entirely of alphanumeric
289characters or underscores.
290Constant symbols are only part of expressions. Constant symbols are
291always surrounded by single or double quotes. Within the quote, any
292other character is allowed and the quotes can be escaped using '\'.
293
294Menu structure
295--------------
296
297The position of a menu entry in the tree is determined in two ways. First
298it can be specified explicitly::
299
300  menu "Network device support"
301	depends on NET
302
303  config NETDEVICES
304	...
305
306  endmenu
307
308All entries within the "menu" ... "endmenu" block become a submenu of
309"Network device support". All subentries inherit the dependencies from
310the menu entry, e.g. this means the dependency "NET" is added to the
311dependency list of the config option NETDEVICES.
312
313The other way to generate the menu structure is done by analyzing the
314dependencies. If a menu entry somehow depends on the previous entry, it
315can be made a submenu of it. First, the previous (parent) symbol must
316be part of the dependency list and then one of these two conditions
317must be true:
318
319- the child entry must become invisible, if the parent is set to 'n'
320- the child entry must only be visible, if the parent is visible::
321
322    config MODULES
323	bool "Enable loadable module support"
324
325    config MODVERSIONS
326	bool "Set version information on all module symbols"
327	depends on MODULES
328
329    comment "module support disabled"
330	depends on !MODULES
331
332MODVERSIONS directly depends on MODULES, this means it's only visible if
333MODULES is different from 'n'. The comment on the other hand is only
334visible when MODULES is set to 'n'.
335
336
337Kconfig syntax
338--------------
339
340The configuration file describes a series of menu entries, where every
341line starts with a keyword (except help texts). The following keywords
342end a menu entry:
343
344- config
345- menuconfig
346- choice/endchoice
347- comment
348- menu/endmenu
349- if/endif
350- source
351
352The first five also start the definition of a menu entry.
353
354config::
355
356	"config" <symbol>
357	<config options>
358
359This defines a config symbol <symbol> and accepts any of above
360attributes as options.
361
362menuconfig::
363
364	"menuconfig" <symbol>
365	<config options>
366
367This is similar to the simple config entry above, but it also gives a
368hint to front ends, that all suboptions should be displayed as a
369separate list of options. To make sure all the suboptions will really
370show up under the menuconfig entry and not outside of it, every item
371from the <config options> list must depend on the menuconfig symbol.
372In practice, this is achieved by using one of the next two constructs::
373
374  (1):
375  menuconfig M
376  if M
377      config C1
378      config C2
379  endif
380
381  (2):
382  menuconfig M
383  config C1
384      depends on M
385  config C2
386      depends on M
387
388In the following examples (3) and (4), C1 and C2 still have the M
389dependency, but will not appear under menuconfig M anymore, because
390of C0, which doesn't depend on M::
391
392  (3):
393  menuconfig M
394      config C0
395  if M
396      config C1
397      config C2
398  endif
399
400  (4):
401  menuconfig M
402  config C0
403  config C1
404      depends on M
405  config C2
406      depends on M
407
408choices::
409
410	"choice"
411	<choice options>
412	<choice block>
413	"endchoice"
414
415This defines a choice group and accepts any of the above attributes as
416options.
417
418A choice only allows a single config entry to be selected.
419
420comment::
421
422	"comment" <prompt>
423	<comment options>
424
425This defines a comment which is displayed to the user during the
426configuration process and is also echoed to the output files. The only
427possible options are dependencies.
428
429menu::
430
431	"menu" <prompt>
432	<menu options>
433	<menu block>
434	"endmenu"
435
436This defines a menu block, see "Menu structure" above for more
437information. The only possible options are dependencies and "visible"
438attributes.
439
440if::
441
442	"if" <expr>
443	<if block>
444	"endif"
445
446This defines an if block. The dependency expression <expr> is appended
447to all enclosed menu entries.
448
449source::
450
451	"source" <prompt>
452
453This reads the specified configuration file. This file is always parsed.
454
455mainmenu::
456
457	"mainmenu" <prompt>
458
459This sets the config program's title bar if the config program chooses
460to use it. It should be placed at the top of the configuration, before any
461other statement.
462
463'#' Kconfig source file comment:
464
465An unquoted '#' character anywhere in a source file line indicates
466the beginning of a source file comment.  The remainder of that line
467is a comment.
468
469
470Kconfig hints
471-------------
472This is a collection of Kconfig tips, most of which aren't obvious at
473first glance and most of which have become idioms in several Kconfig
474files.
475
476Adding common features and make the usage configurable
477~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
478It is a common idiom to implement a feature/functionality that are
479relevant for some architectures but not all.
480The recommended way to do so is to use a config variable named HAVE_*
481that is defined in a common Kconfig file and selected by the relevant
482architectures.
483An example is the generic IOMAP functionality.
484
485We would in lib/Kconfig see::
486
487  # Generic IOMAP is used to ...
488  config HAVE_GENERIC_IOMAP
489
490  config GENERIC_IOMAP
491	depends on HAVE_GENERIC_IOMAP && FOO
492
493And in lib/Makefile we would see::
494
495	obj-$(CONFIG_GENERIC_IOMAP) += iomap.o
496
497For each architecture using the generic IOMAP functionality we would see::
498
499  config X86
500	select ...
501	select HAVE_GENERIC_IOMAP
502	select ...
503
504Note: we use the existing config option and avoid creating a new
505config variable to select HAVE_GENERIC_IOMAP.
506
507Note: the use of the internal config variable HAVE_GENERIC_IOMAP, it is
508introduced to overcome the limitation of select which will force a
509config option to 'y' no matter the dependencies.
510The dependencies are moved to the symbol GENERIC_IOMAP and we avoid the
511situation where select forces a symbol equals to 'y'.
512
513Adding features that need compiler support
514~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
515
516There are several features that need compiler support. The recommended way
517to describe the dependency on the compiler feature is to use "depends on"
518followed by a test macro::
519
520  config STACKPROTECTOR
521	bool "Stack Protector buffer overflow detection"
522	depends on $(cc-option,-fstack-protector)
523	...
524
525If you need to expose a compiler capability to makefiles and/or C source files,
526`CC_HAS_` is the recommended prefix for the config option::
527
528  config CC_HAS_FOO
529	def_bool $(success,$(srctree)/scripts/cc-check-foo.sh $(CC))
530
531Build as module only
532~~~~~~~~~~~~~~~~~~~~
533To restrict a component build to module-only, qualify its config symbol
534with "depends on m".  E.g.::
535
536  config FOO
537	depends on BAR && m
538
539limits FOO to module (=m) or disabled (=n).
540
541Compile-testing
542~~~~~~~~~~~~~~~
543If a config symbol has a dependency, but the code controlled by the config
544symbol can still be compiled if the dependency is not met, it is encouraged to
545increase build coverage by adding an "|| COMPILE_TEST" clause to the
546dependency. This is especially useful for drivers for more exotic hardware, as
547it allows continuous-integration systems to compile-test the code on a more
548common system, and detect bugs that way.
549Note that compile-tested code should avoid crashing when run on a system where
550the dependency is not met.
551
552Architecture and platform dependencies
553~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
554Due to the presence of stubs, most drivers can now be compiled on most
555architectures. However, this does not mean it makes sense to have all drivers
556available everywhere, as the actual hardware may only exist on specific
557architectures and platforms. This is especially true for on-SoC IP cores,
558which may be limited to a specific vendor or SoC family.
559
560To prevent asking the user about drivers that cannot be used on the system(s)
561the user is compiling a kernel for, and if it makes sense, config symbols
562controlling the compilation of a driver should contain proper dependencies,
563limiting the visibility of the symbol to (a superset of) the platform(s) the
564driver can be used on. The dependency can be an architecture (e.g. ARM) or
565platform (e.g. ARCH_OMAP4) dependency. This makes life simpler not only for
566distro config owners, but also for every single developer or user who
567configures a kernel.
568
569Such a dependency can be relaxed by combining it with the compile-testing rule
570above, leading to:
571
572  config FOO
573	bool "Support for foo hardware"
574	depends on ARCH_FOO_VENDOR || COMPILE_TEST
575
576Optional dependencies
577~~~~~~~~~~~~~~~~~~~~~
578
579Some drivers are able to optionally use a feature from another module
580or build cleanly with that module disabled, but cause a link failure
581when trying to use that loadable module from a built-in driver.
582
583The most common way to express this optional dependency in Kconfig logic
584uses the slightly counterintuitive::
585
586  config FOO
587	tristate "Support for foo hardware"
588	depends on BAR || !BAR
589
590This means that there is either a dependency on BAR that disallows
591the combination of FOO=y with BAR=m, or BAR is completely disabled.
592For a more formalized approach if there are multiple drivers that have
593the same dependency, a helper symbol can be used, like::
594
595  config FOO
596	tristate "Support for foo hardware"
597	depends on BAR_OPTIONAL
598
599  config BAR_OPTIONAL
600	def_tristate BAR || !BAR
601
602Kconfig recursive dependency limitations
603~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
604
605If you've hit the Kconfig error: "recursive dependency detected" you've run
606into a recursive dependency issue with Kconfig, a recursive dependency can be
607summarized as a circular dependency. The kconfig tools need to ensure that
608Kconfig files comply with specified configuration requirements. In order to do
609that kconfig must determine the values that are possible for all Kconfig
610symbols, this is currently not possible if there is a circular relation
611between two or more Kconfig symbols. For more details refer to the "Simple
612Kconfig recursive issue" subsection below. Kconfig does not do recursive
613dependency resolution; this has a few implications for Kconfig file writers.
614We'll first explain why this issues exists and then provide an example
615technical limitation which this brings upon Kconfig developers. Eager
616developers wishing to try to address this limitation should read the next
617subsections.
618
619Simple Kconfig recursive issue
620~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
621
622Read: Documentation/kbuild/Kconfig.recursion-issue-01
623
624Test with::
625
626  make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-01 allnoconfig
627
628Cumulative Kconfig recursive issue
629~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
630
631Read: Documentation/kbuild/Kconfig.recursion-issue-02
632
633Test with::
634
635  make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-02 allnoconfig
636
637Practical solutions to kconfig recursive issue
638~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
639
640Developers who run into the recursive Kconfig issue have two options
641at their disposal. We document them below and also provide a list of
642historical issues resolved through these different solutions.
643
644  a) Remove any superfluous "select FOO" or "depends on FOO"
645  b) Match dependency semantics:
646
647	b1) Swap all "select FOO" to "depends on FOO" or,
648
649	b2) Swap all "depends on FOO" to "select FOO"
650
651The resolution to a) can be tested with the sample Kconfig file
652Documentation/kbuild/Kconfig.recursion-issue-01 through the removal
653of the "select CORE" from CORE_BELL_A_ADVANCED as that is implicit already
654since CORE_BELL_A depends on CORE. At times it may not be possible to remove
655some dependency criteria, for such cases you can work with solution b).
656
657The two different resolutions for b) can be tested in the sample Kconfig file
658Documentation/kbuild/Kconfig.recursion-issue-02.
659
660Below is a list of examples of prior fixes for these types of recursive issues;
661all errors appear to involve one or more "select" statements and one or more
662"depends on".
663
664============    ===================================
665commit          fix
666============    ===================================
66706b718c01208    select A -> depends on A
668c22eacfe82f9    depends on A -> depends on B
6696a91e854442c    select A -> depends on A
670118c565a8f2e    select A -> select B
671f004e5594705    select A -> depends on A
672c7861f37b4c6    depends on A -> (null)
67380c69915e5fb    select A -> (null)              (1)
674c2218e26c0d0    select A -> depends on A        (1)
675d6ae99d04e1c    select A -> depends on A
67695ca19cf8cbf    select A -> depends on A
6778f057d7bca54    depends on A -> (null)
6788f057d7bca54    depends on A -> select A
679a0701f04846e    select A -> depends on A
6800c8b92f7f259    depends on A -> (null)
681e4e9e0540928    select A -> depends on A        (2)
6827453ea886e87    depends on A > (null)           (1)
6837b1fff7e4fdf    select A -> depends on A
68486c747d2a4f0    select A -> depends on A
685d9f9ab51e55e    select A -> depends on A
6860c51a4d8abd6    depends on A -> select A        (3)
687e98062ed6dc4    select A -> depends on A        (3)
68891e5d284a7f1    select A -> (null)
689============    ===================================
690
691(1) Partial (or no) quote of error.
692(2) That seems to be the gist of that fix.
693(3) Same error.
694
695Future kconfig work
696~~~~~~~~~~~~~~~~~~~
697
698Work on kconfig is welcomed on both areas of clarifying semantics and on
699evaluating the use of a full SAT solver for it. A full SAT solver can be
700desirable to enable more complex dependency mappings and / or queries,
701for instance one possible use case for a SAT solver could be that of handling
702the current known recursive dependency issues. It is not known if this would
703address such issues but such evaluation is desirable. If support for a full SAT
704solver proves too complex or that it cannot address recursive dependency issues
705Kconfig should have at least clear and well defined semantics which also
706addresses and documents limitations or requirements such as the ones dealing
707with recursive dependencies.
708
709Further work on both of these areas is welcomed on Kconfig. We elaborate
710on both of these in the next two subsections.
711
712Semantics of Kconfig
713~~~~~~~~~~~~~~~~~~~~
714
715The use of Kconfig is broad, Linux is now only one of Kconfig's users:
716one study has completed a broad analysis of Kconfig use in 12 projects [0]_.
717Despite its widespread use, and although this document does a reasonable job
718in documenting basic Kconfig syntax a more precise definition of Kconfig
719semantics is welcomed. One project deduced Kconfig semantics through
720the use of the xconfig configurator [1]_. Work should be done to confirm if
721the deduced semantics matches our intended Kconfig design goals.
722Another project formalized a denotational semantics of a core subset of
723the Kconfig language [10]_.
724
725Having well defined semantics can be useful for tools for practical
726evaluation of dependencies, for instance one such case was work to
727express in boolean abstraction of the inferred semantics of Kconfig to
728translate Kconfig logic into boolean formulas and run a SAT solver on this to
729find dead code / features (always inactive), 114 dead features were found in
730Linux using this methodology [1]_ (Section 8: Threats to validity).
731The kismet tool, based on the semantics in [10]_, finds abuses of reverse
732dependencies and has led to dozens of committed fixes to Linux Kconfig files [11]_.
733
734Confirming this could prove useful as Kconfig stands as one of the leading
735industrial variability modeling languages [1]_ [2]_. Its study would help
736evaluate practical uses of such languages, their use was only theoretical
737and real world requirements were not well understood. As it stands though
738only reverse engineering techniques have been used to deduce semantics from
739variability modeling languages such as Kconfig [3]_.
740
741.. [0] https://www.eng.uwaterloo.ca/~shshe/kconfig_semantics.pdf
742.. [1] https://gsd.uwaterloo.ca/sites/default/files/vm-2013-berger.pdf
743.. [2] https://gsd.uwaterloo.ca/sites/default/files/ase241-berger_0.pdf
744.. [3] https://gsd.uwaterloo.ca/sites/default/files/icse2011.pdf
745
746Full SAT solver for Kconfig
747~~~~~~~~~~~~~~~~~~~~~~~~~~~
748
749Although SAT solvers [4]_ haven't yet been used by Kconfig directly, as noted
750in the previous subsection, work has been done however to express in boolean
751abstraction the inferred semantics of Kconfig to translate Kconfig logic into
752boolean formulas and run a SAT solver on it [5]_. Another known related project
753is CADOS [6]_ (former VAMOS [7]_) and the tools, mainly undertaker [8]_, which
754has been introduced first with [9]_.  The basic concept of undertaker is to
755extract variability models from Kconfig and put them together with a
756propositional formula extracted from CPP #ifdefs and build-rules into a SAT
757solver in order to find dead code, dead files, and dead symbols. If using a SAT
758solver is desirable on Kconfig one approach would be to evaluate repurposing
759such efforts somehow on Kconfig. There is enough interest from mentors of
760existing projects to not only help advise how to integrate this work upstream
761but also help maintain it long term. Interested developers should visit:
762
763https://kernelnewbies.org/KernelProjects/kconfig-sat
764
765.. [4] https://www.cs.cornell.edu/~sabhar/chapters/SATSolvers-KR-Handbook.pdf
766.. [5] https://gsd.uwaterloo.ca/sites/default/files/vm-2013-berger.pdf
767.. [6] https://cados.cs.fau.de
768.. [7] https://vamos.cs.fau.de
769.. [8] https://undertaker.cs.fau.de
770.. [9] https://www4.cs.fau.de/Publications/2011/tartler_11_eurosys.pdf
771.. [10] https://paulgazzillo.com/papers/esecfse21.pdf
772.. [11] https://github.com/paulgazz/kmax
773