diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-05-27 20:41:59 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-05-27 20:42:35 +0200 |
| commit | 3e0930ca57cc6a57abf286404438be0a1d505c66 (patch) | |
| tree | 78514859761f65fffe0559926b45267576c44112 /allnoconfig.py | |
| parent | 4c4f184a3a648b8cb748ab35159a09ccd06b2ff7 (diff) | |
Actually commit new allnoconfig.py
Oops.
Diffstat (limited to 'allnoconfig.py')
| -rwxr-xr-x | allnoconfig.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/allnoconfig.py b/allnoconfig.py new file mode 100755 index 0000000..240fffb --- /dev/null +++ b/allnoconfig.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python + +# Works like 'make allnoconfig'. Verified by the test suite to generate +# identical output to 'make allnoconfig' for all ARCHes. +# +# See the examples/allnoconfig_walk.py example script for another variant. +# +# Usage for the Linux kernel: +# +# $ make [ARCH=<arch>] scriptconfig SCRIPT=Kconfiglib/allnoconfig.py + +import os +import sys + +import kconfiglib + +def main(): + if len(sys.argv) > 2: + sys.exit("usage: {} [Kconfig]".format(sys.argv[0])) + + kconf = kconfiglib.Kconfig("Kconfig" if len(sys.argv) < 2 else sys.argv[1]) + + # Avoid warnings printed by Kconfiglib when assigning a value to a symbol that + # has no prompt. Such assignments never have an effect. + kconf.disable_warnings() + + # Small optimization + BOOL_TRI = (kconfiglib.BOOL, kconfiglib.TRISTATE) + + for sym in kconf.defined_syms: + if sym.orig_type in BOOL_TRI: + sym.set_value(2 if sym.is_allnoconfig_y else 0) + + config_filename = os.environ.get("KCONFIG_CONFIG") + if config_filename is None: + config_filename = ".config" + + kconf.write_config(config_filename) + +if __name__ == "__main__": + main() |
