aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/conf.c
diff options
context:
space:
mode:
authorSam Ravnborg <sam@ravnborg.org>2010-07-31 17:35:34 -0400
committerMichal Marek <mmarek@suse.cz>2010-08-03 07:49:32 -0400
commit7cf3d73b4360e91b14326632ab1aeda4cb26308d (patch)
tree547bc52c631c9fb99ecd5c4be5ba25610505397a /scripts/kconfig/conf.c
parent49192f266ffa187bd7adaf5c2d881f85bd53e0ed (diff)
kconfig: add savedefconfig
savedefconfig will save a minimal config to a file named "defconfig". The config symbols are saved in the same order as they appear in the menu structure so it should be possible to map them to the relevant menus if desired. The implementation was tested against several minimal configs for arm which was created using brute-force. There was one regression related to default numbers which had their valid range further limited by another symbol. Sample: config FOO int "foo" default 4 config BAR int "bar" range 0 FOO If FOO is set to 3 then BAR cannot take a value higher than 3. But the current implementation will set BAR equal to 4. This is seldomly used and the final configuration is OK, and the fix was non-trivial. So it was documented in the code and left as is. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts/kconfig/conf.c')
-rw-r--r--scripts/kconfig/conf.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index c8bd33cb3bf7..010600ef58c0 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -30,6 +30,7 @@ enum input_mode {
30 alldefconfig, 30 alldefconfig,
31 randconfig, 31 randconfig,
32 defconfig, 32 defconfig,
33 savedefconfig,
33 listnewconfig, 34 listnewconfig,
34 oldnoconfig, 35 oldnoconfig,
35} input_mode = oldaskconfig; 36} input_mode = oldaskconfig;
@@ -444,6 +445,7 @@ static struct option long_opts[] = {
444 {"oldconfig", no_argument, NULL, oldconfig}, 445 {"oldconfig", no_argument, NULL, oldconfig},
445 {"silentoldconfig", no_argument, NULL, silentoldconfig}, 446 {"silentoldconfig", no_argument, NULL, silentoldconfig},
446 {"defconfig", optional_argument, NULL, defconfig}, 447 {"defconfig", optional_argument, NULL, defconfig},
448 {"savedefconfig", required_argument, NULL, savedefconfig},
447 {"allnoconfig", no_argument, NULL, allnoconfig}, 449 {"allnoconfig", no_argument, NULL, allnoconfig},
448 {"allyesconfig", no_argument, NULL, allyesconfig}, 450 {"allyesconfig", no_argument, NULL, allyesconfig},
449 {"allmodconfig", no_argument, NULL, allmodconfig}, 451 {"allmodconfig", no_argument, NULL, allmodconfig},
@@ -471,6 +473,7 @@ int main(int ac, char **av)
471 sync_kconfig = 1; 473 sync_kconfig = 1;
472 break; 474 break;
473 case defconfig: 475 case defconfig:
476 case savedefconfig:
474 defconfig_file = optarg; 477 defconfig_file = optarg;
475 break; 478 break;
476 case randconfig: 479 case randconfig:
@@ -526,6 +529,9 @@ int main(int ac, char **av)
526 exit(1); 529 exit(1);
527 } 530 }
528 break; 531 break;
532 case savedefconfig:
533 conf_read(NULL);
534 break;
529 case silentoldconfig: 535 case silentoldconfig:
530 case oldaskconfig: 536 case oldaskconfig:
531 case oldconfig: 537 case oldconfig:
@@ -591,6 +597,8 @@ int main(int ac, char **av)
591 case defconfig: 597 case defconfig:
592 conf_set_all_new_symbols(def_default); 598 conf_set_all_new_symbols(def_default);
593 break; 599 break;
600 case savedefconfig:
601 break;
594 case oldconfig: 602 case oldconfig:
595 case oldaskconfig: 603 case oldaskconfig:
596 rootEntry = &rootmenu; 604 rootEntry = &rootmenu;
@@ -622,6 +630,12 @@ int main(int ac, char **av)
622 fprintf(stderr, _("\n*** Error during update of the kernel configuration.\n\n")); 630 fprintf(stderr, _("\n*** Error during update of the kernel configuration.\n\n"));
623 return 1; 631 return 1;
624 } 632 }
633 } else if (input_mode == savedefconfig) {
634 if (conf_write_defconfig(defconfig_file)) {
635 fprintf(stderr, _("n*** Error while saving defconfig to: %s\n\n"),
636 defconfig_file);
637 return 1;
638 }
625 } else if (input_mode != listnewconfig) { 639 } else if (input_mode != listnewconfig) {
626 if (conf_write(NULL)) { 640 if (conf_write(NULL)) {
627 fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); 641 fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));