[coreboot-gerrit] Change in coreboot[master]: vboot: use cbfstool truncate

Patrick Georgi (Code Review) gerrit at coreboot.org
Wed Sep 20 12:02:42 CEST 2017


Patrick Georgi has uploaded this change for review. ( https://review.coreboot.org/21609


Change subject: vboot: use cbfstool truncate
......................................................................

vboot: use cbfstool truncate

Instead of a shell based parser for cbfstool print -k output.

BUG=b:65853903
BRANCH=none
TEST=`abuild -x -t GOOGLE_KEVIN -p none` creates a valid-looking image.

Change-Id: I33b7e1c483a69e66e82541c09582be2a71356a10
Signed-off-by: Patrick Georgi <pgeorgi at google.com>
---
M src/vboot/Makefile.inc
1 file changed, 4 insertions(+), 10 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/09/21609/1

diff --git a/src/vboot/Makefile.inc b/src/vboot/Makefile.inc
index 0d6ce57..3128fae 100644
--- a/src/vboot/Makefile.inc
+++ b/src/vboot/Makefile.inc
@@ -239,17 +239,11 @@
 # in the keyblock, and coreboot's vboot code clips the region_device to match,
 # which prevents any potential extension attacks.
 $(obj)/FW_MAIN_%.bin: $(obj)/coreboot.rom
+	$(CBFSTOOL) $< truncate -r $(basename $(notdir $@)) > $@.tmp.size
 	$(CBFSTOOL) $< read -r $(basename $(notdir $@)) -f $@.tmp
-	$(CBFSTOOL) $(obj)/coreboot.rom print -k -r $(basename $(notdir $@)) | \
-		tail -1 | \
-		sed "s,^(empty)[[:space:]]\(0x[0-9a-f]*\)\tnull\t.*$$,\1," \
-		> $@.tmp.size
-	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 \
-		mv $@.tmp $@; \
-	fi
+	head -c $$( printf "%d" $$(cat $@.tmp.size)) $@.tmp > $@.tmp2
+	mv $@.tmp2 $@
+	rm -f $@.tmp $@.tmp.size
 
 $(obj)/VBLOCK_%.bin: $(obj)/FW_MAIN_%.bin $(FUTILITY)
 	$(FUTILITY) vbutil_firmware \

-- 
To view, visit https://review.coreboot.org/21609
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I33b7e1c483a69e66e82541c09582be2a71356a10
Gerrit-Change-Number: 21609
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Georgi <pgeorgi at google.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20170920/4e0b5565/attachment.html>


More information about the coreboot-gerrit mailing list