Martin Roth | b7f92a0 | 2022-11-13 15:27:08 -0700 | [diff] [blame] | 1 | From 2a44aa33d6506a29b14d9c429410ad582d1d6636 Mon Sep 17 00:00:00 2001 |
| 2 | From: Martin Roth <gaumless@gmail.com> |
| 3 | Date: Sun, 13 Nov 2022 15:20:57 -0700 |
| 4 | Subject: [PATCH] util/kconfig: Move Kconfig deps back into build/config |
| 5 | |
| 6 | revert commit 1b9e740a8 (kconfig: fix failing to generate auto.conf) [1] |
| 7 | |
| 8 | The above change caused all of the enabled kconfig options to be written |
| 9 | into the top level build directory. We don't want that, so go back to |
| 10 | the old behavior for the coreboot tree. |
| 11 | |
| 12 | [1] https://web.archive.org/web/20220316120807/https://github.com/torvalds/linux/commit/1b9e740a81f91ae338b29ed70455719804957b80 |
| 13 | |
| 14 | Signed-off-by: Martin Roth <gaumless@gmail.com> |
| 15 | Change-Id: I2904f69a5d85337ad0a6b48590ccd4b4a6e38b70 |
| 16 | --- |
| 17 | util/kconfig/confdata.c | 20 +++++++++++--------- |
| 18 | 1 file changed, 11 insertions(+), 9 deletions(-) |
| 19 | |
Nicholas Chin | 6e902bc | 2022-11-20 11:00:42 -0700 | [diff] [blame] | 20 | Index: kconfig/confdata.c |
| 21 | =================================================================== |
| 22 | --- kconfig.orig/confdata.c |
| 23 | +++ kconfig/confdata.c |
Patrick Georgi | 7761237 | 2024-03-13 13:01:21 +0100 | [diff] [blame^] | 24 | @@ -244,6 +244,13 @@ static const char *conf_get_rustccfg_nam |
Patrick Georgi | 7f93aa4 | 2023-11-20 17:58:40 +0100 | [diff] [blame] | 25 | return name ? name : "include/generated/rustc_cfg"; |
Martin Roth | b7f92a0 | 2022-11-13 15:27:08 -0700 | [diff] [blame] | 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; |
Patrick Georgi | 7761237 | 2024-03-13 13:01:21 +0100 | [diff] [blame^] | 38 | @@ -1099,19 +1106,19 @@ static int conf_write_autoconf_cmd(const |
Martin Roth | b7f92a0 | 2022-11-13 15:27:08 -0700 | [diff] [blame] | 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; |
Nicholas Chin | 8ef2f7c | 2022-11-23 10:18:32 -0700 | [diff] [blame] | 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 | + */ |
Martin Roth | b7f92a0 | 2022-11-13 15:27:08 -0700 | [diff] [blame] | 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 | |