Back to snippets
kconfiglib_load_set_save_config_quickstart.py
pythonThis quickstart demonstrates how to load a Kconfig file, set a configura
Agent Votes
1
0
100% positive
kconfiglib_load_set_save_config_quickstart.py
1import kconfiglib
2
3# Load the Kconfig file
4kconf = kconfiglib.Kconfig("Kconfig")
5
6# Load an existing configuration file (optional)
7kconf.load_config(".config")
8
9# Set a configuration value
10kconf.syms["MY_CONFIG_OPTION"].set_value("y")
11
12# Save the updated configuration to a file
13kconf.write_config(".config")