1From 2a44aa33d6506a29b14d9c429410ad582d1d6636 Mon Sep 17 00:00:00 2001 2From: Martin Roth <[email protected]> 3Date: Sun, 13 Nov 2022 15:20:57 -0700 4Subject: [PATCH] util/kconfig: Move Kconfig deps back into build/config 5 6revert commit 1b9e740a8 (kconfig: fix failing to generate auto.conf) [1] 7 8The above change caused all of the enabled kconfig options to be written 9into the top level build directory. We don't want that, so go back to 10the old behavior for the coreboot tree. 11 12[1] https://web.archive.org/web/20220316120807/https://github.com/torvalds/linux/commit/1b9e740a81f91ae338b29ed70455719804957b80 13 14Signed-off-by: Martin Roth <[email protected]> 15Change-Id: I2904f69a5d85337ad0a6b48590ccd4b4a6e38b70 16--- 17 util/kconfig/confdata.c | 20 +++++++++++--------- 18 1 file changed, 11 insertions(+), 9 deletions(-) 19 20Index: kconfig/confdata.c 21=================================================================== 22--- kconfig.orig/confdata.c 23+++ kconfig/confdata.c 24@@ -244,6 +244,13 @@ static const char *conf_get_rustccfg_nam 25 return name ? name : "include/generated/rustc_cfg"; 26 } 27 28+static const char *conf_get_autobase_name(void) 29+{ 30+ char *name = getenv("KCONFIG_SPLITCONFIG"); 31+ 32+ return name ? name : "include/config/"; 33+} 34+ 35 static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) 36 { 37 char *p2; 38@@ -1099,19 +1106,19 @@ static int conf_write_autoconf_cmd(const 39 40 static int conf_touch_deps(void) 41 { 42- const char *name, *tmp; 43+ const char *name; 44 struct symbol *sym; 45 int res, i; 46 47- name = conf_get_autoconfig_name(); 48- tmp = strrchr(name, '/'); 49- depfile_prefix_len = tmp ? tmp - name + 1 : 0; 50- if (depfile_prefix_len + 1 > sizeof(depfile_path)) 51- return -1; 52- 53- strncpy(depfile_path, name, depfile_prefix_len); 54- depfile_path[depfile_prefix_len] = 0; 55+ /* 56+ * Upstream Kconfig sets depfile_path based on the directory 57+ * prefix of the autoconfig path, but coreboot overrides this 58+ * using the KCONFIG_SPLITCONFIG environment variable 59+ */ 60+ strcpy(depfile_path, conf_get_autobase_name()); 61+ depfile_prefix_len = strlen(depfile_path); 62 63+ name = conf_get_autoconfig_name(); 64 conf_read_simple(name, S_DEF_AUTO); 65 sym_calc_value(modules_sym); 66 67