From 0b1c62934215a08351a80977c7cf8e9346683a1e Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 7 Sep 2017 14:40:28 +0200 Subject: build system: fix "allnoconfig" to clear all options. Closes 10296 Signed-off-by: Denys Vlasenko --- scripts/kconfig/conf.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index ea2446a89..e89637e7c 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -76,14 +76,51 @@ static void conf_askvalue(struct symbol *sym, const char *def) line[0] = '\n'; line[1] = 0; + line[2] = 0; if (!sym_is_changable(sym)) { printf("%s\n", def); - line[0] = '\n'; - line[1] = 0; return; } + // If autoconf run (allnoconfig and such), reset bool and tristates: + // "select ITEM" sets ITEM=y and then parent item might have been + // reset to "n" later. Try to set ITEM to "n" on the second run. + if (type == S_BOOLEAN || type == S_TRISTATE) { + switch (input_mode) { + case set_yes: + if (sym_tristate_within_range(sym, yes)) { + line[0] = 'y'; + line[1] = '\n'; + printf("%s", line); + return; + } + case set_mod: + if (type == S_TRISTATE) { + if (sym_tristate_within_range(sym, mod)) { + line[0] = 'm'; + line[1] = '\n'; + printf("%s", line); + return; + } + } else { + if (sym_tristate_within_range(sym, yes)) { + line[0] = 'y'; + line[1] = '\n'; + printf("%s", line); + return; + } + } + case set_no: + if (sym_tristate_within_range(sym, no)) { + line[0] = 'n'; + line[1] = '\n'; + printf("%s", line); + return; + } + } + } + switch (input_mode) { case set_no: case set_mod: @@ -590,6 +627,19 @@ int main(int ac, char **av) if (input_mode != ask_silent) { rootEntry = &rootmenu; conf(&rootmenu); + // If autoconf run (allnoconfig and such), run it twice: + // "select ITEM" sets ITEM=y and then parent item + // is reset to "n" later. Second run sets ITEM to "n". + // Example: ADDUSER selects LONG_OPTS. + // allnoconfig must set _both_ to "n". + // Before, LONG_OPTS remained "y". + if (input_mode == set_no + || input_mode == set_mod + || input_mode == set_yes + ) { + rootEntry = &rootmenu; + conf(&rootmenu); + } if (input_mode == ask_all) { input_mode = ask_silent; valid_stdin = 1; -- cgit v1.2.3