kconfig-language.rst 27 KB

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