summaryrefslogtreecommitdiff
path: root/scripts/kconfig
diff options
context:
space:
mode:
authorSam Ravnborg <sam@ravnborg.org>2008-06-30 22:45:38 +0200
committerSam Ravnborg <sam@ravnborg.org>2008-07-25 22:12:49 +0200
commitf443d2eccf077afd8a839cc7ed66cc4d520c5f05 (patch)
treec4ccf7a29683dfc3c3f4e234549cb0a000f80e4d /scripts/kconfig
parentdc7862e5a65b9b9e0aad448398b4f652c49c9350 (diff)
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 <sam@ravnborg.org> Cc: Roman Zippel <zippel@linux-m68k.org>
Diffstat (limited to 'scripts/kconfig')
-rw-r--r--scripts/kconfig/conf.c154
1 files changed, 68 insertions, 86 deletions
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index fda63136ae68..bd2a27e1967a 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;
}