History

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.

Sam Ravnborg committed 18 years ago

Commit f443d2e1 parent dc7862e1 file · +68 −86Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/kconfig/conf.c+68−86
@@ -76,7 +76,6 @@ static void check_stdin(void) · 75 unmodified lines
7676 static int conf_askvalue(struct symbol *sym, const char *def)
7777 {
7878 enum symbol_type type = sym_get_type(sym);
79− tristate val;
8079
8180 if (!sym_has_value(sym))
8281 printf(_("(NEW) "));
@@ -92,15 +91,6 @@ static int conf_askvalue(struct symbol *sym, const char *def) · 9 unmodified lines
9291 }
9392
9493 switch (input_mode) {
95− case set_no:
96− case set_mod:
97− case set_yes:
98− case set_random:
99− if (sym_has_value(sym)) {
100− printf("%s\n", def);
101− return 0;
102− }
103− break;
10494 case ask_new:
10595 case ask_silent:
10696 if (sym_has_value(sym)) {
@@ -128,52 +118,6 @@ static int conf_askvalue(struct symbol *sym, const char *def) · 21 unmodified lines
128118 default:
129119 ;
130120 }
131− switch (input_mode) {
132− case set_yes:
133− if (sym_tristate_within_range(sym, yes)) {
134− line[0] = 'y';
135− line[1] = '\n';
136− line[2] = 0;
137− break;
138− }
139− case set_mod:
140− if (type == S_TRISTATE) {
141− if (sym_tristate_within_range(sym, mod)) {
142− line[0] = 'm';
143− line[1] = '\n';
144− line[2] = 0;
145− break;
146− }
147− } else {
148− if (sym_tristate_within_range(sym, yes)) {
149− line[0] = 'y';
150− line[1] = '\n';
151− line[2] = 0;
152− break;
153− }
154− }
155− case set_no:
156− if (sym_tristate_within_range(sym, no)) {
157− line[0] = 'n';
158− line[1] = '\n';
159− line[2] = 0;
160− break;
161− }
162− case set_random:
163− do {
164− val = (tristate)(rand() % 3);
165− } while (!sym_tristate_within_range(sym, val));
166− switch (val) {
167− case no: line[0] = 'n'; break;
168− case mod: line[0] = 'm'; break;
169− case yes: line[0] = 'y'; break;
170− }
171− line[1] = '\n';
172− line[2] = 0;
173− break;
174− default:
175− break;
176− }
177121 printf("%s", line);
178122 return 1;
179123 }
@@ -374,16 +318,12 @@ static int conf_choice(struct menu *menu) · 194 unmodified lines
374318 else
375319 continue;
376320 break;
377− case set_random:
378− if (is_new)
379− def = (rand() % cnt) + 1;
380321 case set_default:
381− case set_yes:
382− case set_mod:
383− case set_no:
384322 cnt = def;
385323 printf("%d\n", cnt);
386324 break;
325+ default:
326+ break;
387327 }
388328
389329 conf_childs:
@@ -494,6 +434,43 @@ static void check_conf(struct menu *menu) · 104 unmodified lines
494434 check_conf(child);
495435 }
496436
437+static void conf_do_update(void)
438+{
439+ /* Update until a loop caused no more changes */
440+ do {
441+ conf_cnt = 0;
442+ check_conf(&rootmenu);
443+ } while (conf_cnt);
444+}
445+
446+static int conf_silent_update(void)
447+{
448+ const char *name;
449+
450+ if (conf_get_changed()) {
451+ name = getenv("KCONFIG_NOSILENTUPDATE");
452+ if (name && *name) {
453+ fprintf(stderr,
454+ _("\n*** Kernel configuration requires explicit update.\n\n"));
455+ return 1;
456+ }
457+ conf_do_update();
458+ }
459+ return 0;
460+}
461+
462+static int conf_update(void)
463+{
464+ rootEntry = &rootmenu;
465+ conf(&rootmenu);
466+ if (input_mode == ask_all) {
467+ input_mode = ask_silent;
468+ valid_stdin = 1;
469+ }
470+ conf_do_update();
471+ return 0;
472+}
473+
497474 int main(int ac, char **av)
498475 {
499476 int opt;
@@ -599,36 +576,41 @@ int main(int ac, char **av) · 99 unmodified lines
599576 default:
600577 break;
601578 }
579+ switch (input_mode) {
580+ case set_no:
581+ conf_set_all_new_symbols(def_no);
582+ break;
583+ case set_yes:
584+ conf_set_all_new_symbols(def_yes);
585+ break;
586+ case set_mod:
587+ conf_set_all_new_symbols(def_mod);
588+ break;
589+ case set_random:
590+ conf_set_all_new_symbols(def_random);
591+ break;
592+ case ask_silent:
593+ if (conf_silent_update())
594+ exit(1);
595+ break;
596+ case ask_new:
597+ case ask_all:
598+ case set_default:
599+ if (conf_update())
600+ exit(1);
601+ break;
602+ }
602603
603− if (input_mode != ask_silent) {
604− rootEntry = &rootmenu;
605− conf(&rootmenu);
606− if (input_mode == ask_all) {
607− input_mode = ask_silent;
608− valid_stdin = 1;
609− }
610− } else if (conf_get_changed()) {
611− name = getenv("KCONFIG_NOSILENTUPDATE");
612− if (name && *name) {
613− fprintf(stderr, _("\n*** Kernel configuration requires explicit update.\n\n"));
614− return 1;
615− }
616− } else
617− goto skip_check;
618−
619− do {
620− conf_cnt = 0;
621− check_conf(&rootmenu);
622− } while (conf_cnt);
623− if (conf_write(NULL)) {
604+ if (conf_get_changed() && conf_write(NULL)) {
624605 fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
625− return 1;
606+ exit(1);
626607 }
627−skip_check:
608+ /* ask_silent is used during the build so we shall update autoconf.
609+ * All other commands are only used to generate a config.
610+ */
628611 if (input_mode == ask_silent && conf_write_autoconf()) {
629612 fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
630613 return 1;
631614 }
632−
633615 return 0;
634616 }