Kconfig syntax

转载:

http://www.rt-embedded.com/blog/archives/working-with-kconfig/


The Kconfig syntax

The Kconfig syntax is very simple and it is documented in the Documentation/kbuild/kconfig-language.txt file. Let’s review some of the basics by a few examples:

  • An example from drivers/video/Kconfig:
config FB_CIRRUS
tristate "Cirrus Logic support"
depends on FB && (ZORRO || PCI)
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
---help---
This enables support for Cirrus Logic GD542x/543x based boards on
Amiga: SD64, Piccolo, Picasso II/II+, Picasso IV, or EGS Spectrum.

The example, defines a new variable in the name of CONFIG_FB_CIRRUS (note that the CONFIG_ prefix is added automatically and should be omitted from the Kconfig file itself). Let’s jump to the help section for a second. We can read that this configuration option enables support for various Cirrus Logic video cards. In the second line, we can see that this variable is in the type of “tristate”. It means that this configuration option has 3 possible states; Disabled, Enabled and Modulized. Each configuration option must have a type. The available types are: “bool“, “tristate“, “string“, “hex” or “int“. Each type has its own properties. The bool type can be either Enabled or Disabled. The string type will contain a list of characters. Thehex type will contain a hexadecimal representation of a number (usually used to assign hardware address and ids) and theint type contains numbers. Right next to the type, you’ll find the prompt string that represents the configuration option in the menu (or in the prompt). Next, shows the dependency of this configuration option. It means that this option will not be available for selection if the CONFIG_FB option is not enabled and either CONFIG_ZORRO or CONFIG_PCI are enabled. In this way, the driver developer can be sure that this driver will not be available unless the Frame Buffer framework is enabled and the target has either Zorro or PCI interfaces enabled (otherwise, the driver will fail to compile or run). The next lines, with theselect option, show options that the driver needs in order to operate correctly. In this example, we see that the driver requires a few Frame Buffer options to be enabled.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值