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 <leah@libreboot.org>
9020vga
Leah Rowe 2023-12-21 15:52:03 +00:00
parent 28dfd91ab3
commit 1153bc3b6c
1 changed files with 2 additions and 15 deletions

View File

@ -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}"
}