上次进了Kconfig的原理,本文主要介绍写法
1.comment 显示在菜单的注释:
comment “YGC_CFG_TST”
2.config 配置项,config USB意义就是定义CONFIG_USB变量:
config YGC_CFG_TST
bool “ygc bool test”
变量有几种类型:
bool /boolean bool和boolean都是一样的, 表示布尔类型,只有y和n.
tristate 有y n和m
depends on 依赖,当依赖的定义为Y时才会有效,否则不显示。
default 默认值
3.菜单:使用menu 和endmenu新建一个菜单,
menu “YGC_CFG_TST menu”
comment “YGC_CFG_TST menu”
config YGC_CFG_TST1
bool “ygc bool test”
config YGC_CFG_TST2
tristate “ygc bool test2”
endmenu
4.choice 单选,在多项配置中选择一项
choice
prompt "choose test0"
default TEST3
config TEST1
bool "ygc bool test1"
config TEST2
bool "ygc bool test2"
config TEST22
bool "ygc bool test2"
config TEST3
bool "ygc bool test3"
endchoice
6.source 加载另一个文件:
"drivers/KcfgBak"
menu "Source Test"
choice
prompt "source test"
default TEST3
config TEST1
bool "ygc bool test1"
config TEST2
bool "ygc bool test2"
config TEST3
bool "ygc bool test3"
endchoice
endmenu
7.select 反向依赖
config USB_G_ANDROID
boolean “Android Composite Gadget”
select USB_F_ACM
select USB_LIBCOMPOSITE
select USB_U_SERIAL
当前配置项被选中时,选中symbol,忽略依赖项和手动设置值。只有boolean和tristate类型的symbol可以使用反向依赖。