内核kconfig语法及原理

语法

http://www.cnblogs.com/AP0904225/p/5967979.html

目前自己用过

一、菜单

menu "desc"

endmenu

二、可配菜单

menuconfig CONFIG_STR

  bool "desc"

       depends on CONFIG_OTHER

  default  y

       help

if  CONFIG_STR

  ~~do sth

endif

三、单选菜单

choice

  prompt "desc"

  default CONFIG1

config CONFIG1

  bool "desc"

config CONFIG2

  bool "desc"

endchoice

四、配置int,hex宏

config CONFIG_STR
     int "desc(0-4)"
     range 0 4
     default "0"

五、select反依赖

强制选中

config CONFIG_AAA

  bool

config CONFIG_MODULE
  bool "desc"

  select CONFIG_AAA

此时选中config_MODULE,CONFIG_AAA也会同时被选中

原理

http://blog.csdn.net/qqliyunpeng/article/details/50858075

make menuconfig 会生成mconf

自动执行 mconf Kconfig 生成配置界面

界面保存为.config 文件

编译make modules zImage时会生成 autoconf.h   包含   .config中所有被定义为y的宏

原文地址:https://www.cnblogs.com/chencesc/p/6286970.html