| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 | Introduction------------The configuration database is collection of configuration optionsorganized in a tree structure:	+- Code maturity level options	|  +- Prompt for development and/or incomplete code/drivers	+- General setup	|  +- Networking support	|  +- System V IPC	|  +- BSD Process Accounting	|  +- Sysctl support	+- Loadable module support	|  +- Enable loadable module support	|     +- Set version information on all module symbols	|     +- Kernel module loader	+- ...Every entry has its own dependencies. These dependencies are usedto determine the visible of an entry. Any child entry is onlyvisible if its parent entry is also visible.Menu entries------------Most entries define a config option, all other entries help to organizethem. A single configuration option is defined like this:config MODVERSIONS	bool "Set version information on all module symbols"	depends MODULES	help	  Usually, modules have to be recompiled whenever you switch to a new	  kernel.  ...Every line starts with a key word and can be followed by multiplearguments.  "config" starts a new config entry. The following linesdefine attributes for this config option. Attributes can be the type ofthe config option, input prompt, dependencies, help text and defaultvalues. A config option can be defined multiple times with the samename, but every definition can have only a single input prompt and thetype must not conflict.Menu attributes---------------A menu entry can have a number of attributes. Not all of them areapplicable everywhere (see syntax).- type definition: "bool"/"tristate"/"string"/"hex"/"integer"  Every config option must have a type. There are only two basic types:  tristate and string, the other types base on these two. The type  definition optionally accepts an input prompt, so these two examples  are equivalent:	bool "Networking support"  and	bool	prompt "Networking support"- input prompt: "prompt" <prompt> ["if" <expr>]  Every menu entry can have at most one prompt, which is used to display  to the user. Optionally dependencies only for this prompt can be added  with "if".- default value: "default" <symbol> ["if" <expr>]  A config option can have any number of default values. If multiple  default values are visible, only the first defined one is active.  Default values are not limited to the menu entry, where they are  defined, this means the default can be defined somewhere else or be  overriden by an earlier definition.  The default value is only assigned to the config symbol if no other  value was set by the user (via the input prompt above). If an input  prompt is visible the default value is presented to the user and can  be overridden by him.  Optionally dependencies only for this default value can be added with  "if".- dependencies: "depends on"/"requires" <expr>  This defines a dependency for this menu entry. If multiple  dependencies are defined they are connected with '&&'. Dependencies  are applied to all other options within this menu entry (which also  accept "if" expression), so these two examples are equivalent:	bool "foo" if BAR	default y if BAR  and	depends on BAR	bool "foo"	default y- help text: "help"  This defines a help text. The end of the help text is determined by  the level indentation, this means it ends at the first line which has  a smaller indentation than the first line of the help text.Menu dependencies-----------------Dependencies define the visibility of a menu entry and can also reducethe input range of tristate symbols. The tristate logic used in theexpressions uses one more state than normal boolean logic to express themodule state. Dependency expressions have the following syntax:<expr> ::= <symbol>                             (1)           <symbol> '=' <symbol>                (2)           <symbol> '!=' <symbol>               (3)           '(' <expr> ')'                       (4)           '!' <expr>                           (5)           <expr> '||' <expr>                   (6)           <expr> '&&' <expr>                   (7)Expressions are listed in decreasing order of precedence.(1) Convert the symbol into an expression. Boolean and tristate symbols    are simply converted into the respective expression values. All    other symbol types result in 'n'.(2) If the values of both symbols are equal, it returns 'y',    otherwise 'n'.(3) If the values of both symbols are equal, it returns 'n',    otherwise 'y'.(4) Returns the value of the expression. Used to override precedence.(5) Returns the result of (2-/expr/).(6) Returns the result of min(/expr/, /expr/).(7) Returns the result of max(/expr/, /expr/).An expression can have a value of 'n', 'm' or 'y' (or 0, 1, 2respectively for calculations). A menu entry becomes visible when it'sexpression evaluates to 'm' or 'y'.There are two type of symbols: constant and nonconstant symbols.Nonconstant symbols are the most common ones and are defined with the'config' statement. Nonconstant symbols consist entirely of alphanumericcharacters or underscores.Constant symbols are only part of expressions. Constant symbols arealways surrounded by single or double quotes. Within the quote anyother character is allowed and the quotes can be escaped using '\'.Menu structure--------------The position of a menu entry in the tree is determined in two ways. Firstit can be specified explicitely:menu "Network device support"	depends NETconfig NETDEVICES	...endmenuAll entries within the "menu" ... "endmenu" block become a submenu of"Network device support". All subentries inherit the dependencies fromthe menu entry, e.g. this means the dependency "NET" is added to thedependency list of the config option NETDEVICES.The other way to generate the menu structure is done by analyzing thedependencies. If a menu entry somehow depends on the previous entry, itcan be made a submenu of it. First the the previous (parent) symbol mustbe part of the dependency list and then one of these two condititionsmust be true:- the child entry must become invisible, if the parent is set to 'n'- the child entry must only be visible, if the parent is visibleconfig MODULES	bool "Enable loadable module support"config MODVERSIONS	bool "Set version information on all module symbols"	depends MODULEScomment "module support disabled"	depends !MODULESMODVERSIONS directly depends on MODULES, this means it's only visible ifMODULES is different from 'n'. The comment on the other hand is alwaysvisible when MODULES it's visible (the (empty) dependency of MODULES isalso part of the comment dependencies).Kconfig syntax--------------The configuration file describes a series of menu entries, where everyline starts with a keyword (except help texts). The following keywordsend a menu entry:- config- choice/endchoice- comment- menu/endmenu- if/endif- sourceThe first four also start the definition of a menu entry.config:	"config" <symbol>	<config options>This defines a config symbol <symbol> and accepts any of aboveattributes as options.choices:	"choice"	<choice options>	<choice block>	"endchoice"This defines a choice group and accepts any of above attributes asoptions. A choice can only be of type bool or tristate, while a booleanchoice only allows a single config entry to be selected, a tristatechoice also allows any number of config entries to be set to 'm'. Thiscan be used if multiple drivers for a single hardware exists and only asingle driver can be compiled/loaded into the kernel, but all driverscan be compiled as modules.A choice accepts another option "optional", which allows to set thechoice to 'n' and no entry needs to be selected.comment:	"comment" <prompt>	<comment options>This defines a comment which is displayed to the user during theconfiguration process and is also echoed to the output files. The onlypossible options are dependencies.menu:	"menu" <prompt>	<menu options>	<menu block>	"endmenu"This defines a menu block, see "Menu structure" above for moreinformation. The only possible options are dependencies.if:	"if" <expr>	<if block>	"endif"This defines an if block. The dependency expression <expr> is appendedto all enclosed menu entries.source:	"source" <prompt>This reads the specified configuration file. This file is always parsed.
 |