对于布尔配置,我使用的是 select。有没有类似的字符串?
最终,我想要类似的东西:
config MY_VAR_STR
string
config MY_VAR_BOOL
bool
default n
config OPTION_2
bool
# Set MY_VAR_BOOL value to y
select MY_VAR_BOOL
# something like set MY_VAR "test string"
对于布尔配置,我使用的是 select。有没有类似的字符串?
最终,我想要类似的东西:
config MY_VAR_STR
string
config MY_VAR_BOOL
bool
default n
config OPTION_2
bool
# Set MY_VAR_BOOL value to y
select MY_VAR_BOOL
# something like set MY_VAR "test string"
select
根据内核文档 v4.15,不能用于非布尔值
https://github.com/torvalds/linux/blob/v4.15/Documentation/kbuild/kconfig-language.txt#L104说:
- reverse dependencies: "select" <symbol> ["if" <expr>]
[...]
Reverse dependencies can only be used with boolean or tristate symbols.
这可能意味着根本不可能。
可以像这样在字符串变量上使用默认值:
config MY_VAR_STR
string
default "test string" if OPTION_2
config OPTION_2
bool