summaryrefslogtreecommitdiff
path: root/scripts/kconfig/lkc_spec
Unidiff
Diffstat (limited to 'scripts/kconfig/lkc_spec') (more/less context) (ignore whitespace changes)
-rw-r--r--scripts/kconfig/lkc_spec250
1 files changed, 250 insertions, 0 deletions
diff --git a/scripts/kconfig/lkc_spec b/scripts/kconfig/lkc_spec
new file mode 100644
index 0000000..45c36eb
--- a/dev/null
+++ b/scripts/kconfig/lkc_spec
@@ -0,0 +1,250 @@
11. General Structure
2
3The configuration file describes a series of menu entries. These menu
4entries are organized in a tree structure. The following statements
5start a new menu entry definition (and end a previous menu entry):
6- config
7- choice
8- comment
9- menu
10The following statements are control entries and also end the definition
11of a previous menu entry:
12- source
13- if
14
152. Dependencies
16
17Every menu entry has dependencies, which define it's visibility in the
18menu structure. What makes these dependencies more difficult is that
19they use three states instead of two, that most programmers are familiar
20with. The additional 'mod' state is needed to describe drivers which
21are not compiled into the kernel, but are compiled as modules, which
22can be loaded at runtime. Nevertheless they should be straigthforward
23to use.
24Dependencies describe in first place the relation between configuration
25symbols and consequently between different parts of the kernel. To
26simplify the verification of the rule base, dependencies must be
27hierarchical, that means no recursive dependencies are allowed. The only
28possible non-hierarchical dependency are exclusions (aka choices), to
29cover typical uses during kernel configuration the semantic of choice
30statements has been extended (see the choice statement below).
31
32This allows to describe the following basic relationships:
33- initialization order of kernel subsystems. That means which other
34 subsystems are required (initialized and working), before a specific
35 subsystem can be initialized itself. This allows above requirement of
36 hierarchical dependencies.
37- mutual exclusions of kernel subsystems. This allows that only a single
38 of multiple possible subsystems is configured into the kernel.
39These are the same relationships, which are reasonably representable
40with cml1, but with this new config syntax it should be possible to
41easily add further relationships and other properties.
42
43The important usage of the dependency information is for generation of
44the menu structure. First it defines whether a symbol or statement is
45visible at all. If the dependency expression evaluates to 'n', the symbol
46is not visible (and is currently also not saved, this BTW corresponds to
47the behavior of xconfig, which is noted as a bug in Documentation/
48kbuild/config-language.txt, that didn't seem to be a problem so far, but
49that has to be considered).
50If a symbol is visible, it defines the possible input range for tristate
51symbols, if the dependency expression evaluates to 'm', a tristate symbol
52can only be set to 'n' or 'm', otherwise also 'y' is possible.
53Finally dependency information is also used to group symbols together.
54If a symbol entry is followed by other symbol entries which depends on
55the first one, the latter entries are associated with the first entry.
56The text config front end uses this information to automatically indent
57the entries, the qt interface creates further submenus. This can reduce
58the amount of explicit menu information required.
59
60syntax:
61
62This is the syntax of dependency expressions:
63
64 <expr> ::= <symbol> (1)
65 <symbol> '=' <symbol> (2)
66 <symbol> '!=' <symbol> (3)
67 '(' <expr> ')' (4)
68 '!' <expr> (5)
69 <expr> '||' <expr> (6)
70 <expr> '&&' <expr> (7)
71
72Expressions are listed in decreasing order of precedence. An
73expression can have a value of 'n', 'm' or 'y' (or 0, 1, 2 respectively
74for calculations below).
75There are two type of symbols: constant and nonconstant symbols.
76Nonconstant symbols are the most common ones and are defined with the
77'config' statement. Nonconstant symbols consist entirely of alphanumeric
78characters or underscores.
79Constant symbols are only part of expressions. Constant symbols are
80always surrounded by single or double quotes. Within the quote any
81other character is allowed and the quotes can be escaped using '\'.
82Nonconstant symbols which are nowhere defined with 'config' are a
83special case, they behave like constant symbols, so that one can do
84"FOO=123", it usage should restricted to number values (this might
85be enforced later).
86
87expression syntax:
88
89(1) Convert the symbol into an expression. Boolean and tristate symbols
90 are simply converted into the respective expression values. All other
91 symbol types result in 'n'.
92(2) If the values of both symbols are equal, it returns 'y', otherwise 'n'.
93(3) If the values of both symbols are equal, it returns 'n', otherwise 'y'.
94(4) Returns the value of the expression. Used to override precedence.
95(5) Returns the result of (2-/expr/).
96(6) Returns the result of min(/expr/, /expr/).
97(7) Returns the result of max(/expr/, /expr/).
98
993. "config"
100
101syntax:
102
103 "config" <symbol>
104 <config options>
105
106Defines a new config symbol. A symbol can be defined multiple times as
107long as the symbol type is always the same.
108
109config options:
110
111 "depends" <expr>
112
113defines the visibility and the input range of the config symbol.
114
115 "tristate" <prompt> "if" <expr>
116 "bool" <prompt> "if" <expr>
117 "int" <prompt> "if" <expr>
118 "hex" <prompt> "if" <expr>
119 "string" <prompt> "if" <expr>
120
121defines the type of the symbol and the prompt which is used to request a
122value from the user. Additional constraints for the visibility and the
123input range of the prompt can be defined after an "if" statement. The
124prompt and the "if" statement are optional, but an "if" statement
125without a prompt is not possible.
126
127 "prompt" <prompt> "if" <expr>
128
129same as above, but without defining the type of the symbol. This was
130generated by earlier versions of the converter and will likely
131disappear unless needed otherwise.
132
133 "default" <symbol> "if" <expr>
134
135defines a default value for the config symbol. Unless the config symbol
136was previously set by the user, it will set to this value. This means
137it will be used as default value for above input prompts or if no user
138prompt is visible the config symbol will be saved with this value. If
139multiple default statements are visible only the first is used.
140
141 "help"
142
143defines a help text for this statement. The end of the help text
144is determined by the level indentation, this means it ends at the first
145line which has a smaller indentation than the first line of the help text.
146
1474. "choice"
148
149syntax:
150
151 "choice"
152 <choice options>
153 <choice block>
154 "endchoice"
155
156defines a group of related config statements. There are two types of
157choice statements - bool and tristate.
158
159bool choice: allows only single config statement to be selected and
160set to "y".
161tristate choice: extends the bool choice by also allowing multiple
162config statement to be selected, but in this mode these will only be set
163"m". This can be used if multiple drivers for a single hardware exists
164and only a single driver can be compiled/loaded into the kernel, but all
165drivers can be compiled as modules.
166
167choice options:
168
169 "depends" <expr>
170
171defines the visibility and the input range of the choice.
172
173 "prompt" <prompt>
174
175defines the prompt which is presented to the user.
176
177 <optional>
178
179by default exactly one of the config statements of a bool choice has
180to be selected, this option allows that also no config statement has to
181be selected.
182
183 "default" <symbol>
184
185defines the default choice presented to the user. The prompt must be a
186one of symbols defined within this choice.
187
188 "help"
189
190defines a help text for this choice statement. The end of the help text
191is determined by the level indentation, this means it ends at the first
192line which has a smaller indentation than the first line of the help text.
193
194choice block:
195
196right now only config statements allowed. (It's possible to also allow
197other statements later.)
198
1995. "comment"
200
201syntax:
202
203 "comment" <prompt>
204 <comment options>
205
206defines the prompt which is displayed to the user during the
207configuration process and is also echoes it to the output files during
208output.
209
210comment options:
211
212 "depends" <expr>
213
214defines the visibility of the comment.
215
2166. "menu"
217
218syntax:
219
220 "menu" <prompt>
221 <menu options>
222 <menu block>
223 "endmenu"
224
225menu options:
226
227 "depends" <expr>
228
229defines the visibility of the menu.
230
231menu block:
232
233Any of the basic statements is allowed within a menu block.
234
2357. "if"
236
237syntax:
238
239 "if" <expr>
240 <if block>
241 "endif"
242
2438. "source"
244
245syntax:
246
247 "source" <prompt>
248
249reads the specified configuration file. this is done unconditionally,
250