From 1153bc3b6c607c5c941f362c8cd56c4967c02134 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 21 Dec 2023 15:52:03 +0000 Subject: [PATCH] mrc.sh: don't run the shellball. use unzip. the shellball (for extracting the coreboot rom, to get at mrc.bin) contains lines that are not posix-friendly. specifically, the "local" command is used, and this is not defined for posix sh. the shellball is essentially just a bunch of shell functions that compress/decompress the zip file, containing the firmware update. you can modify the files and re-run the shellball to recompress, though lbmk just uses the decompress function. as pointed out by Nicholas Chin, it is possible to just run "unzip" directly on the update, to get at bios.bin. we don't really need all the extra checks performed by the shellball, so let's just bypass it altogether. Signed-off-by: Leah Rowe --- include/mrc.sh | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/include/mrc.sh b/include/mrc.sh index 929aed7a..d4c94e5d 100755 --- a/include/mrc.sh +++ b/include/mrc.sh @@ -22,7 +22,7 @@ extract_mrc() extract_coreboot ) || err "mrc download/extract failure" - "${cbfstool}" "${appdir}/"coreboot-*.bin extract -n mrc.bin \ + "${cbfstool}" "${appdir}/"bios.bin extract -n mrc.bin \ -f "${_dest}" -r RO_SECTION || err "extract_mrc: cbfstool ${_dest}" } @@ -59,18 +59,5 @@ extract_coreboot() printf "Extracting coreboot image\n" [ -f "${SHELLBALL}" ] || \ err "extract_coreboot: shellball missing in google cros image" - sh "${SHELLBALL}" --unpack "${_unpacked}" || err "shellball, ${SHELLBALL}" - - # TODO: audit the f* out of that shellball, for each mrc version. - # it has to be updated for each mrc update. we should ideally - # implement the functionality ourselves. - - [ -f "${_unpacked}/VERSION" ] || \ - err "extract_coreboot: VERSION file missing on google coreboot rom" - - _version=$( cat "${_unpacked}/VERSION" | grep BIOS\ version: | \ - cut -f2 -d: | tr -d \ ) - - cp "${_unpacked}/bios.bin" "coreboot-${_version}.bin" || \ - err "!cp unpacked, ${_unpacked}/bios.bin, coreboot-${_version}.rom" + x_ unzip "${SHELLBALL}" }