From bdc49b2de3145a06c2cb33aaf2355b6bf1dd552d Mon Sep 17 00:00:00 2001 From: Reka Norman Date: Tue, 21 Sep 2021 14:29:24 +1000 Subject: [PATCH] lib/Makefile.inc: Generate placeholder spd.bin in lib/Makefile.inc When a new variant is created, it needs to have a path to its SPD binary defined. Currently, this is done by setting SPD_SOURCES to a placeholder SPD file, which just contains zero bytes. To remove the need for a placeholder file, automatically generate a single-byte spd.bin in lib/Makefile.inc when SPD_SOURCES is set to the marker value 'placeholder'. BUG=b:191776301 TEST=Change cappy/memory/Makefile to `SPD_SOURCES = placeholder`. Build and check that spd.bin contains a single zero byte. Signed-off-by: Reka Norman Change-Id: I11f8f9b7ea3bc32aa5c7a617558572a5c1c74c72 Reviewed-on: https://review.coreboot.org/c/coreboot/+/57795 Tested-by: build bot (Jenkins) Reviewed-by: Tim Wawrzynczak Reviewed-by: Furquan Shaikh --- spd/spd-placeholder.hex | 32 -------------------------------- src/lib/Makefile.inc | 20 ++++++++++++-------- 2 files changed, 12 insertions(+), 40 deletions(-) delete mode 100644 spd/spd-placeholder.hex diff --git a/spd/spd-placeholder.hex b/spd/spd-placeholder.hex deleted file mode 100644 index 1a5be53170..0000000000 --- a/spd/spd-placeholder.hex +++ /dev/null @@ -1,32 +0,0 @@ -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc index 7b21c80dc7..8da875e255 100644 --- a/src/lib/Makefile.inc +++ b/src/lib/Makefile.inc @@ -366,15 +366,19 @@ $(LIB_SPD_BIN): $(LIB_SPD_DEPS) (echo "HAVE_SPD_IN_CBFS is set but SPD_SOURCES is empty" && exit 1) test -n "$(LIB_SPD_DEPS)" || \ (echo "SPD_SOURCES is set but no SPD file was found" && exit 1) - for f in $(LIB_SPD_DEPS); do \ - if [ ! -f $$f ]; then \ - echo "File not found: $$f" >&2; \ - exit 1; \ - fi; \ - for c in $$(cat $$f | grep --binary-files=text -v ^#); \ - do printf $$(printf '\\%o' 0x$$c); \ + if [ "$(SPD_SOURCES)" = "placeholder" ]; then \ + printf '\0'; \ + else \ + for f in $(LIB_SPD_DEPS); do \ + if [ ! -f $$f ]; then \ + echo "File not found: $$f" >&2; \ + exit 1; \ + fi; \ + for c in $$(cat $$f | grep --binary-files=text -v ^#); \ + do printf $$(printf '\\%o' 0x$$c); \ + done; \ done; \ - done > $@ + fi > $@ cbfs-files-y += spd.bin spd.bin-file := $(LIB_SPD_BIN)