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 <contact@paulk.fr>
Reviewed-on: https://review.coreboot.org/14472
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Paul Kocialkowski 2016-04-22 11:10:03 +02:00 committed by Martin Roth
parent 0cf7acc688
commit 36d7418afa
1 changed files with 1 additions and 1 deletions

View File

@ -138,7 +138,7 @@ $(obj)/FW_MAIN_%.bin: $(obj)/coreboot.rom
tail -1 | \ tail -1 | \
sed "s,^(empty)[[:space:]]\(0x[0-9a-f]*\)\tnull\t.*$$,\1," \ sed "s,^(empty)[[:space:]]\(0x[0-9a-f]*\)\tnull\t.*$$,\1," \
> $@.tmp.size > $@.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 && \ head -c $$( printf "%d" $$(cat $@.tmp.size)) $@.tmp > $@.tmp2 && \
mv $@.tmp2 $@; \ mv $@.tmp2 $@; \
else \ else \