From 489a587f4aa470128bcaaa98ea22e5a35a996a6f Mon Sep 17 00:00:00 2001 From: Tim Gover Date: Mon, 21 Oct 2024 18:18:18 +0100 Subject: [PATCH] image: Add release-fw helper script Add a simple utility script to help with the internal CI flow. --- imager/release-fw | 71 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100755 imager/release-fw diff --git a/imager/release-fw b/imager/release-fw new file mode 100755 index 0000000..2c73150 --- /dev/null +++ b/imager/release-fw @@ -0,0 +1,71 @@ +#!/bin/sh + +set -e + +script_dir=$(cd "$(dirname "$0")" && pwd) + +die() { + echo "$@" >&2 + exit 1 +} + +cleanup() { + if [ -d "${TMP_DIR}" ]; then + rm -rf "${TMP_DIR}" + fi +} + +trap cleanup EXIT +TMP_DIR=$(mktemp -d) +tarball="$1" + +do_release() { + ( + branch="${1}" + chip_id="${2}" + + if [ "${chip_id}" != "2711" ] && [ "${chip_id}" != "2712" ]; then + die "Invalid chip_id \"${branch}\" chip_id must be \"2711\" or \"2712\"" + fi + cd "${TMP_DIR}/${chip_id}" + + fw_out="${script_dir}/../firmware-${chip_id}/${branch}" + + pwd + TS="$(strings recovery.bin | grep BUILD_TIMESTAMP | sed 's/.*=//g')" + DATE="$(date -u -d@${TS} +%Y-%m-%d)" + echo "recovery.bin ${TS} ${DATE}" + cp -fv recovery.bin "${fw_out}" + + TS="$(strings pieeprom.bin | grep BUILD_TIMESTAMP | sed 's/.*=//g')" + DATE="$(date -u -d@${TS} +%Y-%m-%d)" + echo "pieeprom.bin ${TS} ${DATE}" + cp -fv pieeprom.bin "${fw_out}/pieeprom-${DATE}.bin" + ) +} + +usage() +{ +cat <