aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorRoman Zippel <zippel@linux-m68k.org>2006-06-09 01:12:45 -0400
committerSam Ravnborg <sam@mars.ravnborg.org>2006-06-09 01:31:30 -0400
commitface4374e288372fba67c865eb0c92337f50d5a4 (patch)
tree81a9535cc6af701a9fd1d23338449268498447ed /scripts
parentf6a88aa86027bdecfc74ef7c6bf6c68233e86bb3 (diff)
kconfig: add defconfig_list/module option
This makes it possible to change two options which were hardcoded sofar. 1. Any symbol can now take the role of CONFIG_MODULES 2. The more useful option is to change the list of default file names, which kconfig uses to load the base configuration if .config isn't available. Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/confdata.c26
-rw-r--r--scripts/kconfig/expr.h1
-rw-r--r--scripts/kconfig/lkc.h1
-rw-r--r--scripts/kconfig/menu.c14
-rw-r--r--scripts/kconfig/symbol.c15
-rw-r--r--scripts/kconfig/zconf.tab.c_shipped10
-rw-r--r--scripts/kconfig/zconf.y10
7 files changed, 53 insertions, 24 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index e28cd0c2ca08..5bd66f451189 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -25,15 +25,6 @@ const char conf_def_filename[] = ".config";
25 25
26const char conf_defname[] = "arch/$ARCH/defconfig"; 26const char conf_defname[] = "arch/$ARCH/defconfig";
27 27
28const char *conf_confnames[] = {
29 ".config",
30 "/lib/modules/$UNAME_RELEASE/.config",
31 "/etc/kernel-config",
32 "/boot/config-$UNAME_RELEASE",
33 conf_defname,
34 NULL,
35};
36
37static void conf_warning(const char *fmt, ...) 28static void conf_warning(const char *fmt, ...)
38{ 29{
39 va_list ap; 30 va_list ap;
@@ -98,16 +89,21 @@ int conf_read_simple(const char *name, int def)
98 if (name) { 89 if (name) {
99 in = zconf_fopen(name); 90 in = zconf_fopen(name);
100 } else { 91 } else {
101 const char **names = conf_confnames; 92 struct property *prop;
102 name = *names++; 93
103 if (!name) 94 name = conf_def_filename;
104 return 1;
105 in = zconf_fopen(name); 95 in = zconf_fopen(name);
106 if (in) 96 if (in)
107 goto load; 97 goto load;
108 sym_change_count++; 98 sym_change_count++;
109 while ((name = *names++)) { 99 if (!sym_defconfig_list)
110 name = conf_expand_value(name); 100 return 1;
101
102 for_all_defaults(sym_defconfig_list, prop) {
103 if (expr_calc_value(prop->visible.expr) == no ||
104 prop->expr->type != E_SYMBOL)
105 continue;
106 name = conf_expand_value(prop->expr->left.sym->name);
111 in = zconf_fopen(name); 107 in = zconf_fopen(name);
112 if (in) { 108 if (in) {
113 printf(_("#\n" 109 printf(_("#\n"
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index ffd42c7007ee..6084525f604b 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -156,6 +156,7 @@ struct file *lookup_file(const char *name);
156 156
157extern struct symbol symbol_yes, symbol_no, symbol_mod; 157extern struct symbol symbol_yes, symbol_no, symbol_mod;
158extern struct symbol *modules_sym; 158extern struct symbol *modules_sym;
159extern struct symbol *sym_defconfig_list;
159extern int cdebug; 160extern int cdebug;
160struct expr *expr_alloc_symbol(struct symbol *sym); 161struct expr *expr_alloc_symbol(struct symbol *sym);
161struct expr *expr_alloc_one(enum expr_type type, struct expr *ce); 162struct expr *expr_alloc_one(enum expr_type type, struct expr *ce);
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index 8e89d342889e..2d3d4ed3c9f2 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -104,6 +104,7 @@ const char *str_get(struct gstr *gs);
104/* symbol.c */ 104/* symbol.c */
105void sym_init(void); 105void sym_init(void);
106void sym_clear_all_valid(void); 106void sym_clear_all_valid(void);
107void sym_set_all_changed(void);
107void sym_set_changed(struct symbol *sym); 108void sym_set_changed(struct symbol *sym);
108struct symbol *sym_check_deps(struct symbol *sym); 109struct symbol *sym_check_deps(struct symbol *sym);
109struct property *prop_alloc(enum prop_type type, struct symbol *sym); 110struct property *prop_alloc(enum prop_type type, struct symbol *sym);
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 151ef2168a2c..a8afce24fb1b 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -154,6 +154,20 @@ void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep)
154 154
155void menu_add_option(int token, char *arg) 155void menu_add_option(int token, char *arg)
156{ 156{
157 struct property *prop;
158
159 switch (token) {
160 case T_OPT_MODULES:
161 prop = prop_alloc(P_DEFAULT, modules_sym);
162 prop->expr = expr_alloc_symbol(current_entry->sym);
163 break;
164 case T_OPT_DEFCONFIG_LIST:
165 if (!sym_defconfig_list)
166 sym_defconfig_list = current_entry->sym;
167 else if (sym_defconfig_list != current_entry->sym)
168 zconf_error("trying to redefine defconfig symbol");
169 break;
170 }
157} 171}
158 172
159static int menu_range_valid_sym(struct symbol *sym, struct symbol *sym2) 173static int menu_range_valid_sym(struct symbol *sym, struct symbol *sym2)
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 78a60ba39e54..ee225ced2ce4 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -31,6 +31,7 @@ struct symbol symbol_yes = {
31}; 31};
32 32
33int sym_change_count; 33int sym_change_count;
34struct symbol *sym_defconfig_list;
34struct symbol *modules_sym; 35struct symbol *modules_sym;
35tristate modules_val; 36tristate modules_val;
36 37
@@ -352,10 +353,13 @@ void sym_calc_value(struct symbol *sym)
352 sym->curr.val = sym_calc_choice(sym); 353 sym->curr.val = sym_calc_choice(sym);
353 sym_validate_range(sym); 354 sym_validate_range(sym);
354 355
355 if (memcmp(&oldval, &sym->curr, sizeof(oldval))) 356 if (memcmp(&oldval, &sym->curr, sizeof(oldval))) {
356 sym_set_changed(sym); 357 sym_set_changed(sym);
357 if (modules_sym == sym) 358 if (modules_sym == sym) {
358 modules_val = modules_sym->curr.tri; 359 sym_set_all_changed();
360 modules_val = modules_sym->curr.tri;
361 }
362 }
359 363
360 if (sym_is_choice(sym)) { 364 if (sym_is_choice(sym)) {
361 int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE); 365 int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE);
@@ -449,11 +453,8 @@ bool sym_set_tristate_value(struct symbol *sym, tristate val)
449 } 453 }
450 454
451 sym->def[S_DEF_USER].tri = val; 455 sym->def[S_DEF_USER].tri = val;
452 if (oldval != val) { 456 if (oldval != val)
453 sym_clear_all_valid(); 457 sym_clear_all_valid();
454 if (sym == modules_sym)
455 sym_set_all_changed();
456 }
457 458
458 return true; 459 return true;
459} 460}
diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped
index 137426e507ec..2fb0a4fc61d0 100644
--- a/scripts/kconfig/zconf.tab.c_shipped
+++ b/scripts/kconfig/zconf.tab.c_shipped
@@ -2112,7 +2112,9 @@ void conf_parse(const char *name)
2112 2112
2113 sym_init(); 2113 sym_init();
2114 menu_init(); 2114 menu_init();
2115 modules_sym = sym_lookup("MODULES", 0); 2115 modules_sym = sym_lookup(NULL, 0);
2116 modules_sym->type = S_BOOLEAN;
2117 modules_sym->flags |= SYMBOL_AUTO;
2116 rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); 2118 rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
2117 2119
2118#if YYDEBUG 2120#if YYDEBUG
@@ -2122,6 +2124,12 @@ void conf_parse(const char *name)
2122 zconfparse(); 2124 zconfparse();
2123 if (zconfnerrs) 2125 if (zconfnerrs)
2124 exit(1); 2126 exit(1);
2127 if (!modules_sym->prop) {
2128 struct property *prop;
2129
2130 prop = prop_alloc(P_DEFAULT, modules_sym);
2131 prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0));
2132 }
2125 menu_finalize(&rootmenu); 2133 menu_finalize(&rootmenu);
2126 for_all_symbols(i, sym) { 2134 for_all_symbols(i, sym) {
2127 sym_check_deps(sym); 2135 sym_check_deps(sym);
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
index 9d08582f2aa6..ab44feb3c600 100644
--- a/scripts/kconfig/zconf.y
+++ b/scripts/kconfig/zconf.y
@@ -481,7 +481,9 @@ void conf_parse(const char *name)
481 481
482 sym_init(); 482 sym_init();
483 menu_init(); 483 menu_init();
484 modules_sym = sym_lookup("MODULES", 0); 484 modules_sym = sym_lookup(NULL, 0);
485 modules_sym->type = S_BOOLEAN;
486 modules_sym->flags |= SYMBOL_AUTO;
485 rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); 487 rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
486 488
487#if YYDEBUG 489#if YYDEBUG
@@ -491,6 +493,12 @@ void conf_parse(const char *name)
491 zconfparse(); 493 zconfparse();
492 if (zconfnerrs) 494 if (zconfnerrs)
493 exit(1); 495 exit(1);
496 if (!modules_sym->prop) {
497 struct property *prop;
498
499 prop = prop_alloc(P_DEFAULT, modules_sym);
500 prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0));
501 }
494 menu_finalize(&rootmenu); 502 menu_finalize(&rootmenu);
495 for_all_symbols(i, sym) { 503 for_all_symbols(i, sym) {
496 sym_check_deps(sym); 504 sym_check_deps(sym);