From 6f7525a5b35e373dc4496cd4c6af4e61cb3b534c Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 10 Jul 2025 03:15:18 +0100 Subject: cache coreboot builds in elf/ again This was a problem when I did it before, because individual target builds weren't automatically re-compiled when needed. The recent design improvements in lbmk enable this to be done again. Cached images in elf/ have no payloads, so they are a liability, therefore they are padded by one byte to prevent flashing. This solves the problem that the previous caching had. With this change, modifying payloads can be tested without needing to re-build coreboot each time. The cached coreboot builds are also automatically re-built when needed, which is another improvement this time, compared to the last time coreboot builds were cached in this manner. Signed-off-by: Leah Rowe --- include/lib.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'include/lib.sh') diff --git a/include/lib.sh b/include/lib.sh index 911d9c4d..6fc3bd1e 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -95,6 +95,24 @@ findpath() done } +pad_one_byte() +{ + paddedfile="`mktemp`" || err "mktemp pad_one_byte" + x_ cp "$1" "$paddedfile" + cat "$paddedfile" config/data/coreboot/0 > "$1" || err "!pad $1"; : + x_ rm "$paddedfile" +} + +unpad_one_byte() +{ + xromsize="$(expr $(stat -c '%s' "$1") - 1)" || err "!int" + [ $xromsize -lt 524288 ] && err "too small, $xromsize: $1" + + unpaddedfile="`mktemp`" || err "mktemp unpad_one_byte" + x_ dd if="$1" of="$unpaddedfile" bs=$xromsize count=1 + x_ mv "$unpaddedfile" "$1" +} + fx_() { fd="`mktemp`" && x_ rm -f "$fd" && x_ touch "$fd" -- cgit v1.2.1