summaryrefslogtreecommitdiffstats
path: root/Makefile.inc
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2022-11-16 17:48:46 -0800
committerMartin Roth <martin.roth@amd.corp-partner.google.com>2022-11-18 17:19:44 +0000
commit4924cdb9ace88336cc37506a745ebef210f20767 (patch)
tree40cbd8b878659f77bdc8e94e119dcd25f89e48b3 /Makefile.inc
parentbe585d2ece60e04683a0e8377b3fdad5ac3e37cb (diff)
downloadcoreboot-4924cdb9ace88336cc37506a745ebef210f20767.tar.gz
coreboot-4924cdb9ace88336cc37506a745ebef210f20767.tar.bz2
coreboot-4924cdb9ace88336cc37506a745ebef210f20767.zip
build: List all Kconfigs in CBFS `config` file, compress it
The coreboot build system automatically adds a `config` file to CBFS that lists the exact Kconfig configuration that this image was built with. This is useful to reproduce a build after the fact or to check whether support for a specific feature is enabled in the image. However, the file is currently generated using the `savedefconfig` command to Kconfig, which generates the minimal .config file that is needed to produce the required config in a coreboot build. This is fine for reproduction, but bad when you want to check if a certain config was enabled, since many configs get enabled by default or pulled in through another config's `select` statement and thus don't show up in the defconfig. This patch tries to fix that second use case by instead including the full .config instead. In order to save some space, we can remove all comments (e.g. `# CONFIG_XXX is not set`) from the file, which still makes it easy to test for a specific config (if it's in the file you can extract the right value, if not you can assume it was set to `n`). We can also LZMA compress it since this file is never read by firmware itself and only intended for later re-extraction via cbfstool, which always has LZMA support included. On a sample Trogdor device the existing (uncompressed) `config` file takes up 519 bytes in CBFS, whereas the new (compressed) file after this patch will take up 1832 bytes -- still a small amount that should hopefully not break the bank for anyone. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: I5259ec6f932cdc5780b8843f46dd476da9d19728 Reviewed-on: https://review.coreboot.org/c/coreboot/+/69710 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com> Reviewed-by: Jakub Czapiga <jacz@semihalf.com> Reviewed-by: Martin Roth <martin.roth@amd.corp-partner.google.com>
Diffstat (limited to 'Makefile.inc')
-rw-r--r--Makefile.inc13
1 files changed, 6 insertions, 7 deletions
diff --git a/Makefile.inc b/Makefile.inc
index b4c2cdfe926e..ef565c2fc98f 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -305,17 +305,15 @@ cbfs-files-processor-nvramtool= \
mv $(2).tmp $(2))
#######################################################################
-# Reduce a .config file to its minimal representation
+# Reduce a .config file by removing lines about unset booleans
# arg1: input
# arg2: output
-define cbfs-files-processor-defconfig
- $(eval $(2): $(1) $(obj)/build.h $(objutil)/kconfig/conf; \
+define cbfs-files-processor-config
+ $(eval $(2): $(1) $(obj)/build.h; \
+printf " CREATE $(2) (from $(1))\n"; \
printf "# This image was built using coreboot " > $(2).tmp && \
grep "\<COREBOOT_VERSION\>" $(obj)/build.h |cut -d\" -f2 >> $(2).tmp && \
- $(MAKE) DOTCONFIG=$(1) DEFCONFIG=$(2).tmp2 savedefconfig && \
- cat $(2).tmp2 >> $(2).tmp && \
- rm -f $(2).tmp2 && \
+ sed -e '/^CONFIG/!d' $(1) >> $(2).tmp && \
\mv -f $(2).tmp $(2))
endef
@@ -1212,8 +1210,9 @@ vgaroms/seavgabios.bin-file := $(CONFIG_PAYLOAD_VGABIOS_FILE)
vgaroms/seavgabios.bin-type := raw
cbfs-files-$(CONFIG_INCLUDE_CONFIG_FILE) += config
-config-file := $(DOTCONFIG):defconfig
+config-file := $(DOTCONFIG):config
config-type := raw
+config-compression := LZMA
cbfs-files-$(CONFIG_INCLUDE_CONFIG_FILE) += revision
revision-file := $(obj)/build.h