summaryrefslogtreecommitdiff
path: root/include/mrc.sh
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-10-19 23:36:56 +0100
committerLeah Rowe <leah@libreboot.org>2023-10-19 23:36:56 +0100
commit0b98c9b00c6b99940555cff25f7c6858745a560c (patch)
treee79ed28e199df51146d6d850c224ee6b2e518638 /include/mrc.sh
parent8b6e44a104680412967acd6ac760945f8233abf2 (diff)
minor code cleanup in shell scripts
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include/mrc.sh')
-rwxr-xr-xinclude/mrc.sh26
1 files changed, 11 insertions, 15 deletions
diff --git a/include/mrc.sh b/include/mrc.sh
index 4ff067a9..3c6ac24e 100755
--- a/include/mrc.sh
+++ b/include/mrc.sh
@@ -4,7 +4,7 @@
# Modifications in this version are Copyright 2021 and 2023 Leah Rowe.
# Original copyright detailed in repo: https://review.coreboot.org/coreboot/
-eval "$(setvars "" MRC_url MRC_url_bkup MRC_hash MRC_board)"
+eval "$(setvars "" MRC_url MRC_url_bkup MRC_hash MRC_board ROOTFS SHELLBALL)"
extract_mrc()
{
@@ -12,14 +12,14 @@ extract_mrc()
[ -z "${CONFIG_MRC_FILE}" ] && \
err "extract_mrc $MRC_hash: CONFIG_MRC_FILE not set"
- _file="${MRC_url##*/}"
- _file="${_file%.zip}"
+ ROOTFS="root-a.ext2"
+ SHELLBALL="chromeos-firmwareupdate-${MRC_board}"
(
x_ cd "${appdir}"
- extract_partition ROOT-A "${_file}" root-a.ext2
- extract_shellball root-a.ext2 chromeos-firmwareupdate-${MRC_board}
- extract_coreboot chromeos-firmwareupdate-${MRC_board}
+ extract_partition
+ extract_shellball
+ extract_coreboot
)
x_ "${cbfstool}" "${appdir}/"coreboot-*.bin extract -n mrc.bin \
@@ -28,9 +28,9 @@ extract_mrc()
extract_partition()
{
- NAME=${1}
- FILE=${2}
- ROOTFS=${3}
+ NAME="ROOT-A"
+ FILE="${MRC_url##*/}"
+ FILE="${FILE%.zip}"
_bs=1024
printf "Extracting ROOT-A partition\n"
@@ -46,9 +46,6 @@ extract_partition()
extract_shellball()
{
- ROOTFS=${1}
- SHELLBALL=${2}
-
printf "Extracting chromeos-firmwareupdate\n"
printf "cd /usr/sbin\ndump chromeos-firmwareupdate ${SHELLBALL}\nquit" \
| debugfs "${ROOTFS}" || err "extract_shellball: debugfs"
@@ -56,13 +53,12 @@ extract_shellball()
extract_coreboot()
{
- _shellball=${1}
_unpacked=$( mktemp -d )
printf "Extracting coreboot image\n"
- [ -f "${_shellball}" ] || \
+ [ -f "${SHELLBALL}" ] || \
err "extract_coreboot: shellball missing in google cros image"
- x_ sh "${_shellball}" --unpack "${_unpacked}"
+ x_ sh "${SHELLBALL}" --unpack "${_unpacked}"
# TODO: audit the f* out of that shellball, for each mrc version.
# it has to be updated for each mrc update. we should ideally