summaryrefslogtreecommitdiff
path: root/resources/scripts/blobs
diff options
context:
space:
mode:
Diffstat (limited to 'resources/scripts/blobs')
-rwxr-xr-xresources/scripts/blobs/download63
1 files changed, 42 insertions, 21 deletions
diff --git a/resources/scripts/blobs/download b/resources/scripts/blobs/download
index 6c1e9e67..78bb42b7 100755
--- a/resources/scripts/blobs/download
+++ b/resources/scripts/blobs/download
@@ -2,9 +2,9 @@
# SPDX-FileCopyrightText: 2022 Caleb La Grange <thonkpeasant@protonmail.com>
# SPDX-FileCopyrightText: 2022 Ferass El Hafidi <vitali64pmemail@protonmail.com>
+# SPDX-FileCopyrightText: 2023 Leah Rowe <info@minifree.org>
# SPDX-License-Identifier: GPL-3.0-only
-needs=""
board="${1}"
# A shorthand for each board, to avoid duplicating configs per flash size
board_short=${board%%_*mb}
@@ -89,7 +89,7 @@ Download_needed(){
for need in ${needs}; do
case ${need} in
*ME*)
- Extract_me || _failed="${_failed} me"
+ Download_me || _failed="${_failed} me"
;;
*MRC*)
./download mrc || _failed="${_failed} mrc"
@@ -102,40 +102,61 @@ Download_needed(){
fi
}
-Extract_me(){
+Download_me() {
+ printf "Downloading neutered ME for board: `%s`\n" ${board}
+
+ Fetch_update || return 1
+ Extract_me || return 1
+
+ return 0
+}
+
+Fetch_update() {
+ printf "Fetching vendor update for board: `%s`\n" ${board}
+
_me_destination=${CONFIG_ME_BIN_PATH#../../}
- if [ -f "${_me_destination}" ]; then
- printf 'me already downloaded\n'
- return 0
+ if [ -z "${dl_url+x}" ]; then
+ printf "No vendor update specified for board: `%s`\n" ${board}
+ return 1
fi
- if [ -z "${dl_url+x}" ]; then
- printf 'no me download available for this board\n'
+ Vendor_checksum blobs/me.exe || \
+ curl ${dl_url} > blobs/me.exe || curl ${dl_url_bkup} > blobs/me.exe
+
+ Vendor_checksum blobs/me.exe || Fail \
+ "Cannot guarantee intergity of vendor update for board: `${board}`"
+
+ return 0
+}
+
+Vendor_checksum() {
+ if [ ! -f "blobs/me.exe" ]; then
+ printf "Vendor update not found on disk for board: `%s`\n" ${board}
+ return 1
+ fi
+ if [ "$(sha1sum blobs/me.exe | awk '{print $1}')" != "${dl_hash}" ]; then
+ printf "Bad checksum on vendor update for board: `%s`\n" ${board}
+ rm blobs/me.exe
return 1
fi
+ return 0
+}
+
+Extract_me(){
+ printf "Extracting neutered ME for ${board}\n"
if [ ! -d "${_me_destination%/*}" ]; then
mkdir -p ${_me_destination%/*}
fi
-
- printf "Extracting neutered me for ${board}\n"
- # Delete old me downloads in case user is building for multiple boards
- if [ -f "blobs/me.exe" ]; then
- rm blobs/me.exe
- fi
-
if [ -d "blobs/app" ]; then
rm -r blobs/app
fi
- curl ${dl_url} > blobs/me.exe || curl ${dl_url_bkup} > blobs/me.exe
-
- if [ "$(sha1sum blobs/me.exe | awk '{print $1}')" != "${dl_hash}" ]; then
- printf 'checksum of downloaded me did not mactch\ncorrupted me downloaded or wrong me for board\n'
- rm blobs/me.exe
- return 1
+ if [ -f "${_me_destination}" ]; then
+ printf 'me already downloaded\n'
+ return 0
fi
printf 'extracting and stripping intel management engine\n'