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