kconfig: fix oldconfig to generate .config.cmd

Since the recent update of Kconfig to the Kconfig infrastructure found
in 2.6.30 kernels, make oldconfig was broken because it didn't
generate the .config.cmd file. This is done by a call to the
conf_write_autoconf() function.

Moreover, this process was also broken because the
conf_get_autoconfig_name() function was reading the environment
variable BUILDROOT_AUTOCONF while the main Makefile is passing it as
KCONFIG_AUTOCONFIG. We also remove the fallback on
"$(BR2_DEPENDS_DIR)/config/auto.conf" since we are not able to expand
BR2_DEPENDS_DIR at this point. Therefore, the KCONFIG_AUTOCONFIG
envionment variable *must* be set.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
This commit is contained in:
Thomas Petazzoni 2009-08-03 10:07:54 +02:00
parent 4840c451d9
commit c0727fd319
3 changed files with 31 additions and 24 deletions

View File

@ -611,6 +611,10 @@ int main(int ac, char **av)
fprintf(stderr, _("\n*** Error during writing of the Buildroot configuration.\n\n")); fprintf(stderr, _("\n*** Error during writing of the Buildroot configuration.\n\n"));
exit(1); exit(1);
} }
if (conf_write_autoconf()) {
fprintf(stderr, _("\n*** Error during update of the Buildroot configuration.\n\n"));
return 1;
}
} }
return 0; return 0;
} }

View File

@ -44,9 +44,7 @@ const char *conf_get_configname(void)
const char *conf_get_autoconfig_name(void) const char *conf_get_autoconfig_name(void)
{ {
char *name = getenv("BUILDROOT_AUTOCONFIG"); return getenv("KCONFIG_AUTOCONFIG");
return name ? name : "$(BR2_DEPENDS_DIR)/config/auto.conf";
} }
static char *conf_expand_value(const char *in) static char *conf_expand_value(const char *in)

View File

@ -1,7 +1,7 @@
--- ---
Makefile | 7 +++ Makefile | 7 +++
README.buildroot2 | 22 ++++++++++ README.buildroot2 | 22 ++++++++++
conf.c | 13 ++---- conf.c | 17 ++++----
confdata.c | 101 ++++++++++++++++++++++++++------------------------ confdata.c | 101 ++++++++++++++++++++++++++------------------------
expr.c | 42 ++++++++++---------- expr.c | 42 ++++++++++----------
gconf.c | 4 - gconf.c | 4 -
@ -11,7 +11,7 @@
util.c | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++- util.c | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++-
zconf.tab.c_shipped | 2 zconf.tab.c_shipped | 2
zconf.y | 2 zconf.y | 2
12 files changed, 241 insertions(+), 103 deletions(-) 12 files changed, 244 insertions(+), 104 deletions(-)
Index: config/Makefile Index: config/Makefile
=================================================================== ===================================================================
@ -91,7 +91,7 @@ Index: config/conf.c
return 1; return 1;
} }
} }
@@ -600,16 +599,16 @@ @@ -600,18 +599,22 @@
* All other commands are only used to generate a config. * All other commands are only used to generate a config.
*/ */
if (conf_get_changed() && conf_write(NULL)) { if (conf_get_changed() && conf_write(NULL)) {
@ -110,7 +110,13 @@ Index: config/conf.c
+ fprintf(stderr, _("\n*** Error during writing of the Buildroot configuration.\n\n")); + fprintf(stderr, _("\n*** Error during writing of the Buildroot configuration.\n\n"));
exit(1); exit(1);
} }
+ if (conf_write_autoconf()) {
+ fprintf(stderr, _("\n*** Error during update of the Buildroot configuration.\n\n"));
+ return 1;
+ }
} }
return 0;
}
Index: config/confdata.c Index: config/confdata.c
=================================================================== ===================================================================
--- config.orig/confdata.c --- config.orig/confdata.c
@ -132,7 +138,7 @@ Index: config/confdata.c
static void conf_warning(const char *fmt, ...) static void conf_warning(const char *fmt, ...)
{ {
@@ -36,16 +37,16 @@ @@ -36,16 +37,14 @@
const char *conf_get_configname(void) const char *conf_get_configname(void)
{ {
@ -145,14 +151,13 @@ Index: config/confdata.c
const char *conf_get_autoconfig_name(void) const char *conf_get_autoconfig_name(void)
{ {
- char *name = getenv("KCONFIG_AUTOCONFIG"); - char *name = getenv("KCONFIG_AUTOCONFIG");
+ char *name = getenv("BUILDROOT_AUTOCONFIG"); -
- return name ? name : "include/config/auto.conf"; - return name ? name : "include/config/auto.conf";
+ return name ? name : "$(BR2_DEPENDS_DIR)/config/auto.conf"; + return getenv("KCONFIG_AUTOCONFIG");
} }
static char *conf_expand_value(const char *in) static char *conf_expand_value(const char *in)
@@ -219,22 +220,22 @@ @@ -219,22 +218,22 @@
sym = NULL; sym = NULL;
switch (line[0]) { switch (line[0]) {
case '#': case '#':
@ -179,7 +184,7 @@ Index: config/confdata.c
if (sym->type == S_UNKNOWN) if (sym->type == S_UNKNOWN)
sym->type = S_BOOLEAN; sym->type = S_BOOLEAN;
} }
@@ -251,12 +252,8 @@ @@ -251,12 +250,8 @@
; ;
} }
break; break;
@ -194,7 +199,7 @@ Index: config/confdata.c
if (!p) if (!p)
continue; continue;
*p++ = 0; *p++ = 0;
@@ -267,13 +264,13 @@ @@ -267,13 +262,13 @@
*p2 = 0; *p2 = 0;
} }
if (def == S_DEF_USER) { if (def == S_DEF_USER) {
@ -210,7 +215,7 @@ Index: config/confdata.c
if (sym->type == S_UNKNOWN) if (sym->type == S_UNKNOWN)
sym->type = S_OTHER; sym->type = S_OTHER;
} }
@@ -443,7 +440,7 @@ @@ -443,7 +438,7 @@
if (!out) if (!out)
return 1; return 1;
@ -219,7 +224,7 @@ Index: config/confdata.c
sym_calc_value(sym); sym_calc_value(sym);
time(&now); time(&now);
env = getenv("KCONFIG_NOTIMESTAMP"); env = getenv("KCONFIG_NOTIMESTAMP");
@@ -452,10 +449,8 @@ @@ -452,10 +447,8 @@
fprintf(out, _("#\n" fprintf(out, _("#\n"
"# Automatically generated make config: don't edit\n" "# Automatically generated make config: don't edit\n"
@ -230,7 +235,7 @@ Index: config/confdata.c
use_timestamp ? "# " : "", use_timestamp ? "# " : "",
use_timestamp ? ctime(&now) : ""); use_timestamp ? ctime(&now) : "");
@@ -489,19 +484,19 @@ @@ -489,19 +482,19 @@
case S_TRISTATE: case S_TRISTATE:
switch (sym_get_tristate_value(sym)) { switch (sym_get_tristate_value(sym)) {
case no: case no:
@ -254,7 +259,7 @@ Index: config/confdata.c
while (1) { while (1) {
l = strcspn(str, "\"\\"); l = strcspn(str, "\"\\");
if (l) { if (l) {
@@ -517,12 +512,12 @@ @@ -517,12 +510,12 @@
case S_HEX: case S_HEX:
str = sym_get_string_value(sym); str = sym_get_string_value(sym);
if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) { if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
@ -269,7 +274,7 @@ Index: config/confdata.c
break; break;
} }
} }
@@ -564,6 +559,7 @@ @@ -564,6 +557,7 @@
{ {
const char *name; const char *name;
char path[128]; char path[128];
@ -277,7 +282,7 @@ Index: config/confdata.c
char *s, *d, c; char *s, *d, c;
struct symbol *sym; struct symbol *sym;
struct stat sb; struct stat sb;
@@ -572,8 +568,20 @@ @@ -572,8 +566,20 @@
name = conf_get_autoconfig_name(); name = conf_get_autoconfig_name();
conf_read_simple(name, S_DEF_AUTO); conf_read_simple(name, S_DEF_AUTO);
@ -299,7 +304,7 @@ Index: config/confdata.c
res = 0; res = 0;
for_all_symbols(i, sym) { for_all_symbols(i, sym) {
@@ -666,9 +674,11 @@ @@ -666,9 +672,11 @@
close(fd); close(fd);
} }
out: out:
@ -314,7 +319,7 @@ Index: config/confdata.c
return res; return res;
} }
@@ -683,7 +693,7 @@ @@ -683,7 +691,7 @@
sym_clear_all_valid(); sym_clear_all_valid();
@ -323,7 +328,7 @@ Index: config/confdata.c
if (conf_split_config()) if (conf_split_config())
return 1; return 1;
@@ -698,22 +708,19 @@ @@ -698,22 +706,19 @@
return 1; return 1;
} }
@ -350,7 +355,7 @@ Index: config/confdata.c
for_all_symbols(i, sym) { for_all_symbols(i, sym) {
sym_calc_value(sym); sym_calc_value(sym);
@@ -726,19 +733,19 @@ @@ -726,19 +731,19 @@
case no: case no:
break; break;
case mod: case mod:
@ -376,7 +381,7 @@ Index: config/confdata.c
while (1) { while (1) {
l = strcspn(str, "\"\\"); l = strcspn(str, "\"\\");
if (l) { if (l) {
@@ -758,14 +765,14 @@ @@ -758,14 +763,14 @@
case S_HEX: case S_HEX:
str = sym_get_string_value(sym); str = sym_get_string_value(sym);
if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) { if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {