Kconfig语法

本文介绍uboot或者kernel中kconfig的语法

菜单栏

uboot菜单栏

就会出现箭头里面的内容就是menu下面的配置项
menu “Boot timing”
xxx
xxx
endmenu
menu “Boot media”
endmenu
在这里插入图片描述

kernel菜单栏显示

menuconfig USB_SUPPORT
if USB_SUPPORT
config USB_CONFIGFS_RNDIS
bool “RNDIS”
depends on USB_CONFIGFS
depends on NET
select USB_U_ETHER
select USB_F_RNDIS
endif

  1. bool 说明只有* 和null
  2. depend 必须USB_CONFIGFS 为y 或者*
  3. select 说明吧这个config置位至于是y还是m 得看你的上级不是指这个USB_CONFIGFS_RNDIS配置项而是 USB_CONFIGFS_RNDIS的父类是什么类型的他就是什么类型
    本例中USB_SUPPORT 为m USB_U_ETHER就为m

类型

  1. bool 要么* 要么null 一般用[] 显示
  2. tristate 要么M 要么* 要么null 一般用 <> 显示
    tristate 具有集成性假如他的上级是M 那么他的下级就只有M和null的选址
    假如他的上级是* ,那么他的下级就可以* M NULL这个类型比较特殊

说明

config BOOTDELAY    --->CONFIG_BOOTDELAY
	int "delay in seconds before automatically booting"
	default 2
	depends on AUTOBOOT
	help
	  Delay before automatically running bootcmd;
	  set to 0 to autoboot with no delay, but you can stop it by key input.
1. CONFIG_BOOTDELAY=2
2. int  表示这是一个数字属性 后面的"内容"是menuconfig 界面看到的title内容
	该位假如为bool 则界面为*和空格来描述而不是写内容
	string  也是需要写入表示字符串
4. default默认值
5. 依赖项目,假如AUTOBOOT不使能该功能也没有
6. help为menuconfig 中每个项的help栏目显示的内容

设置值

config SYS_CLK_FREQ
default 960000000

  1. 这种 界面也不显示直接值写死,要是想让界面显示+ int 和"title"

Guess you like

Origin blog.csdn.net/weixin_41884251/article/details/119953131