Skip to content

Commit

Permalink
[PATCH] kconfig: preset config during all*config
Browse files Browse the repository at this point in the history
Allow to force setting of config variables during all{no,mod,yes,random}config
to a specific value.  For that conf first checks the KCONFIG_ALLCONFIG
environment variable for a file name, otherwise it checks for
all{no,mod,yes,random}.config and all.config.  The file is a normal config
file, which presets the config variables, but they are still subject to normal
dependency checks.

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Roman Zippel authored and Linus Torvalds committed Nov 9, 2005
1 parent 3f23ca2 commit 9038916
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
30 changes: 30 additions & 0 deletions scripts/kconfig/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ static void 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;
}
break;
case ask_new:
case ask_silent:
if (sym_has_value(sym)) {
Expand Down Expand Up @@ -558,6 +567,27 @@ int main(int ac, char **av)
case ask_new:
conf_read(NULL);
break;
case set_no:
case set_mod:
case set_yes:
case set_random:
name = getenv("KCONFIG_ALLCONFIG");
if (name && !stat(name, &tmpstat)) {
conf_read_simple(name);
break;
}
switch (input_mode) {
case set_no: name = "allno.config"; break;
case set_mod: name = "allmod.config"; break;
case set_yes: name = "allyes.config"; break;
case set_random: name = "allrandom.config"; break;
default: break;
}
if (!stat(name, &tmpstat))
conf_read_simple(name);
else if (!stat("all.config", &tmpstat))
conf_read_simple("all.config");
break;
default:
break;
}
Expand Down
17 changes: 14 additions & 3 deletions scripts/kconfig/confdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,13 @@ char *conf_get_default_confname(void)
return name;
}

int conf_read(const char *name)
int conf_read_simple(const char *name)
{
FILE *in = NULL;
char line[1024];
char *p, *p2;
int lineno = 0;
struct symbol *sym;
struct property *prop;
struct expr *e;
int i;

if (name) {
Expand Down Expand Up @@ -232,6 +230,19 @@ int conf_read(const char *name)

if (modules_sym)
sym_calc_value(modules_sym);
return 0;
}

int conf_read(const char *name)
{
struct symbol *sym;
struct property *prop;
struct expr *e;
int i;

if (conf_read_simple(name))
return 1;

for_all_symbols(i, sym) {
sym_calc_value(sym);
if (sym_has_value(sym) && !sym_is_choice_value(sym)) {
Expand Down
1 change: 1 addition & 0 deletions scripts/kconfig/lkc_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* confdata.c */
P(conf_parse,void,(const char *name));
P(conf_read,int,(const char *name));
P(conf_read_simple,int,(const char *name));
P(conf_write,int,(const char *name));

/* menu.c */
Expand Down

0 comments on commit 9038916

Please sign in to comment.