summaryrefslogtreecommitdiffstats
path: root/package/config/confdata.c
diff options
context:
space:
mode:
authorAlper Yildirim <ayildirim@aselsan.com>2009-07-20 18:50:58 +0200
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2009-07-27 16:06:50 +0200
commit4b3e11b3e7d00881878f45cddbfe8f4bf07d1ebe (patch)
tree3740632b5196497242055f7ecdfe4be3c6210409 /package/config/confdata.c
parentea536503331aea875e84ae598b4610fbd059f167 (diff)
downloadbuildroot-novena-4b3e11b3e7d00881878f45cddbfe8f4bf07d1ebe.tar.gz
buildroot-novena-4b3e11b3e7d00881878f45cddbfe8f4bf07d1ebe.zip
config: Update package/config to Kconfig 2.6.30
Update the package/config stuff with the code available in the Linux kernel 2.6.30. Signed-off-by: Alper Yildirim <ayildirim@aselsan.com>
Diffstat (limited to 'package/config/confdata.c')
-rw-r--r--package/config/confdata.c139
1 files changed, 115 insertions, 24 deletions
diff --git a/package/config/confdata.c b/package/config/confdata.c
index 7f06da4f1..56bcd8769 100644
--- a/package/config/confdata.c
+++ b/package/config/confdata.c
@@ -42,6 +42,13 @@ const char *conf_get_configname(void)
return name ? name : ".config";
}
+const char *conf_get_autoconfig_name(void)
+{
+ char *name = getenv("BUILDROOT_AUTOCONFIG");
+
+ return name ? name : "$(BR2_DEPENDS_DIR)/config/auto.conf";
+}
+
static char *conf_expand_value(const char *in)
{
struct symbol *sym;
@@ -224,7 +231,7 @@ load:
if (def == S_DEF_USER) {
sym = sym_find(line + 2);
if (!sym) {
- conf_warning("trying to assign nonexistent symbol %s", line + 2);
+ sym_add_change_count(1);
break;
}
} else {
@@ -233,8 +240,7 @@ load:
sym->type = S_BOOLEAN;
}
if (sym->flags & def_flags) {
- conf_warning("trying to reassign symbol %s", sym->name);
- break;
+ conf_warning("override: reassigning to symbol %s", sym->name);
}
switch (sym->type) {
case S_BOOLEAN:
@@ -260,7 +266,7 @@ load:
if (def == S_DEF_USER) {
sym = sym_find(line);
if (!sym) {
- conf_warning("trying to assign nonexistent symbol %s", line);
+ sym_add_change_count(1);
break;
}
} else {
@@ -269,8 +275,7 @@ load:
sym->type = S_OTHER;
}
if (sym->flags & def_flags) {
- conf_warning("trying to reassign symbol %s", sym->name);
- break;
+ conf_warning("override: reassigning to symbol %s", sym->name);
}
if (conf_set_sym_val(sym, def, def_flags, p))
continue;
@@ -294,14 +299,12 @@ load:
}
break;
case yes:
- if (cs->def[def].tri != no) {
- conf_warning("%s creates inconsistent choice state", sym->name);
- cs->flags &= ~def_flags;
- } else
- cs->def[def].val = sym;
+ if (cs->def[def].tri != no)
+ conf_warning("override: %s changes choice state", sym->name);
+ cs->def[def].val = sym;
break;
}
- cs->def[def].tri = E_OR(cs->def[def].tri, sym->def[def].tri);
+ cs->def[def].tri = EXPR_OR(cs->def[def].tri, sym->def[def].tri);
}
}
fclose(in);
@@ -313,7 +316,7 @@ load:
int conf_read(const char *name)
{
- struct symbol *sym;
+ struct symbol *sym, *choice_sym;
struct property *prop;
struct expr *e;
int i, flags;
@@ -354,9 +357,9 @@ int conf_read(const char *name)
*/
prop = sym_get_choice_prop(sym);
flags = sym->flags;
- for (e = prop->expr; e; e = e->left.expr)
- if (e->right.sym->visible != no)
- flags &= e->right.sym->flags;
+ expr_list_for_each_sym(prop->expr, e, choice_sym)
+ if (choice_sym->visible != no)
+ flags &= choice_sym->flags;
sym->flags &= flags | ~SYMBOL_DEF_USER;
}
@@ -554,15 +557,15 @@ int conf_write(const char *name)
int conf_split_config(void)
{
- char *name, path[128], *opwd, *dir, *_name;
+ const char *name;
+ char path[128];
+ char *opwd, *dir, *_name;
char *s, *d, c;
struct symbol *sym;
struct stat sb;
int res, i, fd;
- name = getenv("KCONFIG_AUTOCONFIG");
- if (!name)
- name = "include/config/auto.conf";
+ name = conf_get_autoconfig_name();
conf_read_simple(name, S_DEF_AUTO);
opwd = malloc(256);
@@ -683,7 +686,7 @@ int conf_write_autoconf(void)
{
struct symbol *sym;
const char *str;
- char *name;
+ const char *name;
FILE *out, *out_h;
time_t now;
int i, l;
@@ -783,9 +786,7 @@ int conf_write_autoconf(void)
name = "include/linux/autoconf.h";
if (rename(".tmpconfig.h", name))
return 1;
- name = getenv("KCONFIG_AUTOCONFIG");
- if (!name)
- name = "include/config/auto.conf";
+ name = conf_get_autoconfig_name();
/*
* This must be the last step, kbuild has a dependency on auto.conf
* and this marks the successful completion of the previous steps.
@@ -822,3 +823,93 @@ void conf_set_changed_callback(void (*fn)(void))
{
conf_changed_callback = fn;
}
+
+
+void conf_set_all_new_symbols(enum conf_def_mode mode)
+{
+ struct symbol *sym, *csym;
+ struct property *prop;
+ struct expr *e;
+ int i, cnt, def;
+
+ for_all_symbols(i, sym) {
+ if (sym_has_value(sym))
+ continue;
+ switch (sym_get_type(sym)) {
+ case S_BOOLEAN:
+ case S_TRISTATE:
+ switch (mode) {
+ case def_yes:
+ sym->def[S_DEF_USER].tri = yes;
+ break;
+ case def_mod:
+ sym->def[S_DEF_USER].tri = mod;
+ break;
+ case def_no:
+ sym->def[S_DEF_USER].tri = no;
+ break;
+ case def_random:
+ sym->def[S_DEF_USER].tri = (tristate)(rand() % 3);
+ break;
+ default:
+ continue;
+ }
+ if (!(sym_is_choice(sym) && mode == def_random))
+ sym->flags |= SYMBOL_DEF_USER;
+ break;
+ default:
+ break;
+ }
+
+ }
+
+ sym_clear_all_valid();
+
+ if (mode != def_random)
+ return;
+ /*
+ * We have different type of choice blocks.
+ * If curr.tri equal to mod then we can select several
+ * choice symbols in one block.
+ * In this case we do nothing.
+ * If curr.tri equal yes then only one symbol can be
+ * selected in a choice block and we set it to yes,
+ * and the rest to no.
+ */
+ for_all_symbols(i, csym) {
+ if (sym_has_value(csym) || !sym_is_choice(csym))
+ continue;
+
+ sym_calc_value(csym);
+
+ if (csym->curr.tri != yes)
+ continue;
+
+ prop = sym_get_choice_prop(csym);
+
+ /* count entries in choice block */
+ cnt = 0;
+ expr_list_for_each_sym(prop->expr, e, sym)
+ cnt++;
+
+ /*
+ * find a random value and set it to yes,
+ * set the rest to no so we have only one set
+ */
+ def = (rand() % cnt);
+
+ cnt = 0;
+ expr_list_for_each_sym(prop->expr, e, sym) {
+ if (def == cnt++) {
+ sym->def[S_DEF_USER].tri = yes;
+ csym->def[S_DEF_USER].val = sym;
+ }
+ else {
+ sym->def[S_DEF_USER].tri = no;
+ }
+ }
+ csym->flags |= SYMBOL_DEF_USER;
+ /* clear VALID to get value calculated */
+ csym->flags &= ~(SYMBOL_VALID);
+ }
+}