[coreboot-gerrit] New patch to review for coreboot: board_status.sh: Be smarter about cbfstool usage

David Hendricks (dhendrix@chromium.org) gerrit at coreboot.org
Thu Nov 19 23:20:44 CET 2015


David Hendricks (dhendrix at chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/12490

-gerrit

commit 60d4766b875af1082ac43712922d9cbef956b631
Author: David Hendricks <dhendrix at chromium.org>
Date:   Thu Nov 19 13:08:51 2015 -0800

    board_status.sh: Be smarter about cbfstool usage
    
    This changes how we build and use cbfstool:
    1. If build/cbfstool exists, use it.
    2. Otherwise, try util/cbfstool/cbfstool.
    3. As a last resort, build it and clean it when we're done.
    
    Hopefully this will resolve issues people have had with permissions
    and reduce overhead of building cbfstool when not necessary.
    
    Change-Id: I5de6581ca765e5a8420b101a5865ddd633334b9c
    Signed-off-by: David Hendricks <dhendrix at chromium.org>
---
 util/board_status/board_status.sh | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/util/board_status/board_status.sh b/util/board_status/board_status.sh
index 93a14f1..d0bd1ba 100755
--- a/util/board_status/board_status.sh
+++ b/util/board_status/board_status.sh
@@ -218,13 +218,24 @@ fi
 # Results will be placed in a temporary location until we're ready to upload.
 # If the user does not wish to upload, results will remain in /tmp.
 tmpdir=$(mktemp -d --tmpdir coreboot_board_status.XXXXXXXX)
-tmpcfg=$(mktemp coreboot_config.XXXXXX)
 
-cbfstool_cmd="build/cbfstool"
-if test ! -x build/cbfstool; then
-	make -C util/cbfstool/ && cp util/cbfstool/cbfstool build/cbfstool
+#
+# Obtain coreboot config by running cbfstool on the ROM image
+#
+tmpcfg=$(mktemp coreboot_config.XXXXXX)
+cbfstool_cmd="util/cbfstool/cbfstool"
+do_clean_cbfstool=0
+if test -e $cbfstool_cmd; then
+	if test ! -x $cbfstool_cmd; then
+		echo "Cannot execute $cbfstool_cmd."
+		exit $EXIT_FAILURE
+	fi
+else
+	make -C util/cbfstool/
+	do_clean_cbfstool=1
 fi
 test_cmd $LOCAL "$cbfstool_cmd"
+
 $cbfstool_cmd $COREBOOT_IMAGE extract -n config -f ${tmpdir}/config.txt
 mv ${tmpdir}/config.txt ${tmpdir}/config.short.txt
 cp ${tmpdir}/config.short.txt ${tmpcfg}
@@ -233,6 +244,10 @@ mv ${tmpcfg} ${tmpdir}/config.txt
 rm -f ${tmpcfg}.old
 $cbfstool_cmd $COREBOOT_IMAGE print > ${tmpdir}/cbfs.txt
 
+if test $do_clean_cbfstool -eq 1; then
+	make -C util/cbfstool clean
+fi
+
 # Obtain board and revision info to form the directory structure:
 # <vendor>/<board>/<revision>/<timestamp>
 mainboard_dir="$(grep CONFIG_MAINBOARD_DIR ${tmpdir}/config.txt | awk -F '"' '{ print $2 }')"



More information about the coreboot-gerrit mailing list