Skip to content

Commit 1b9e740

Browse files
Jing Lengmasahir0y
authored andcommitted
kconfig: fix failing to generate auto.conf
When the KCONFIG_AUTOCONFIG is specified (e.g. export \ KCONFIG_AUTOCONFIG=output/config/auto.conf), the directory of include/config/ will not be created, so kconfig can't create deps files in it and auto.conf can't be generated. Signed-off-by: Jing Leng <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
1 parent d23a0c3 commit 1b9e740

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

scripts/kconfig/confdata.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -994,14 +994,19 @@ static int conf_write_autoconf_cmd(const char *autoconf_name)
994994

995995
static int conf_touch_deps(void)
996996
{
997-
const char *name;
997+
const char *name, *tmp;
998998
struct symbol *sym;
999999
int res, i;
10001000

1001-
strcpy(depfile_path, "include/config/");
1002-
depfile_prefix_len = strlen(depfile_path);
1003-
10041001
name = conf_get_autoconfig_name();
1002+
tmp = strrchr(name, '/');
1003+
depfile_prefix_len = tmp ? tmp - name + 1 : 0;
1004+
if (depfile_prefix_len + 1 > sizeof(depfile_path))
1005+
return -1;
1006+
1007+
strncpy(depfile_path, name, depfile_prefix_len);
1008+
depfile_path[depfile_prefix_len] = 0;
1009+
10051010
conf_read_simple(name, S_DEF_AUTO);
10061011
sym_calc_value(modules_sym);
10071012

0 commit comments

Comments
 (0)