How does kconfig work




















It makes it possible to use Kconfig in other projects without having to copy it and maintain it separately. Stack Overflow for Teams — Collaborate and share knowledge with a private group.

Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. How does lxdialog and kconfig menuconfig work together? Ask Question.

Asked 7 years, 6 months ago. Active 7 years, 2 months ago. Viewed 1k times. Improve this question. What does bash-dialog mean? Add a comment. Active Oldest Votes. Like most drivers, coin can be built in the kernel, included as a module or not included at all. Also, it doesn't make sense to add the coin statistics to the kernel if you choose not to include the coin driver itself. This behavior is very common in the kernel—for example, you can't add a block-based filesystem, such as ext3 or fat32, if you didn't enable the block layer first.

Obviously, there is some kind of dependency between symbols, and you should model this. Fortunately, you can describe config symbols' relationships in Kconfig files using the depends on keyword. When, for example, the make menuconfig target generates the compilation options menu tree, it hides all the options whose symbol dependencies are not met. This is just one of many keywords available for describing symbols in a Kconfig file.

As mentioned previously, make targets that build a tree menu with all the compilation options use this config symbol, so you can choose what to compile in your kernel and its modules. For example, when you execute:. Once you are done with the compilation option configuration, exit the program, and if you made some changes, you will be asked to save your new configuration. This saves the configuration options to the. For example, if the symbol is of type boolean and you chose it, in the. On the other hand, if you didn't choose the symbol, it won't be set in the.

Tristate symbols have the same behavior as bool types when chosen or not. But, remember that tristate also has the third option of compiling the feature as a module. For example, you can choose to compile the COIN driver as a module and have something like this in the. The following is a segment of the. Here you are telling kbuild that you want to compile the coin driver as a module and activate the flipping statistics. If you have chosen to compile the driver built-in and without the flipping statistics, you will have something like this:.

Once you have your. When you execute a compile target to compile the kernel or the modules, it first executes a binary that reads all the Kconfig files and. This binary updates or creates a C header file with the values you chose for all the configuration symbols. The file is composed of thousands of define macros that describe the state for each symbol. Let's look at the conventions for the macros.

Bool symbols with the value true and tristate symbols with the value yes are treated equally. For both of them, three macros are defined. In the same way, bool symbols with the value false and tristate symbols with the value no have the same semantics. For both of them, two macros are defined.

For tristate symbols with the value module, three macros are defined. The third and last step is to update the Makefiles for the subdirectories where you put your source files, so kbuild can compile your driver if you chose it. The kernel build system has two main tasks: creating the kernel binary image and the kernel modules. To do that, it maintains two lists of objects: obj-y and obj-m, respectively. The former is a list of all the objects that will be built in the kernel image, and the latter is the list of the objects that will be compiled as modules.

The configuration symbols from. Kbuild recursively enters each directory and builds the lists adding the objects defined in each subdirectory's Makefile. This tells kbuild to create an object from the source file coin. It then will be built in the kernel or as a module. Now you know how to include source files conditionally.

The last part of the puzzle is how to compile source code segments conditionally. This can be done easily by using the macros defined in autoconf. Listing 3 shows the complete coin character device driver. Figure 2 summarizes the kernel build process, and the output of the git diff --stat command shows the files you have modified to include the driver:.

Linux, despite being a monolithic kernel, is highly modular and customizable. You can use the same kernel in a varied range of devices from high-performance clusters to desktops all the way to mobile phones.

This makes the kernel a very big and complex piece of software. Legato will generate a default configuration if none is explicitly provided, and the default can be later customized. This file will be populated with appropriate default values for the target, and values taken from the environment if certain environment variables are set. These environment variables are supported for backwards compatibility, and the preferred method of configuration is through the menuconfig mechanism.

The following table lists these environment variables and the configuration values that they map to. If this is specified then the environment variables will be ignored and no default configuration will be generated. The provided file will be used as the source of all parameters. This will open a curses-based menu system to allow configuration editing.

See the KConfig Options page for the complete list of available parameters and their meanings. After running this, further make commands will cause the configuration to be regenerated from the environment and defaults. Once a target configuration file has been produced, either as the default generated during the build, or through the menuconfig process, it will be processed by current and future builds for that target.

When building, the configuration will be translated into the following three output files:. In general, one should not need to use these files directly. Rather, their contents are made available in the build or compilation environment automatically.



0コメント

  • 1000 / 1000