diff options
author | David Hendricks <dhendrix@chromium.org> | 2015-11-19 13:08:51 -0800 |
---|---|---|
committer | Martin Roth <martinroth@google.com> | 2016-02-18 04:46:24 +0100 |
commit | 9f54297fab19cafc19e569c8da7485d34463797f (patch) | |
tree | 7f54ba908d4475919ecc15ebe018121269a5ac55 /util/board_status | |
parent | f43e51d444a261055c954abf4d6565bc62d4a72f (diff) |
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@chromium.org>
Reviewed-on: https://review.coreboot.org/12490
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Diffstat (limited to 'util/board_status')
-rwxr-xr-x | util/board_status/board_status.sh | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/util/board_status/board_status.sh b/util/board_status/board_status.sh index 1fb599ed3b..95bc536ce2 100755 --- a/util/board_status/board_status.sh +++ b/util/board_status/board_status.sh @@ -218,13 +218,27 @@ 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) +# Obtain coreboot config by running cbfstool on the ROM image. cbfstool may +# already exist in build/ or util/cbfstool/, but if not then we'll build it +# now and clean it when we're done. cbfstool_cmd="build/cbfstool" -if test ! -x build/cbfstool; then - make -C util/cbfstool/ && cp util/cbfstool/cbfstool build/cbfstool +do_clean_cbfstool=0 +if [ ! -x $cbfstool_cmd ]; then + cbfstool_cmd="util/cbfstool/cbfstool" + if [ -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 fi test_cmd $LOCAL "$cbfstool_cmd" + +tmpcfg=$(mktemp coreboot_config.XXXXXX) echo "Extracting config.txt from build/coreboot.rom" $cbfstool_cmd build/coreboot.rom extract -n config -f "${tmpdir}/config.txt" >/dev/null 2>&1 mv "${tmpdir}/config.txt" "${tmpdir}/config.short.txt" @@ -244,6 +258,10 @@ if [ -n "$(echo $rom_contents | grep payload_version)" ]; then fi md5sum -b build/coreboot.rom > "${tmpdir}/rom_checksum.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 }')" |