diff options
Diffstat (limited to 'Documentation/kbuild')
-rw-r--r-- | Documentation/kbuild/kconfig-language.txt | 54 |
1 files changed, 48 insertions, 6 deletions
diff --git a/Documentation/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.txt index 616043a6da99..53ca12f7999f 100644 --- a/Documentation/kbuild/kconfig-language.txt +++ b/Documentation/kbuild/kconfig-language.txt | |||
@@ -24,7 +24,7 @@ visible if its parent entry is also visible. | |||
24 | Menu entries | 24 | Menu entries |
25 | ------------ | 25 | ------------ |
26 | 26 | ||
27 | Most entries define a config option, all other entries help to organize | 27 | Most entries define a config option; all other entries help to organize |
28 | them. A single configuration option is defined like this: | 28 | them. A single configuration option is defined like this: |
29 | 29 | ||
30 | config MODVERSIONS | 30 | config MODVERSIONS |
@@ -50,7 +50,7 @@ applicable everywhere (see syntax). | |||
50 | 50 | ||
51 | - type definition: "bool"/"tristate"/"string"/"hex"/"int" | 51 | - type definition: "bool"/"tristate"/"string"/"hex"/"int" |
52 | Every config option must have a type. There are only two basic types: | 52 | Every config option must have a type. There are only two basic types: |
53 | tristate and string, the other types are based on these two. The type | 53 | tristate and string; the other types are based on these two. The type |
54 | definition optionally accepts an input prompt, so these two examples | 54 | definition optionally accepts an input prompt, so these two examples |
55 | are equivalent: | 55 | are equivalent: |
56 | 56 | ||
@@ -108,7 +108,7 @@ applicable everywhere (see syntax). | |||
108 | equal to 'y' without visiting the dependencies. So abusing | 108 | equal to 'y' without visiting the dependencies. So abusing |
109 | select you are able to select a symbol FOO even if FOO depends | 109 | select you are able to select a symbol FOO even if FOO depends |
110 | on BAR that is not set. In general use select only for | 110 | on BAR that is not set. In general use select only for |
111 | non-visible symbols (no promts anywhere) and for symbols with | 111 | non-visible symbols (no prompts anywhere) and for symbols with |
112 | no dependencies. That will limit the usefulness but on the | 112 | no dependencies. That will limit the usefulness but on the |
113 | other hand avoid the illegal configurations all over. kconfig | 113 | other hand avoid the illegal configurations all over. kconfig |
114 | should one day warn about such things. | 114 | should one day warn about such things. |
@@ -162,9 +162,9 @@ An expression can have a value of 'n', 'm' or 'y' (or 0, 1, 2 | |||
162 | respectively for calculations). A menu entry becomes visible when it's | 162 | respectively for calculations). A menu entry becomes visible when it's |
163 | expression evaluates to 'm' or 'y'. | 163 | expression evaluates to 'm' or 'y'. |
164 | 164 | ||
165 | There are two types of symbols: constant and nonconstant symbols. | 165 | There are two types of symbols: constant and non-constant symbols. |
166 | Nonconstant symbols are the most common ones and are defined with the | 166 | Non-constant symbols are the most common ones and are defined with the |
167 | 'config' statement. Nonconstant symbols consist entirely of alphanumeric | 167 | 'config' statement. Non-constant symbols consist entirely of alphanumeric |
168 | characters or underscores. | 168 | characters or underscores. |
169 | Constant symbols are only part of expressions. Constant symbols are | 169 | Constant symbols are only part of expressions. Constant symbols are |
170 | always surrounded by single or double quotes. Within the quote, any | 170 | always surrounded by single or double quotes. Within the quote, any |
@@ -301,3 +301,45 @@ mainmenu: | |||
301 | 301 | ||
302 | This sets the config program's title bar if the config program chooses | 302 | This sets the config program's title bar if the config program chooses |
303 | to use it. | 303 | to use it. |
304 | |||
305 | |||
306 | Kconfig hints | ||
307 | ------------- | ||
308 | This is a collection of Kconfig tips, most of which aren't obvious at | ||
309 | first glance and most of which have become idioms in several Kconfig | ||
310 | files. | ||
311 | |||
312 | Build as module only | ||
313 | ~~~~~~~~~~~~~~~~~~~~ | ||
314 | To restrict a component build to module-only, qualify its config symbol | ||
315 | with "depends on m". E.g.: | ||
316 | |||
317 | config FOO | ||
318 | depends on BAR && m | ||
319 | |||
320 | limits FOO to module (=m) or disabled (=n). | ||
321 | |||
322 | |||
323 | Build limited by a third config symbol which may be =y or =m | ||
324 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
325 | A common idiom that we see (and sometimes have problems with) is this: | ||
326 | |||
327 | When option C in B (module or subsystem) uses interfaces from A (module | ||
328 | or subsystem), and both A and B are tristate (could be =y or =m if they | ||
329 | were independent of each other, but they aren't), then we need to limit | ||
330 | C such that it cannot be built statically if A is built as a loadable | ||
331 | module. (C already depends on B, so there is no dependency issue to | ||
332 | take care of here.) | ||
333 | |||
334 | If A is linked statically into the kernel image, C can be built | ||
335 | statically or as loadable module(s). However, if A is built as loadable | ||
336 | module(s), then C must be restricted to loadable module(s) also. This | ||
337 | can be expressed in kconfig language as: | ||
338 | |||
339 | config C | ||
340 | depends on A = y || A = B | ||
341 | |||
342 | or for real examples, use this command in a kernel tree: | ||
343 | |||
344 | $ find . -name Kconfig\* | xargs grep -ns "depends on.*=.*||.*=" | grep -v orig | ||
345 | |||