Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 110049
b: refs/heads/master
c: 204c96f
h: refs/heads/master
i:
  110047: af0dff1
v: v3
  • Loading branch information
zippel@linux-m68k.org authored and Linus Torvalds committed Sep 29, 2008
1 parent 646f299 commit 3848284
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 67 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d0185c0882d76b8126d4a099c7ac82b3b216d103
refs/heads/master: 204c96f609045a8ce84d1dca3e758ee9b0b2a95c
123 changes: 57 additions & 66 deletions trunk/scripts/kconfig/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ char *defconfig_file;

static int indent = 1;
static int valid_stdin = 1;
static int sync_kconfig;
static int conf_cnt;
static char line[128];
static struct menu *rootEntry;
Expand Down Expand Up @@ -65,7 +66,7 @@ static void strip(char *str)

static void check_stdin(void)
{
if (!valid_stdin && input_mode == ask_silent) {
if (!valid_stdin) {
printf(_("aborted!\n\n"));
printf(_("Console input/output is redirected. "));
printf(_("Run 'make oldconfig' to update configuration.\n\n"));
Expand Down Expand Up @@ -427,43 +428,6 @@ 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;
Expand All @@ -477,11 +441,11 @@ int main(int ac, char **av)
while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) {
switch (opt) {
case 'o':
input_mode = ask_new;
input_mode = ask_silent;
break;
case 's':
input_mode = ask_silent;
valid_stdin = isatty(0) && isatty(1) && isatty(2);
sync_kconfig = 1;
break;
case 'd':
input_mode = set_default;
Expand Down Expand Up @@ -519,6 +483,19 @@ int main(int ac, char **av)
name = av[optind];
conf_parse(name);
//zconfdump(stdout);
if (sync_kconfig) {
if (stat(".config", &tmpstat)) {
fprintf(stderr, _("***\n"
"*** You have not yet configured your kernel!\n"
"*** (missing kernel .config file)\n"
"***\n"
"*** Please run some configurator (e.g. \"make oldconfig\" or\n"
"*** \"make menuconfig\" or \"make xconfig\").\n"
"***\n"));
exit(1);
}
}

switch (input_mode) {
case set_default:
if (!defconfig_file)
Expand All @@ -531,16 +508,6 @@ int main(int ac, char **av)
}
break;
case ask_silent:
if (stat(".config", &tmpstat)) {
printf(_("***\n"
"*** You have not yet configured your kernel!\n"
"*** (missing kernel .config file)\n"
"***\n"
"*** Please run some configurator (e.g. \"make oldconfig\" or\n"
"*** \"make menuconfig\" or \"make xconfig\").\n"
"***\n"));
exit(1);
}
case ask_all:
case ask_new:
conf_read(NULL);
Expand Down Expand Up @@ -569,6 +536,19 @@ int main(int ac, char **av)
default:
break;
}

if (sync_kconfig) {
if (conf_get_changed()) {
name = getenv("KCONFIG_NOSILENTUPDATE");
if (name && *name) {
fprintf(stderr,
_("\n*** Kernel configuration requires explicit update.\n\n"));
return 1;
}
}
valid_stdin = isatty(0) && isatty(1) && isatty(2);
}

switch (input_mode) {
case set_no:
conf_set_all_new_symbols(def_no);
Expand All @@ -585,27 +565,38 @@ int main(int ac, char **av)
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:
if (conf_update())
exit(1);
rootEntry = &rootmenu;
conf(&rootmenu);
input_mode = ask_silent;
/* fall through */
case ask_silent:
/* Update until a loop caused no more changes */
do {
conf_cnt = 0;
check_conf(&rootmenu);
} while (conf_cnt);
break;
}

if (conf_write(NULL)) {
fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
exit(1);
}
/* 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;
if (sync_kconfig) {
/* silentoldconfig is used during the build so we shall update autoconf.
* All other commands are only used to generate a config.
*/
if (conf_get_changed() && conf_write(NULL)) {
fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
exit(1);
}
if (conf_write_autoconf()) {
fprintf(stderr, _("\n*** Error during update of the kernel configuration.\n\n"));
return 1;
}
} else {
if (conf_write(NULL)) {
fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
exit(1);
}
}
return 0;
}

0 comments on commit 3848284

Please sign in to comment.