【问题标题】:How to select the value of a string option from another option in Kbuild Kconfig files?如何从 Kbuild Kconfig 文件中的另一个选项中选择字符串选项的值?
【发布时间】:2017-03-11 13:56:23
【问题描述】:

对于布尔配置,我使用的是选择。字符串有类似的吗?

最后,我想要这样的东西:

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"

【问题讨论】:

    标签: linux-kernel kbuild


    【解决方案1】:

    根据内核文档 v4.15,不能将 select 用于非布尔值

    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.
    

    这可能意味着根本不可能。

    【讨论】:

      【解决方案2】:

      可以像这样在字符串变量上使用默认值:

      config MY_VAR_STR
          string
          default "test string" if OPTION_2
      
      config OPTION_2
          bool
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-06-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多