download/mrc: stricter error handling
the cbfstool command within subshell now also exits with non-zero status, if it fails (most likely because extraction failed, for some reason, of the coreboot rom image for running through it)fsdg20230625
parent
7b36ffc1e5
commit
557272fa39
|
@ -51,8 +51,8 @@ main()
|
||||||
printf "Downloading Intel MRC blobs\n"
|
printf "Downloading Intel MRC blobs\n"
|
||||||
|
|
||||||
check_existing && exit 0
|
check_existing && exit 0
|
||||||
build_dependencies
|
build_dependencies || fail "could not build dependencies"
|
||||||
fetch_mrc
|
fetch_mrc || fail "could not fetch mrc.bin"
|
||||||
}
|
}
|
||||||
|
|
||||||
check_existing()
|
check_existing()
|
||||||
|
@ -74,16 +74,17 @@ check_existing()
|
||||||
build_dependencies()
|
build_dependencies()
|
||||||
{
|
{
|
||||||
if [ ! -d "${cbdir}/" ]; then
|
if [ ! -d "${cbdir}/" ]; then
|
||||||
./download coreboot default
|
./download coreboot default || return 1
|
||||||
fi
|
fi
|
||||||
if [ ! -f "${cbfstool}" ]; then
|
if [ ! -f "${cbfstool}" ]; then
|
||||||
./build module cbutils default
|
./build module cbutils default || return 1
|
||||||
fi
|
fi
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch_mrc()
|
fetch_mrc()
|
||||||
{
|
{
|
||||||
mkdir -p mrc/haswell/
|
mkdir -p mrc/haswell/ || return 1
|
||||||
|
|
||||||
(
|
(
|
||||||
cd mrc/haswell/
|
cd mrc/haswell/
|
||||||
|
@ -102,22 +103,25 @@ fetch_mrc()
|
||||||
extract_coreboot chromeos-firmwareupdate-${_board}
|
extract_coreboot chromeos-firmwareupdate-${_board}
|
||||||
|
|
||||||
../../${cbfstool} coreboot-*.bin extract -f mrc.bin \
|
../../${cbfstool} coreboot-*.bin extract -f mrc.bin \
|
||||||
-n mrc.bin -r RO_SECTION
|
-n mrc.bin -r RO_SECTION \
|
||||||
|
|| fail "Could not fetch mrc.bin"
|
||||||
rm -f "chromeos-firmwareupdate-${_board}" coreboot-*.bin \
|
rm -f "chromeos-firmwareupdate-${_board}" coreboot-*.bin \
|
||||||
"${_file}" "root-a.ext2"
|
"${_file}" "root-a.ext2"
|
||||||
|
|
||||||
printf "\n\nmrc.bin saved to ${_mrc_complete}\n\n"
|
printf "\n\nmrc.bin saved to ${_mrc_complete}\n\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
download_image()
|
download_image()
|
||||||
{
|
{
|
||||||
_url=${1}
|
url=${1}
|
||||||
_file=${2}
|
_file=${2}
|
||||||
_sha1sum=${3}
|
_sha1sum=${3}
|
||||||
|
|
||||||
echo "Downloading recovery image"
|
echo "Downloading recovery image"
|
||||||
curl "$_url" > "$_file.zip"
|
curl "$url" > "$_file.zip"
|
||||||
if [ "$(sha1sum ${_file}.zip | awk '{print $1}')" = "${_sha1sum}" ]
|
if [ "$(sha1sum ${_file}.zip | awk '{print $1}')" = "${_sha1sum}" ]
|
||||||
then
|
then
|
||||||
unzip -q "${_file}.zip"
|
unzip -q "${_file}.zip"
|
||||||
|
|
Loading…
Reference in New Issue