Exemplo n.º 1
0
def main():
    kconf = kconfiglib.standard_kconfig()

    # See allnoconfig.py
    kconf.disable_warnings()

    # Small optimizations
    BOOL = kconfiglib.BOOL
    TRISTATE = kconfiglib.TRISTATE

    for sym in kconf.unique_defined_syms:
        if sym.orig_type == BOOL:
            # 'bool' choice symbols get their default value, as determined by
            # e.g. 'default's on the choice
            if not sym.choice:
                # All other bool symbols get set to 'y', like for allyesconfig
                sym.set_value(2)
        elif sym.orig_type == TRISTATE:
            sym.set_value(1)

    for choice in kconf.unique_choices:
        choice.set_value(2 if choice.orig_type == BOOL else 1)

    kconf.enable_warnings()

    kconfiglib.load_allconfig(kconf, "allmod.config")

    kconf.write_config(kconfiglib.standard_config_filename())
Exemplo n.º 2
0
def _main():
    # Earlier symbols in Kconfig files might depend on later symbols and become
    # visible if their values change. This flag is set to True if the value of
    # any symbol changes, in which case we rerun the oldconfig to check for new
    # visible symbols.
    global conf_changed

    kconf = standard_kconfig()

    config_filename = standard_config_filename()
    if not os.path.exists(config_filename):
        sys.exit("{}: '{}' not found".format(sys.argv[0], config_filename))

    kconf.load_config(config_filename)

    while True:
        conf_changed = False

        for node in kconf.node_iter():
            oldconfig(node)

        if not conf_changed:
            break

    kconf.write_config(config_filename)

    print("Updated configuration written to '{}'".format(config_filename))
Exemplo n.º 3
0
def main():
    kconf = kconfiglib.standard_kconfig()

    # See allnoconfig.py
    kconf.disable_warnings()

    # Try to set all symbols to 'y'. Dependencies might truncate the value down
    # later, but this will at least give the highest possible value.
    #
    # Assigning 0/1/2 to non-bool/tristate symbols has no effect (int/hex
    # symbols still take a string, because they preserve formatting).
    for sym in kconf.unique_defined_syms:
        # Set choice symbols to 'm'. This value will be ignored for choices in
        # 'y' mode (the "normal" mode), which will instead just get their
        # default selection, but will set all symbols in m-mode choices to 'm',
        # which is as high as they can go.
        sym.set_value(1 if sym.choice else 2)

    # Set all choices to the highest possible mode
    for choice in kconf.unique_choices:
        choice.set_value(2)

    kconf.enable_warnings()

    kconfiglib.load_allconfig(kconf, "allyes.config")

    kconf.write_config(kconfiglib.standard_config_filename())
Exemplo n.º 4
0
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))
Exemplo n.º 5
0
def main():
    kconf = standard_kconfig()

    config_filename = standard_config_filename()
    if not os.path.exists(config_filename):
        sys.exit("{}: '{}' does not exist".format(sys.argv[0],
                                                  config_filename))

    kconf.load_config(config_filename)
    do_oldconfig(kconf)
    kconf.write_config(config_filename)

    print("Configuration saved to '{}'".format(config_filename))
Exemplo n.º 6
0
def main():
    parser = argparse.ArgumentParser(description=DESCRIPTION)

    parser.add_argument(
        "--header-path",
        metavar="HEADER_FILE",
        default=DEFAULT_HEADER_PATH,
        help="Path for the generated header file (default: {})".format(
            DEFAULT_HEADER_PATH))

    parser.add_argument(
        "--sync-deps",
        dest="sync_deps_path",
        metavar="OUTPUT_DIR",
        nargs="?",
        const=DEFAULT_SYNC_DEPS_PATH,
        help="Enable generation of build dependency information for "
        "incremental builds, optionally specifying the output path "
        "(default: {})".format(DEFAULT_SYNC_DEPS_PATH))

    parser.add_argument(
        "--config-out",
        dest="config_path",
        metavar="CONFIG_FILE",
        help="Write the configuration to the specified filename. "
        "This is useful if you include .config files in Makefiles, as "
        "the generated configuration file will be a full .config file "
        "even if .config is outdated. The generated configuration "
        "matches what olddefconfig would produce. If you use "
        "--sync-deps, you can include deps/auto.conf instead. "
        "--config-out is meant for cases where incremental build "
        "information isn't needed.")

    parser.add_argument("kconfig_filename",
                        metavar="KCONFIG_FILENAME",
                        nargs="?",
                        default="Kconfig",
                        help="Top-level Kconfig file (default: Kconfig)")

    args = parser.parse_args()

    kconf = kconfiglib.Kconfig(args.kconfig_filename)
    kconf.load_config(kconfiglib.standard_config_filename())

    kconf.write_autoconf(args.header_path)

    if args.sync_deps_path is not None:
        kconf.sync_deps(args.sync_deps_path)

    if args.config_path is not None:
        kconf.write_config(args.config_path)
Exemplo n.º 7
0
def main():
    kconf = kconfiglib.standard_kconfig()

    # Avoid warnings that would otherwise get printed by Kconfiglib for the
    # following:
    #
    # 1. Assigning a value to a symbol without a prompt, which never has any
    #    effect
    #
    # 2. Assigning values invalid for the type (only bool/tristate symbols
    #    accept 0/1/2, for n/m/y). The assignments will be ignored for other
    #    symbol types, which is what we want.
    kconf.disable_warnings()

    for sym in kconf.unique_defined_syms:
        sym.set_value(2 if sym.is_allnoconfig_y else 0)

    kconf.write_config(kconfiglib.standard_config_filename())
Exemplo n.º 8
0
def main():
    parser = argparse.ArgumentParser(description=DESCRIPTION)

    parser.add_argument(
        "--header-path",
        metavar="HEADER_FILE",
        default=DEFAULT_HEADER_PATH,
        help="path for the generated header file (default: {})".format(
            DEFAULT_HEADER_PATH))

    parser.add_argument(
        "--sync-deps",
        dest="sync_deps_path",
        metavar="OUTPUT_DIR",
        nargs="?",
        default=None,
        const=DEFAULT_SYNC_DEPS_PATH,
        help="enable generation of build dependency information for "
        "incremental builds, optionally specifying the output path "
        "(default: {})".format(DEFAULT_SYNC_DEPS_PATH))

    parser.add_argument("kconfig_filename",
                        metavar="KCONFIG_FILENAME",
                        nargs="?",
                        default="Kconfig",
                        help="top-level Kconfig file (default: Kconfig)")

    args = parser.parse_args()

    kconf = kconfiglib.Kconfig(args.kconfig_filename)

    kconf.load_config(kconfiglib.standard_config_filename())

    kconf.write_autoconf(args.header_path)
    if args.sync_deps_path is not None:
        kconf.sync_deps(args.sync_deps_path)
Exemplo n.º 9
0
def main():
    kconfiglib.standard_kconfig().write_config(
        kconfiglib.standard_config_filename())
Exemplo n.º 10
0
def main():
    kconf = kconfiglib.standard_kconfig()
    kconfiglib.load_allconfig(kconf, "alldef.config")
    kconf.write_config(kconfiglib.standard_config_filename())