util/chromeos/crosfirmware: Improve matching when scanning manifest file

To ensure we find the correct firmware image, match against `$BOARD":`
rather than just `$BOARD`. This fixes an issue where another board (b1)
using the same firmware build or name as the one we are searching for,
causes the grep matching to return empty strings.

TEST=successfully extract the firmware image for CAREENA, which
previously failed.

Change-Id: I2f2a71f0b033938aafc1fd27e2996fe319614b3c
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/85935
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
This commit is contained in:
Matt DeVillier 2025-01-10 20:13:18 -06:00
commit 9bb805e0c9

View file

@ -114,8 +114,8 @@ extract_coreboot() {
_bios_image=$(grep -m1 "image" "$_unpacked/manifest.json" | cut -f4 -d'"')
fi
elif [ -f "$_unpacked/manifest.json" ]; then
_version=$(grep -m1 -A1 "$BOARD" "$_unpacked/manifest.json" | grep "host" | cut -f12 -d'"')
_bios_image=$(grep -m1 -A3 "$BOARD" "$_unpacked/manifest.json" | grep "image" | cut -f4 -d'"')
_version=$(grep -m1 -A1 "$BOARD\":" "$_unpacked/manifest.json" | grep "host" | cut -f12 -d'"')
_bios_image=$(grep -m1 -A3 "$BOARD\":" "$_unpacked/manifest.json" | grep "image" | cut -f4 -d'"')
else
_version=$(cat $_unpacked/VERSION | grep BIOS\ version: |
cut -f2 -d: | tr -d \ )