meta-google: gbmc-update: Only extract firmware for our machine
Some machines will have multiple firmware packages assigned that could
brick the BMC. Only extract the firmware for a machine that matches the
expected machine.
Change-Id: Ibfdbe4614ee471a9f208c3d1a31d65a9fef06747
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/meta-google/recipes-phosphor/flash/gbmc-update/75-gbmc-upgrade.sh b/meta-google/recipes-phosphor/flash/gbmc-update/75-gbmc-upgrade.sh
index d08575a..1ed4b9a 100644
--- a/meta-google/recipes-phosphor/flash/gbmc-update/75-gbmc-upgrade.sh
+++ b/meta-google/recipes-phosphor/flash/gbmc-update/75-gbmc-upgrade.sh
@@ -38,13 +38,18 @@
return 1
fi
+ # Determine the path of the image file for the correct machine
+ # Our netboot can serve us images for multiple models
+ local machine
+ machine="$(source /etc/os-release && echo "$OPENBMC_TARGET_MACHINE")" || return
+
# Ensure some sane output file limit
# Currently no BMC image is larger than 64M
ulimit -H -f $((96 * 1024 * 1024)) || return
timeout=$((SECONDS + 120))
while (( SECONDS < timeout )); do
local st=(0)
- wget -q -O - "$bootfile_url" | tar -xC "$tmpdir" || st=("${PIPESTATUS[@]}")
+ wget -q -O - "$bootfile_url" | tar -xC "$tmpdir" "firmware-gbmc/$machine" || st=("${PIPESTATUS[@]}")
(( st[0] != 0 )) || break
(shopt -s nullglob dotglob; rm -rf -- "${tmpdir:?}"/*)
sleep 5