From 36d7418afa42fbb2dccc435860f3d95721fb9652 Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Fri, 22 Apr 2016 11:10:03 +0200 Subject: [PATCH] chromeos: Ensure that the last file in FW_MAIN is not also the first one In the case where one of the FW_MAIN regions is empty, the last file (empty) will also appear to be first and have a zero offset, making head complain. This is a very borderline use case, since the FW_MAIN_ regions should have been filled previously, but an extra check doesn't hurt. Change-Id: I15491c5b4a5e7d1f9fb369cc5fa4e3875e2dad3b Signed-off-by: Paul Kocialkowski Reviewed-on: https://review.coreboot.org/14472 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- src/vendorcode/google/chromeos/Makefile.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vendorcode/google/chromeos/Makefile.inc b/src/vendorcode/google/chromeos/Makefile.inc index 0ae6fb0429..2b579d1587 100644 --- a/src/vendorcode/google/chromeos/Makefile.inc +++ b/src/vendorcode/google/chromeos/Makefile.inc @@ -138,7 +138,7 @@ $(obj)/FW_MAIN_%.bin: $(obj)/coreboot.rom tail -1 | \ sed "s,^(empty)[[:space:]]\(0x[0-9a-f]*\)\tnull\t.*$$,\1," \ > $@.tmp.size - if [ -n "$$(cat $@.tmp.size)" ]; then \ + if [ -n "$$(cat $@.tmp.size)" ] && [ $$( printf "%d" $$(cat $@.tmp.size)) -gt 0 ]; then \ head -c $$( printf "%d" $$(cat $@.tmp.size)) $@.tmp > $@.tmp2 && \ mv $@.tmp2 $@; \ else \