From 3b692df8996f5ce55037f5340a6e92db8ad4df67 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Mon, 1 Oct 2018 03:52:32 +0200 Subject: olddefconfig: Add script Works like 'make olddefconfig', updating a configuration by filling in default values for all new symbols. This could also be accomplished by entering the 'menuconfig' interface and saving the configuration, but it's more awkward and less obvious. Piggyback two oldconfig changes: - Mention KCONFIG_CONFIG - Check if the .config file exists before parsing the Kconfig files, instead of after --- olddefconfig.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 olddefconfig.py (limited to 'olddefconfig.py') diff --git a/olddefconfig.py b/olddefconfig.py new file mode 100755 index 0000000..5245735 --- /dev/null +++ b/olddefconfig.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +# Copyright (c) 2018, Ulf Magnusson +# SPDX-License-Identifier: ISC + +# Works like 'make olddefconfig', updating an old .config file by filing in +# default values for all new symbols. This is the same as picking the default +# selection for all symbols in oldconfig, or entering the menuconfig interface +# and immediately saving. +# +# The default output filename is '.config'. A different filename can be passed +# in the KCONFIG_CONFIG environment variable. + +import os +import sys + +import kconfiglib + + +def main(): + config_filename = kconfiglib.standard_config_filename() + if not os.path.exists(config_filename): + sys.exit("{}: '{}' not found".format(sys.argv[0], config_filename)) + + kconf = kconfiglib.standard_kconfig() + kconf.load_config(config_filename) + kconf.write_config(config_filename) + print("Updated configuration written to '{}'".format(config_filename)) + + +if __name__ == "__main__": + main() -- cgit v1.2.3