From 4924e422750474482087b202724f9cfa32de047d Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Wed, 23 Nov 2022 18:20:32 -0800 Subject: build: Combine "savedefconfig" and "stripped config" in CBFS `config` The intention of CB:69710 was that the expanded config file introduced there would be a strict superset of the old version and could be used in all the same cases. This is generally true except for a small oversight: if a boolean Kconfig is `default y`, but was manually set to `n` by the user, the new `config` file does not include a line for it. Running `make olddefconfig` on such a file will again introduce the option as `y`. It turns out that `make olddefconfig` actually parses those "load-bearing comments" in that case. This patch fixes the problem by also generating the minimal defconfig (like before CB:69710), and then just appending the non-comment lines from the full config that don't appear in it already. This ensures that any "load-bearing comments" in the defconfig remain in the file and the result of Kconfig utilities regenerating a full config from there will again be the same as before CB:69710. In addition, it clearly separates the "minimal defconfig" part of the file from the rest, making it easy for people to extract that if they need it; while also keeping all the config values in one file to make it easy to grep for a certain value. Also eliminate that random backslash in the recipe that doesn't seem to have any good reason to exist and was probably a typo to begin with. Signed-off-by: Julius Werner Change-Id: I52ba5d20d3536498fae79d529acf7135f97ef1a8 Reviewed-on: https://review.coreboot.org/c/coreboot/+/69955 Tested-by: build bot (Jenkins) Reviewed-by: Jakub Czapiga Reviewed-by: Yu-Ping Wu --- Makefile.inc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Makefile.inc') diff --git a/Makefile.inc b/Makefile.inc index 3e21bc1df99b..5cd13ba6f4c8 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -306,7 +306,7 @@ cbfs-files-processor-nvramtool= \ mv $(2).tmp $(2)) ####################################################################### -# Reduce a .config file by removing lines about unset booleans +# Reduce a .config file by removing lines about default unset booleans # arg1: input # arg2: output define cbfs-files-processor-config @@ -314,8 +314,12 @@ define cbfs-files-processor-config +printf " CREATE $(2) (from $(1))\n"; \ printf "# This image was built using coreboot " > $(2).tmp && \ grep "\" $(obj)/build.h |cut -d\" -f2 >> $(2).tmp && \ - sed -e '/^CONFIG/!d' $(1) >> $(2).tmp && \ - \mv -f $(2).tmp $(2)) + $(MAKE) DOTCONFIG=$(1) DEFCONFIG=$(2).tmp2 savedefconfig && \ + cat $(2).tmp2 >> $(2).tmp && \ + printf "# End of defconfig. Derivable values start here.\n" >> $(2).tmp && \ + grep "^CONFIG" $(1) | grep -F -v -f $(2).tmp2 >> $(2).tmp && \ + rm -f $(2).tmp2 && \ + mv -f $(2).tmp $(2)) endef ####################################################################### -- cgit v1.2.3