Kconfig原理与示例(二)常用语法关键词

上次进了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可以使用反向依赖。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值