aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAristeu Rozanski <aris@redhat.com>2010-05-06 12:48:34 -0400
committerMichal Marek <mmarek@suse.cz>2010-06-02 08:40:09 -0400
commitf0778c8c41001783d4074e34efc7d3e632d87ee3 (patch)
tree8ab973e63d7ff30e1271b8954c8b6ec3cc7ea5ba /scripts
parent64ffc9ff424c65adcffe7d590018cc75e2d5d42a (diff)
kconfig: introduce nonint_oldconfig and loose_nonint_oldconfig
This patch has been around for a long time in Fedora and Red Hat Enterprise Linux kernels and it may be useful for others. The nonint_oldconfig target will fail and print the unset config options while loose_nonint_oldconfig will simply let the config option unset. They're useful in distro kernel packages where the config files are built using a combination of smaller config files. Arjan van de Ven wrote the initial nonint_config and Roland McGrath added the loose_nonint_oldconfig. Signed-off-by: Arjan van de Ven <arjan@redhat.com> [defunct email] Whatevered-by: Kyle McMartin <kyle@redhat.com> Acked-by: Arjan van de Ven <arjan@linux.intel.com> Acked-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Aristeu Rozanski <aris@redhat.com> [mmarek: whitespace fixes] Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/Makefile10
-rw-r--r--scripts/kconfig/conf.c53
2 files changed, 54 insertions, 9 deletions
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 75bdf5ae202c..f8d1ee3a372e 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -62,6 +62,12 @@ localyesconfig: $(obj)/streamline_config.pl $(obj)/conf
62 fi 62 fi
63 $(Q)rm -f .tmp.config 63 $(Q)rm -f .tmp.config
64 64
65nonint_oldconfig: $(obj)/conf
66 $< -b $(Kconfig)
67
68loose_nonint_oldconfig: $(obj)/conf
69 $< -B $(Kconfig)
70
65# Create new linux.pot file 71# Create new linux.pot file
66# Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files 72# Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
67# The symlink is used to repair a deficiency in arch/um 73# The symlink is used to repair a deficiency in arch/um
@@ -126,6 +132,10 @@ help:
126 @echo ' allmodconfig - New config selecting modules when possible' 132 @echo ' allmodconfig - New config selecting modules when possible'
127 @echo ' allyesconfig - New config where all options are accepted with yes' 133 @echo ' allyesconfig - New config where all options are accepted with yes'
128 @echo ' allnoconfig - New config where all options are answered with no' 134 @echo ' allnoconfig - New config where all options are answered with no'
135 @echo ' nonint_oldconfig - Checks the current configuration and fails if an option is '
136 @echo ' not set'
137 @echo ' loose_nonint_oldconfig - Same as nonint_oldconfig, but updates the config file with '
138 @echo ' missing config options as unset'
129 139
130# lxdialog stuff 140# lxdialog stuff
131check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh 141check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 9960d1c303f8..3fa4abf3b084 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -16,6 +16,10 @@
16#define LKC_DIRECT_LINK 16#define LKC_DIRECT_LINK
17#include "lkc.h" 17#include "lkc.h"
18 18
19/* Return codes */
20#define EUNSETOPT 2 /* if -B and -b are used and unset config
21 * options were found */
22
19static void conf(struct menu *menu); 23static void conf(struct menu *menu);
20static void check_conf(struct menu *menu); 24static void check_conf(struct menu *menu);
21 25
@@ -23,6 +27,8 @@ enum {
23 ask_all, 27 ask_all,
24 ask_new, 28 ask_new,
25 ask_silent, 29 ask_silent,
30 dont_ask,
31 dont_ask_dont_tell,
26 set_default, 32 set_default,
27 set_yes, 33 set_yes,
28 set_mod, 34 set_mod,
@@ -37,6 +43,7 @@ static int sync_kconfig;
37static int conf_cnt; 43static int conf_cnt;
38static char line[128]; 44static char line[128];
39static struct menu *rootEntry; 45static struct menu *rootEntry;
46static int unset_variables;
40 47
41static void print_help(struct menu *menu) 48static void print_help(struct menu *menu)
42{ 49{
@@ -360,7 +367,10 @@ static void conf(struct menu *menu)
360 367
361 switch (prop->type) { 368 switch (prop->type) {
362 case P_MENU: 369 case P_MENU:
363 if (input_mode == ask_silent && rootEntry != menu) { 370 if ((input_mode == ask_silent ||
371 input_mode == dont_ask ||
372 input_mode == dont_ask_dont_tell) &&
373 rootEntry != menu) {
364 check_conf(menu); 374 check_conf(menu);
365 return; 375 return;
366 } 376 }
@@ -418,10 +428,23 @@ static void check_conf(struct menu *menu)
418 if (sym && !sym_has_value(sym)) { 428 if (sym && !sym_has_value(sym)) {
419 if (sym_is_changable(sym) || 429 if (sym_is_changable(sym) ||
420 (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) { 430 (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) {
421 if (!conf_cnt++) 431 if (input_mode == dont_ask ||
422 printf(_("*\n* Restart config...\n*\n")); 432 input_mode == dont_ask_dont_tell) {
423 rootEntry = menu_get_parent_menu(menu); 433 if (input_mode == dont_ask &&
424 conf(rootEntry); 434 sym->name && !sym_is_choice_value(sym)) {
435 if (!unset_variables)
436 fprintf(stderr, "The following"
437 " variables are not set:\n");
438 fprintf(stderr, "CONFIG_%s\n",
439 sym->name);
440 unset_variables++;
441 }
442 } else {
443 if (!conf_cnt++)
444 printf(_("*\n* Restart config...\n*\n"));
445 rootEntry = menu_get_parent_menu(menu);
446 conf(rootEntry);
447 }
425 } 448 }
426 } 449 }
427 450
@@ -439,7 +462,7 @@ int main(int ac, char **av)
439 bindtextdomain(PACKAGE, LOCALEDIR); 462 bindtextdomain(PACKAGE, LOCALEDIR);
440 textdomain(PACKAGE); 463 textdomain(PACKAGE);
441 464
442 while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) { 465 while ((opt = getopt(ac, av, "osbBdD:nmyrh")) != -1) {
443 switch (opt) { 466 switch (opt) {
444 case 'o': 467 case 'o':
445 input_mode = ask_silent; 468 input_mode = ask_silent;
@@ -448,6 +471,12 @@ int main(int ac, char **av)
448 input_mode = ask_silent; 471 input_mode = ask_silent;
449 sync_kconfig = 1; 472 sync_kconfig = 1;
450 break; 473 break;
474 case 'b':
475 input_mode = dont_ask;
476 break;
477 case 'B':
478 input_mode = dont_ask_dont_tell;
479 break;
451 case 'd': 480 case 'd':
452 input_mode = set_default; 481 input_mode = set_default;
453 break; 482 break;
@@ -525,6 +554,8 @@ int main(int ac, char **av)
525 case ask_silent: 554 case ask_silent:
526 case ask_all: 555 case ask_all:
527 case ask_new: 556 case ask_new:
557 case dont_ask:
558 case dont_ask_dont_tell:
528 conf_read(NULL); 559 conf_read(NULL);
529 break; 560 break;
530 case set_no: 561 case set_no:
@@ -586,12 +617,16 @@ int main(int ac, char **av)
586 conf(&rootmenu); 617 conf(&rootmenu);
587 input_mode = ask_silent; 618 input_mode = ask_silent;
588 /* fall through */ 619 /* fall through */
620 case dont_ask:
621 case dont_ask_dont_tell:
589 case ask_silent: 622 case ask_silent:
590 /* Update until a loop caused no more changes */ 623 /* Update until a loop caused no more changes */
591 do { 624 do {
592 conf_cnt = 0; 625 conf_cnt = 0;
593 check_conf(&rootmenu); 626 check_conf(&rootmenu);
594 } while (conf_cnt); 627 } while (conf_cnt &&
628 (input_mode != dont_ask &&
629 input_mode != dont_ask_dont_tell));
595 break; 630 break;
596 } 631 }
597 632
@@ -607,11 +642,11 @@ int main(int ac, char **av)
607 fprintf(stderr, _("\n*** Error during update of the kernel configuration.\n\n")); 642 fprintf(stderr, _("\n*** Error during update of the kernel configuration.\n\n"));
608 return 1; 643 return 1;
609 } 644 }
610 } else { 645 } else if (!unset_variables || input_mode != dont_ask) {
611 if (conf_write(NULL)) { 646 if (conf_write(NULL)) {
612 fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); 647 fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
613 exit(1); 648 exit(1);
614 } 649 }
615 } 650 }
616 return 0; 651 return unset_variables ? EUNSETOPT : 0;
617} 652}