Matt DeVillier has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/61615 )
Change subject: util/chromeos/crosfirmware: Fix handling of newer boards ......................................................................
util/chromeos/crosfirmware: Fix handling of newer boards
Wile historically there was a unique recovery image for each Chrome OS board/HWID (with matching names), this is no longer the case. Now, multiple boards share a single recovery image, so adjust how the proper recovery image is determined, and how the coreboot image is extracted from it.
Test: successfully extract coreboot images for older 1:1 boards (e.g. CAVE) and newer 1:N boards (e.g. DROBIT)
Change-Id: If478aa6eadea3acf3ee9d4c5fa266acd72c99b7a Signed-off-by: Matt DeVillier matt.devillier@gmail.com --- M util/chromeos/crosfirmware.sh 1 file changed, 21 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/15/61615/1
diff --git a/util/chromeos/crosfirmware.sh b/util/chromeos/crosfirmware.sh index 25c88fa..f912753 100755 --- a/util/chromeos/crosfirmware.sh +++ b/util/chromeos/crosfirmware.sh @@ -84,13 +84,28 @@ _unpacked=$( mktemp -d )
echo "Extracting coreboot image" - sh $_shellball --sb_extract $_unpacked > /dev/null + if ! sh $_shellball --unpack $_unpacked > /dev/null 2>&1; then + sh $_shellball --sb_extract $_unpacked > /dev/null 2>&1 + fi
- _version=$( cat $_unpacked/VERSION | grep BIOS\ version: | \ + if [ -d $_unpacked/models/ ]; then + _version=$( cat $_unpacked/VERSION | grep -e Model.*$_board -A5 \ + | grep "BIOS (RW) version:" | cut -f2 -d: | tr -d \ ) + if [ "$_version" == "" ]; then + _version=$( cat $_unpacked/VERSION | grep -e Model.*$_board -A5 \ + | grep "BIOS version:" | cut -f2 -d: | tr -d \ ) + fi + _bios_image=$(grep "IMAGE_MAIN" $_unpacked/models/$_board/setvars.sh | cut -f2 -d") + else + _version=$( cat $_unpacked/VERSION | grep BIOS\ version: | \ cut -f2 -d: | tr -d \ ) - - cp $_unpacked/bios.bin coreboot-$_version.bin - rm -r "$_unpacked" + _bios_image=bios.bin + fi + if cp $_unpacked/$_bios_image coreboot-$_version.bin; then + echo "Extracted coreboot-$_version.bin" + fi + rm -rf "$_unpacked" + rm $_shellball }
do_one_board() @@ -135,7 +150,7 @@ get_inventory $CONF
echo Processing board $BOARD - eval $( grep $BOARD $CONF | grep '(url=|file=)' ) + eval $( grep -i $BOARD -A8 $CONF | grep '(url=|file=)' ) do_one_board $BOARD $url $file
rm "$CONF"