LINUX Kconfig Syntax

  

Each option has its own dependencies. These dependencies determine whether the option is visible. The parent option is visible and the child options are visible. 1 Menu Options Most of the options define a configuration option, and other options help organize them. (Original: Most entries define a config option, all other entries help to organize them.) A configuration option definition can be of the form: config MODVERSIONSbool "Set version information on all module symbols"depends MODULEShelpUsually, modules have to be recompiled whenever You switch to a newkernel. ...each line starts with a keyword and can take multiple parameters. "config" defines a new configuration option. The following lines define the properties of this configuration option. Properties can be the type of configuration option, input prompt, dependencies, help information, and default values. Configuration options can be defined multiple times with the same name, but each definition can only have one input prompt and the types cannot conflict. 2 Menu Properties Menu options can have multiple properties. These properties are not required to be used anywhere (see syntax). - Type definition: "bool"/"tristate"/"string"/"hex"/"int" bool boolean type, tristate tristate: built-in, module, remove string string, hex sixteen Binary, integer integer

Each configuration option must specify a type. There are two basic types: tristate and string, and other types are based on these two basic types. Type definitions can be entered with hints, so the following two examples are equivalent: bool "Networking support" and boolprompt "Networking support"- Enter the prompt: "prompt" <prompt> ["if" < Expr>] Each menu option can only have at most one input prompt that is displayed to the user. You can use "if" to indicate the dependency of the prompt, which of course is optional. - Default: "default" <expr> ["if" <expr>] A configuration option can have any number of default values. If there are multiple default values, then only the first defined value is available. The default values ​​are not limited to the menu options that are applied to define them. This means that the default value can be defined anywhere or covered by an earlier definition. If the user does not set (via the input prompt above), the value of the configuration option is the default. If the input prompt can be displayed, the default value will be displayed to the user and the user can modify it. The default dependency can be added with "if". (optional) - Dependencies: "depends on"/"requires" <expr> defines dependencies for a menu option. If multiple dependencies are defined, they are separated by '&&'. Dependencies can also be applied to all other options in the menu (also accepting if expressions), so the following two examples are equivalent: bool "foo" if BARdefault y if BARanddepends on BARbool "foo"default y - Reverse dependencies: "select" <symbol> ["if" <expr>] Although normal dependencies can lower the upper limit of an option, reverse dependencies can lower this limit even lower. The value of the current menu option is the minimum value of symbol. If the symbol is selected multiple times, the upper limit is the maximum value. Reverse dependencies can only be used on boolean or tristate options. - Data range: "range" <symbol> <symbol> ["if" <expr>] sets the range of input values ​​for options of type int and hex. The user can only enter a value greater than or equal to the first symbol, less than or equal to the value of the second symbol. - Help information: "help" or "---help---" Define a help message. The end of the help message is determined by the level of indentation, which means that the message ends at the first line that is smaller than the indentation of the help message. "---help---" and "help" There is no difference in the role of the implementation, "---help---" Helps to put the configuration logic in the file with the prompts for the developer separate. 3 Menu dependency dependencies determine whether menu options are visible or not, and can also reduce the input range of tristate. The tristate logic uses more states in the expression than the boolean logic to represent the state of the module. The syntax of the dependency expression is as follows: <expr> ::= <symbol> (1)<symbol> '=' <symbol> (2)<symbol> '!=' <symbol> (3 )'(' <expr> ')' (4)'!' <expr> (5)<expr> '&&' <expr> (6)<expr> '| | ' <expr> (7) The expression is in descending order of priority. (1) Assign a symbol to an expression. Boolean and tristate types of symbols are assigned directly to the expression. All other types of symbols are assigned 'n'. (2) If the two symbols are equal, return 'y', otherwise 'n'. (3) If the two symbols are equal, return 'n', otherwise 'y'. (4) Returns the value of the expression. Used to change the priority. (5) Returns the result of (2-/expr/). (6) Returns the result of min(/expr/, /expr/). (7) Returns the result of max(/expr/, /expr/). The value of an expression can be 'n', 'm' or 'y' (or the result of the calculation 0, 1, 2). Menu items are visible when the value of the expression is 'm' or 'y'. There are two types of symbols: immutable and mutable. The immutable symbol is the most common, defined by the 'config' statement, consisting entirely of numbers, letters, and underscores (alphanumeric characters or underscores). An immutable symbol is only part of an expression. Often enclosed in single or double quotes. In quotation marks, you can use any character, using quotes to use the escape character '\\'. 4 The position of the menu structure menu in the tree can be determined in two ways. The first one can be like this: menu "Network device support"depends NETconfig NETDEVICES...endmenu All are in the "Network device support" submenu between "menu" ... "endmenu". All submenu options inherit the dependencies of the parent menu. For example, the "NET" dependency is added to the dependency list of the configuration option NETDEVICES. There is also the structure of the menu generated by analyzing the dependencies. If the menu option depends to some extent on the previous option, it can be a submenu of the option. First, the previous (parent) options must be part of the list of dependencies and must have options that satisfy the following two conditions:

Copyright © Windows knowledge All Rights Reserved