CML2 configuration file formats

Defconfig format

A defconfig file consists of a series of lines in the format of Unix shell variable assignments. Each line is led with a symbol name (prefixed if there is a prefix declaration in the rulebase), continues with a =, and finishes with a value. The value may be y, n, or m for boolean or tristate symbols. It may be a quoted string for string literals, or an (unquoted) numeric literal for decimal or hexadecimal symbols.

Unlike CML1's tools, CML2 writes explicit FOO=n defconfig lines when a boolean or tristate symbol has been set by the user (or as a side effect of user actions).

When a symbol FOO has not been set, CML2 may emit a comment of the form
#CONFIG_FOO is not
set.
. In CML1, these comments were also emitted for symbols with the value n.

Rationale: The change in treatment of symbols with value n is important in order to allow defconfigs to contain partial configurations that suppress features, e.g. such as might be generated by an autoprobe utility checking for the presence of buses or controller types.

In the reference implementation, symbols are written in depth-first traversal order. Derived symbols are written after the query symbols; each derived symbol is written out if any of the symbols in its formula has been set.

Macrofile format

A macrofile is a series of C #define macro lines corresponding to configuration symbols. The macro corresponding to as symbol has the same name as that symbol, prefixed if there is a "prefix" declaration in the rulebase.

If a boolean or tristate symbol has the value y, CML2 generates a line defining the corresponding macro to have the value 1.

If a boolean or tristate symbol has the value n, CML2 generates a line undefining the corresponding macro.

If a boolean or tristate symbol has the value m, CML2 generates two lines. The first undefines the corresponding macro. The second defines a macro with the same name and the suffix "_MODULE" to be 1.

Each decimal and hexadecimal symbol generates a line defining the corresponding macro to the value of the numeric literal.

Each string symbol generates a line defining the corresponding macro to the value of the string, as a C string literal in double quotes.

These format conventions are identical to CML1's.