From f443d2eccf077afd8a839cc7ed66cc4d520c5f05 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Mon, 30 Jun 2008 22:45:38 +0200 Subject: kconfig: speed up all*config + randconfig Drop the chatty mode when we generate the all*config, randconfig configurations. Ths speeds up the process considerably and noone looked at the output anyway. This patch uses the conf_set_all_new_symbols() function just added to kconfig. Signed-off-by: Sam Ravnborg Cc: Roman Zippel --- scripts/kconfig/conf.c | 154 ++++++++++++++++++++++--------------------------- 1 file changed, 68 insertions(+), 86 deletions(-) (limited to 'scripts/kconfig/conf.c') diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index fda63136ae6..bd2a27e1967 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -76,7 +76,6 @@ static void check_stdin(void) static int conf_askvalue(struct symbol *sym, const char *def) { enum symbol_type type = sym_get_type(sym); - tristate val; if (!sym_has_value(sym)) printf(_("(NEW) ")); @@ -92,15 +91,6 @@ static int conf_askvalue(struct symbol *sym, const char *def) } switch (input_mode) { - case set_no: - case set_mod: - case set_yes: - case set_random: - if (sym_has_value(sym)) { - printf("%s\n", def); - return 0; - } - break; case ask_new: case ask_silent: if (sym_has_value(sym)) { @@ -128,52 +118,6 @@ static int conf_askvalue(struct symbol *sym, const char *def) default: ; } - switch (input_mode) { - case set_yes: - if (sym_tristate_within_range(sym, yes)) { - line[0] = 'y'; - line[1] = '\n'; - line[2] = 0; - break; - } - case set_mod: - if (type == S_TRISTATE) { - if (sym_tristate_within_range(sym, mod)) { - line[0] = 'm'; - line[1] = '\n'; - line[2] = 0; - break; - } - } else { - if (sym_tristate_within_range(sym, yes)) { - line[0] = 'y'; - line[1] = '\n'; - line[2] = 0; - break; - } - } - case set_no: - if (sym_tristate_within_range(sym, no)) { - line[0] = 'n'; - line[1] = '\n'; - line[2] = 0; - break; - } - case set_random: - do { - val = (tristate)(rand() % 3); - } while (!sym_tristate_within_range(sym, val)); - switch (val) { - case no: line[0] = 'n'; break; - case mod: line[0] = 'm'; break; - case yes: line[0] = 'y'; break; - } - line[1] = '\n'; - line[2] = 0; - break; - default: - break; - } printf("%s", line); return 1; } @@ -374,16 +318,12 @@ static int conf_choice(struct menu *menu) else continue; break; - case set_random: - if (is_new) - def = (rand() % cnt) + 1; case set_default: - case set_yes: - case set_mod: - case set_no: cnt = def; printf("%d\n", cnt); break; + default: + break; } conf_childs: @@ -494,6 +434,43 @@ static void check_conf(struct menu *menu) check_conf(child); } +static void conf_do_update(void) +{ + /* Update until a loop caused no more changes */ + do { + conf_cnt = 0; + check_conf(&rootmenu); + } while (conf_cnt); +} + +static int conf_silent_update(void) +{ + const char *name; + + if (conf_get_changed()) { + name = getenv("KCONFIG_NOSILENTUPDATE"); + if (name && *name) { + fprintf(stderr, + _("\n*** Kernel configuration requires explicit update.\n\n")); + return 1; + } + conf_do_update(); + } + return 0; +} + +static int conf_update(void) +{ + rootEntry = &rootmenu; + conf(&rootmenu); + if (input_mode == ask_all) { + input_mode = ask_silent; + valid_stdin = 1; + } + conf_do_update(); + return 0; +} + int main(int ac, char **av) { int opt; @@ -599,36 +576,41 @@ int main(int ac, char **av) default: break; } + switch (input_mode) { + case set_no: + conf_set_all_new_symbols(def_no); + break; + case set_yes: + conf_set_all_new_symbols(def_yes); + break; + case set_mod: + conf_set_all_new_symbols(def_mod); + break; + case set_random: + conf_set_all_new_symbols(def_random); + break; + case ask_silent: + if (conf_silent_update()) + exit(1); + break; + case ask_new: + case ask_all: + case set_default: + if (conf_update()) + exit(1); + break; + } - if (input_mode != ask_silent) { - rootEntry = &rootmenu; - conf(&rootmenu); - if (input_mode == ask_all) { - input_mode = ask_silent; - valid_stdin = 1; - } - } else if (conf_get_changed()) { - name = getenv("KCONFIG_NOSILENTUPDATE"); - if (name && *name) { - fprintf(stderr, _("\n*** Kernel configuration requires explicit update.\n\n")); - return 1; - } - } else - goto skip_check; - - do { - conf_cnt = 0; - check_conf(&rootmenu); - } while (conf_cnt); - if (conf_write(NULL)) { + if (conf_get_changed() && conf_write(NULL)) { fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); - return 1; + exit(1); } -skip_check: + /* ask_silent is used during the build so we shall update autoconf. + * All other commands are only used to generate a config. + */ if (input_mode == ask_silent && conf_write_autoconf()) { fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); return 1; } - return 0; } -- cgit v1.2.3 From cd9140e1e73a31fd45f1fd4585260643a2f9ab1d Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Mon, 30 Jun 2008 22:53:04 +0200 Subject: kconfig: make oldconfig is now less chatty Previously when running "make oldconfig" we saw all the propmt lines from kconfig and noone actully read this. With this patch the user will only see output if there is new symbols. This will be seen as "make oldconfig" runs which does not generate any output. A typical run now looks like this: $ make oldconfig scripts/kconfig/conf -o arch/x86/Kconfig $ If a new symbol is found then we restart the config process like this: $ make oldconfig scripts/kconfig/conf -o arch/x86/Kconfig * * Restart config... * * * General setup * Prompt for development and/or incomplete code/drivers (EXPERIMENTAL) [Y/n/?] y Local version - append to kernel release (LOCALVERSION) [] ... The bahaviour is similar to what we know when running the implicit oldconfig target "make silentoldconfig". "make silentoldconfig" are run as part of the kernel build process if the configuration has changed. Signed-off-by: Sam Ravnborg Cc: Roman Zippel --- scripts/kconfig/conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/kconfig/conf.c') diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index bd2a27e1967..6cdaa0cc572 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -590,10 +590,10 @@ int main(int ac, char **av) conf_set_all_new_symbols(def_random); break; case ask_silent: + case ask_new: if (conf_silent_update()) exit(1); break; - case ask_new: case ask_all: case set_default: if (conf_update()) -- cgit v1.2.3 From 09748e178b6cb8d3b8a748d0159aa7ad8eadcbe1 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Mon, 30 Jun 2008 23:02:59 +0200 Subject: kconfig: make defconfig is no longer chatty make defconfig generated a lot of output then noone actually read. Use conf_set_all_new_symbols() to generate the default configuration and avoid the chatty output. A typical run now looks like this: $ make defconfig *** Default configuration is based on 'i386_defconfig' arch/x86/configs/i386_defconfig:13:warning: trying to assign nonexistent symbol SEMAPHORE_SLEEPERS arch/x86/configs/i386_defconfig:176:warning: trying to assign nonexistent symbol PREEMPT_BKL ... arch/x86/configs/i386_defconfig:1386:warning: trying to assign nonexistent symbol INSTRUMENTATION $ As an added benefit we now clearly see the warnings generated in the start of the process. Signed-off-by: Sam Ravnborg Cc: Roman Zippel --- scripts/kconfig/conf.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'scripts/kconfig/conf.c') diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 6cdaa0cc572..9fba838c706 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -102,9 +102,6 @@ static int conf_askvalue(struct symbol *sym, const char *def) fflush(stdout); fgets(line, 128, stdin); return 1; - case set_default: - printf("%s\n", def); - return 1; default: break; } @@ -318,10 +315,6 @@ static int conf_choice(struct menu *menu) else continue; break; - case set_default: - cnt = def; - printf("%d\n", cnt); - break; default: break; } @@ -589,13 +582,15 @@ int main(int ac, char **av) case set_random: conf_set_all_new_symbols(def_random); break; + case set_default: + conf_set_all_new_symbols(def_default); + break; case ask_silent: case ask_new: if (conf_silent_update()) exit(1); break; case ask_all: - case set_default: if (conf_update()) exit(1); break; -- cgit v1.2.3