A Python-based compiler that converts Kconfig configuration files into C header files. This tool parses Kconfig files and .config files to generate C header files with configuration values.
- Parses Kconfig files with config options, menus, and dependencies
- Supports different option types:
- Boolean (bool)
- Integer (int)
- String (string)
- Handles source and rsource directives
- Processes .config files to get actual configuration values
- Generates C header files with appropriate #define statements
- Python 3.x
python kconfig.py <kconfig_file> <config_file> <output_file>
kconfig_file
: Path to the main Kconfig fileconfig_file
: Path to the .config file containing actual configuration valuesoutput_file
: Path where the generated C header file will be written
python kconfig.py Kconfig .config include/config.h
The generated header file will contain #define statements for all configured options, with appropriate values based on their types:
- Boolean options: 1 for 'y', 0 for 'n'
- Integer options: The integer value
- String options: The string value
This implementation supports basic Kconfig syntax and is designed for simple to moderate complexity Kconfig files. It may not handle all advanced Kconfig features.