Default values can be applied to existing symbols without weakening the symbols dependencies through the use of
config FOO bool "FOO" depends on BAR configdefault FOO default y if FIZZ
The statement above is equivalent to:
config FOO bool "Foo" default y if FIZZ depends on BAR
configdefaultsymbols cannot contain any fields other than
default, however they can be wrapped in
ifstatements. The two statements below are equivalent:
configdefault FOO default y if BAR if BAR configdefault FOO default y endif # BAR
Environment variables in
sourcestatements are expanded directly, meaning no “bounce” symbols with
option env="ENV_VAR"need to be defined.
option envhas been removed from the C tools as of Linux 4.18 as well.
The recommended syntax for referencing environment variables is
$FOO. This uses the new Kconfig preprocessor. The
$FOOsyntax for expanding environment variables is only supported for backwards compatibility.
sourcestatement supports glob patterns and includes each matching file. A pattern is required to match at least one file.
Consider the following example:
If the pattern
foo/bar/*/Kconfigmatches the files
foo/bar/qaz/Kconfig, the statement above is equivalent to the following two
source "foo/bar/baz/Kconfig" source "foo/bar/qaz/Kconfig"
If no files match the pattern, an error is generated.
The wildcard patterns accepted are the same as for the Python glob module.
For cases where it’s okay for a pattern to match no files (or for a plain filename to not exist), a separate
osource(optional source) statement is available.
osourceis a no-op if no file matches.
osourceare analogous to
rsourcestatement is available for including files specified with a relative path. The path is relative to the directory of the
Kconfigfile that contains the
As an example, assume that
foo/Kconfigis the top-level
Kconfigfile, and that
foo/bar/Kconfighas the following statements:
source "qaz/Kconfig1" rsource "qaz/Kconfig2"
This will include the two files
rsourcecan be used to create
Kconfig“subtrees” that can be moved around freely.
rsourcealso supports glob patterns.
A drawback of
rsourceis that it can make it harder to figure out where a file gets included, so only use it if you need it.
orsourcestatement is available that combines
For example, the following statement will include
Kconfig2from the current directory (if they exist):
def_stringkeywords are available, analogous to
def_bool. These set the type and add a
defaultat the same time.