Linux kernel to compile the relevant documents Detailed Kconfig

ref : https://blog.csdn.net/Ultraman_hs/article/details/52984929

 

Kconfig format

The following documents taken part in Kconfig / drivers / net of:

# Network device configuration
menuconfig NETDEVICES
        default y if UML
        depends on NET
        bool "Network device support" ---help--- You can say N here if you don't intend to connect your Linux box to any other computer at all. …… config DM9000 tristate "DM9000 support" depends on ARM || BLACKFIN || MIPS select CRC32 select MII ---help--- Support for DM9000 chipset. To compile this driver as a module, choose M here. The module will be called dm9000. …… source "drivers/net/arcnet/Kconfig" source "drivers/net/phy/Kconfig"

Kconfig written according to a certain format, this format can be identified menuconfig program, then extracts the useful information in the composition of the menu item menuconfig. In doing drive future transplant work, sometimes you need to add your own Kconfig in a configuration item to add a device driver to the kernel configuration program, this time you need to configure the format of the item Kconfig of understanding, or not It will be added.

menuconfig : represents the menu (the menu itself is a project, but he has a sub-menu item), config represents a configuration item menu (not the project itself under the sub-menu). All config item is a submenu follow this menuconfig behind menuconfig. This is the directory relations Kconfig represented.

NETDEVICES : NETDEVICES is similar to the name of the configuration item or configuration item menuconfig config separated by a space behind the capital letters, after adding CONFIG_ the front of the string constitutes a configuration item name ".config" file.

Source : kernel source tree each Kconfig will be introducing its Kconfig in all subdirectories with source, thus ensuring that all the items have been included into the Kconfig in menuconfig. This also shows that: if you add in the linux kernel in a folder, be sure to create a Kconfig file in this folder, and then introduced into this folder in the folder Kconfig the source of the parent directory of Kconfig file.

Tristate : mean three states (three states, corresponding to Y, N, M three options mode), meaning that the item may be configured three options.

BOOL : it is either true or false (corresponding to Y and N). This means that the configuration items can only be two options.

The depends : this means that the configuration item dependent on another configuration item. If that is dependent on configuration items Y or M, then this configuration item makes sense; if dependent configuration items which itself is set to N, then there is no sense in this configuration item. depends items will lead to time make menuconfig can not find some configuration items. If you can not find it in the menuconfig an option, but this option is Kconfig in there, it may cause a configuration item is dependent on the configuration item is not established. depends dependency may be a plurality of configuration items may also be a logical operation. This time as long as the project operator-dependent expression evaluates to true is dependent on the establishment.

select : representation depends on when the value is valid, the following select will be established, will be selected on the corresponding content.

default : When represented depends on the effective value, the following default will be set up, the respective option is selected, there are three options, corresponding to y, n, m.

Help : Help information, explain the meaning of configuration items, as well as how to configure him.

Kconfig associated Makefile and .config files and three

CI is configured to Y, N, M will affect ".config" configuration value file CONFIG_XXX variables. Configuration values ​​".config" in (= y, = m, no) affect the final compile-link. If = y will be incorporated into (built-in), if = m are individually connected to a ".ko" module, if not then the corresponding code will not be compiled. So how is this achieved? It is achieved through makefile.

As the makefile: obj - $ (CONFIG_DM9000) + = dm9000.o,
if CONFIG_DM9000 variable is y, then obj + = dm9000.o, so dm9000.c is compiled; CONFIG_DM9000 if the variable is not defined, it is not dm9000.c It will be compiled. If the value of the variable CONFIG_DM9000 m will be connected to the ".ko" module.

Guess you like

Origin www.cnblogs.com/schips/p/11040271.html