Kconfig User Guide
[ English | 简体中文 ]
I. Overview
Kconfig provides a mechanism for project configuration at compile time, supporting various types of configuration options, such as integers, strings, and booleans. Through the Kconfig files, developers can define the dependencies between options, configure default values, and define their combination rules.For detailed information about the Kconfig language, refer to the Kconfig documentation.
Similar to most large operating systems, openvela utilizes Kconfig to manage project configurations. Developers can perform configuration tasks through the visual interface provided by menuconfig, enabling the efficient building and tailoring of the openvela system.
II. Usage Examples
To modify configuration parameters during project setup, perform the following verification and configuration procedure:
-
Review the configuration item status.
You can examine the
.configfile to determine whether the configuration has been set and if its value meets the expected criteria. If it does, you may use it as is; otherwise, it is recommended to adjust the setting using themenuconfigtool.Note: Using the
menuconfigtool ensures that all configuration dependencies are complete and correct. -
Example: Configuring the KVDB storage path.
Take the database storage path configuration for
KVDB,CONFIG_KVDB_PERSIST_PATH, as an example:-
By default, configuration options use their default values and will not appear in the
defconfigfile. -
"In the
.configfile you can observe that its default value is set to"/data/persist.db". If a different value is desired, you may locate and adjust the corresponding configuration option throughmenuconfig."
-
-
Example: Enable the
FTL_WRITEBUFFERconfiguration. If you need to enable theFTL_WRITEBUFFERconfiguration, follow these steps:-
Verify the configuration's presence in
.config. If absent, enable viamenuconfiginstead of forcibly addingCONFIG_FTL_WRITEBUFFER=ytodefconfig
-
CONFIG_FTL_WRITEBUFFERdepends onCONFIG_DRVR_WRITEBUFFER. IfCONFIG_DRVR_WRITEBUFFERis not enabled simultaneously, manually modifying thedefconfigfile will not take effect. -
The
menuconfiginterface automatically resolves dependency chains and persists validated changes todefconfig:CONFIG_FTL_WRITEBUFFER=y CONFIG_DRVR_WRITEBUFFER=y
-
III. Purpose of Each File
During the initial build, openvela locates the corresponding project's defconfig by using the specified arch and board parameters, which serves as the system's initial configuration. Based on this file, openvela expands and combines configurations to ultimately generate a complete .config file. The generated .config file is then copied to config.h to facilitate conditional compilation in the code and support runtime usage.
1. Detailed Description of Each File
-
defconfig- The minimal set of system configurations defines the default basic configuration options. The system generates the complete
.configconfiguration file based on this file and the dependencies among configuration options. - All configuration options in the
defconfigfile are arranged in alphabetical order. It is recommended to add or remove configuration options using themenuconfigtool. Direct modifications to thedefconfigfile may result in redundant configurations or ordering inconsistencies.
- The minimal set of system configurations defines the default basic configuration options. The system generates the complete
-
.config- The
.configfile is the complete configuration generated from thedefconfigfile, incorporating all extended and combined configuration options. - The
menuconfiginterface reads the local.configfile for user-customized configuration adjustments and automatically propagates validated changes back to thedefconfigfile upon completion.
- The
-
config.h- The
config.hfile is generated from the.configfile, containing all configuration information to support conditional compilation and runtime operations in the code.
- The
2. Build Process Example
The following diagram illustrates a typical build configuration workflow:
Execute build commands:
./build.sh vendor/sim/boards/vela/config/vela menuconfig
./build.sh vendor/sim/boards/vela/config/vela -j8
3. File Path Examples
Based on the openvela simulator environment, the typical file paths are as follows:
defconfigfile path:vendor/sim/boards/vela/configs/vela/defconfig.configfile path:nuttx/.configconfig.hfile path:nuttx/include/config.h
IV. Usage Instructions
The following diagram illustrates a typical build configuration workflow:
-
Disable a feature in Kconfig configuration.
Before disabling a Kconfig configuration option, make sure it is not selected by any other configuration options via the
selectkeyword. If there are dependencies, those dependencies must be resolved first. -
Open the visual configuration interface.
Use the
menuconfigcommand to open the visual configuration interface, for example:./build.sh vendor/sim/boards/openvela/configs/openvela menuconfig
-
Use the
menuconfigcommand to open the visual configuration interface, for example:In the
menuconfiginterface, you can enter/followed by a configuration keyword to search. For example, to search forEXAMPLES_HELLO:Note: If the search results contain
depends ondependencies, type?to continue searching for dependent configurations and enable them.
-
Select and navigate configuration options.
Use the arrow keys to navigate up and down, and press Enter to select the corresponding option.

-
View configuration details.
After selecting a configuration item, press
Shift+?to display its detailed documentation and file location information.
-
Select specific options
Follow configuration prompts, such as the option number in brackets (e.g., '1'), to navigate to sub-option interfaces.

-
Modify configuration values
Within the selected configuration option, you can input values based on the configuration type.
-
int: A specific integer value must be entered.
-
bool: Toggle the state by pressing
y(enable) or the space key.
-
String type: Enter the string directly as the configuration value.
-
-
Save changes or exit
- Press the
ESCkey to exit the configuration interface and pressywhen prompted to save changes. - To force exit, use
Ctrl+C, but this may result in loss of unsaved changes.
- Press the
V. Related Documents
The following links provide additional details about using Kconfig: