Skip to content

Commit 12122f6

Browse files
marcowssravnborg
authored andcommitted
kconfig: do not hardcode "include/config/auto.conf" filename
Regardless of KCONFIG_AUTOCONFIG, the filename written as a Make target into "include/config/auto.conf.cmd" was always the default one. Of course this doesn't make it work for the Kernel kbuild system, since there the filename is hardcoded at several places in the Makefiles. Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
1 parent 284026c commit 12122f6

3 files changed

Lines changed: 16 additions & 11 deletions

File tree

‎scripts/kconfig/confdata.c‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ const char *conf_get_configname(void)
4141
return name ? name : ".config";
4242
}
4343

44+
const char *conf_get_autoconfig_name(void)
45+
{
46+
char *name = getenv("KCONFIG_AUTOCONFIG");
47+
48+
return name ? name : "include/config/auto.conf";
49+
}
50+
4451
static char *conf_expand_value(const char *in)
4552
{
4653
struct symbol *sym;
@@ -555,15 +562,14 @@ int conf_write(const char *name)
555562

556563
int conf_split_config(void)
557564
{
558-
char *name, path[128];
565+
const char *name;
566+
char path[128];
559567
char *s, *d, c;
560568
struct symbol *sym;
561569
struct stat sb;
562570
int res, i, fd;
563571

564-
name = getenv("KCONFIG_AUTOCONFIG");
565-
if (!name)
566-
name = "include/config/auto.conf";
572+
name = conf_get_autoconfig_name();
567573
conf_read_simple(name, S_DEF_AUTO);
568574

569575
if (chdir("include/config"))
@@ -670,7 +676,7 @@ int conf_write_autoconf(void)
670676
{
671677
struct symbol *sym;
672678
const char *str;
673-
char *name;
679+
const char *name;
674680
FILE *out, *out_h;
675681
time_t now;
676682
int i, l;
@@ -773,9 +779,7 @@ int conf_write_autoconf(void)
773779
name = "include/linux/autoconf.h";
774780
if (rename(".tmpconfig.h", name))
775781
return 1;
776-
name = getenv("KCONFIG_AUTOCONFIG");
777-
if (!name)
778-
name = "include/config/auto.conf";
782+
name = conf_get_autoconfig_name();
779783
/*
780784
* This must be the last step, kbuild has a dependency on auto.conf
781785
* and this marks the successful completion of the previous steps.

‎scripts/kconfig/lkc.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ char *zconf_curname(void);
7474

7575
/* confdata.c */
7676
const char *conf_get_configname(void);
77+
const char *conf_get_autoconfig_name(void);
7778
char *conf_get_default_confname(void);
7879
void sym_set_change_count(int count);
7980
void sym_add_change_count(int count);

‎scripts/kconfig/util.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ int file_write_dep(const char *name)
4646
else
4747
fprintf(out, "\t%s\n", file->name);
4848
}
49-
fprintf(out, "\ninclude/config/auto.conf: \\\n"
50-
"\t$(deps_config)\n\n");
49+
fprintf(out, "\n%s: \\\n"
50+
"\t$(deps_config)\n\n", conf_get_autoconfig_name());
5151

5252
expr_list_for_each_sym(sym_env_list, e, sym) {
5353
struct property *prop;
@@ -61,7 +61,7 @@ int file_write_dep(const char *name)
6161
if (!value)
6262
value = "";
6363
fprintf(out, "ifneq \"$(%s)\" \"%s\"\n", env_sym->name, value);
64-
fprintf(out, "include/config/auto.conf: FORCE\n");
64+
fprintf(out, "%s: FORCE\n", conf_get_autoconfig_name());
6565
fprintf(out, "endif\n");
6666
}
6767

0 commit comments

Comments
 (0)