summaryrefslogtreecommitdiff
path: root/util/chromeos
diff options
context:
space:
mode:
authorMatt DeVillier <matt.devillier@gmail.com>2022-02-03 19:18:29 -0600
committerFelix Held <felix-coreboot@felixheld.de>2022-02-11 23:56:47 +0000
commite42731603e683c614ba67b8fd46d7f98ed7cbc9e (patch)
treeccffd4d0c1a01004e37695a307fcb4d191cd73a9 /util/chromeos
parentb8258bd2b97d138a1589b07f53d839ed7a838eb5 (diff)
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> Reviewed-on: https://review.coreboot.org/c/coreboot/+/61615 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'util/chromeos')
-rwxr-xr-xutil/chromeos/crosfirmware.sh28
1 files changed, 22 insertions, 6 deletions
diff --git a/util/chromeos/crosfirmware.sh b/util/chromeos/crosfirmware.sh
index 25c88fa346..92018e9d24 100755
--- a/util/chromeos/crosfirmware.sh
+++ b/util/chromeos/crosfirmware.sh
@@ -84,13 +84,29 @@ extract_coreboot()
_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 -m 1 -e Model.*$_board -A5 \
+ | grep "BIOS (RW) version:" | cut -f2 -d: | tr -d \ )
+ if [ "$_version" == "" ]; then
+ _version=$( cat $_unpacked/VERSION | grep -m 1 -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 +151,7 @@ elif [ "$BOARD" != "" ]; then
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"