Nicholas Chin has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/69450 )
Change subject: util/kconfig: Re-add KCONFIG_SPLITCONFIG functionality ......................................................................
util/kconfig: Re-add KCONFIG_SPLITCONFIG functionality
After commit 7eb03cb657 (util/kconfig: Uprev to Linux 5.17's kconfig) kconfig creates many empty files in build/ that have the same name as enabled configs. Previously these were created in build/config. It seems like this commit removed KCONFIG_SPLITHEADER functionality, which set the directory these files should be output to. Upon further investigation it seems like this was never in upstream kconfig and likely was coreboot specific. Moving this functionality to a patch should prevent it from being lost during uprevs to Linux's kconfig.
Change-Id: I4dd36edb0c36d7679896fde6f84e8471589d83a1 Signed-off-by: Nicholas Chin nic.c3.14@gmail.com --- M util/kconfig/confdata.c A util/kconfig/patches/0014-util-kconfig-Add-KCONFIG_SPLITCONFIG-functionality.patch M util/kconfig/patches/series 3 files changed, 85 insertions(+), 7 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/50/69450/1
diff --git a/util/kconfig/confdata.c b/util/kconfig/confdata.c index 95fb960..ae8d66a 100644 --- a/util/kconfig/confdata.c +++ b/util/kconfig/confdata.c @@ -230,6 +230,12 @@ return name ? name : "include/generated/autoconf.h"; }
+static const char *conf_get_autobase_name(void) +{ + char *name = getenv("KCONFIG_SPLITCONFIG"); + return name ? name : "include/config/"; +} + static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) { char *p2; @@ -1028,14 +1034,15 @@ struct symbol *sym; int res, i;
- name = conf_get_autoconfig_name(); - tmp = strrchr(name, '/'); - depfile_prefix_len = tmp ? tmp - name + 1 : 0; - if (depfile_prefix_len + 1 > sizeof(depfile_path)) - return -1; + /* + * Upstream kconfig sets depfile_path based on the directory prefix + * of the autoconfig path, but coreboot overrides this using the + * KCONFIG_SPLITCONFIG environment variable + */ + strncpy(depfile_path, conf_get_autobase_name(), sizeof(depfile_path) - 1); + depfile_prefix_len = strlen(depfile_path);
- strncpy(depfile_path, name, depfile_prefix_len); - depfile_path[depfile_prefix_len] = 0; + name = conf_get_autoconfig_name();
conf_read_simple(name, S_DEF_AUTO); sym_calc_value(modules_sym); diff --git a/util/kconfig/patches/0014-util-kconfig-Add-KCONFIG_SPLITCONFIG-functionality.patch b/util/kconfig/patches/0014-util-kconfig-Add-KCONFIG_SPLITCONFIG-functionality.patch new file mode 100644 index 0000000..d31db1d --- /dev/null +++ b/util/kconfig/patches/0014-util-kconfig-Add-KCONFIG_SPLITCONFIG-functionality.patch @@ -0,0 +1,51 @@ +From 13c4c77ea3334c2c4bcffd0f5e3605a272babc5e Mon Sep 17 00:00:00 2001 +From: Nicholas Chin nic.c3.14@gmail.com +Date: Fri, 11 Nov 2022 12:40:35 -0700 +Subject: [PATCH] util/kconfig: Add KCONFIG_SPLITCONFIG functionality + +Change-Id: I4dd36edb0c36d7679896fde6f84e8471589d83a1 +Signed-off-by: Nicholas Chin nic.c3.14@gmail.com +--- + util/kconfig/confdata.c | 21 ++++++++++++++------- + 1 file changed, 14 insertions(+), 7 deletions(-) + +Index: kconfig/confdata.c +=================================================================== +--- kconfig.orig/confdata.c ++++ kconfig/confdata.c +@@ -230,6 +230,12 @@ static const char *conf_get_autoheader_n + return name ? name : "include/generated/autoconf.h"; + } + ++static const char *conf_get_autobase_name(void) ++{ ++ char *name = getenv("KCONFIG_SPLITCONFIG"); ++ return name ? name : "include/config/"; ++} ++ + static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) + { + char *p2; +@@ -1028,14 +1034,15 @@ static int conf_touch_deps(void) + struct symbol *sym; + int res, i; + +- name = conf_get_autoconfig_name(); +- tmp = strrchr(name, '/'); +- depfile_prefix_len = tmp ? tmp - name + 1 : 0; +- if (depfile_prefix_len + 1 > sizeof(depfile_path)) +- return -1; ++ /* ++ * Upstream kconfig sets depfile_path based on the directory prefix ++ * of the autoconfig path, but coreboot overrides this using the ++ * KCONFIG_SPLITCONFIG environment variable ++ */ ++ strncpy(depfile_path, conf_get_autobase_name(), sizeof(depfile_path) - 1); ++ depfile_prefix_len = strlen(depfile_path); + +- strncpy(depfile_path, name, depfile_prefix_len); +- depfile_path[depfile_prefix_len] = 0; ++ name = conf_get_autoconfig_name(); + + conf_read_simple(name, S_DEF_AUTO); + sym_calc_value(modules_sym); diff --git a/util/kconfig/patches/series b/util/kconfig/patches/series index 13b684b..1812285 100644 --- a/util/kconfig/patches/series +++ b/util/kconfig/patches/series @@ -9,3 +9,4 @@ 0009-util-kconfig-Allow-emitting-false-booleans-into-kconfig-output.patch 0010-reenable-source-in-choice.patch 0013-util-kconfig-detect-ncurses-on-FreeBSD.patch +0014-util-kconfig-Add-KCONFIG_SPLITCONFIG-functionality.patch