Skip to content

Commit 489a587

Browse files
committed
image: Add release-fw helper script
Add a simple utility script to help with the internal CI flow.
1 parent f2e314d commit 489a587

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

imager/release-fw

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
script_dir=$(cd "$(dirname "$0")" && pwd)
6+
7+
die() {
8+
echo "$@" >&2
9+
exit 1
10+
}
11+
12+
cleanup() {
13+
if [ -d "${TMP_DIR}" ]; then
14+
rm -rf "${TMP_DIR}"
15+
fi
16+
}
17+
18+
trap cleanup EXIT
19+
TMP_DIR=$(mktemp -d)
20+
tarball="$1"
21+
22+
do_release() {
23+
(
24+
branch="${1}"
25+
chip_id="${2}"
26+
27+
if [ "${chip_id}" != "2711" ] && [ "${chip_id}" != "2712" ]; then
28+
die "Invalid chip_id \"${branch}\" chip_id must be \"2711\" or \"2712\""
29+
fi
30+
cd "${TMP_DIR}/${chip_id}"
31+
32+
fw_out="${script_dir}/../firmware-${chip_id}/${branch}"
33+
34+
pwd
35+
TS="$(strings recovery.bin | grep BUILD_TIMESTAMP | sed 's/.*=//g')"
36+
DATE="$(date -u -d@${TS} +%Y-%m-%d)"
37+
echo "recovery.bin ${TS} ${DATE}"
38+
cp -fv recovery.bin "${fw_out}"
39+
40+
TS="$(strings pieeprom.bin | grep BUILD_TIMESTAMP | sed 's/.*=//g')"
41+
DATE="$(date -u -d@${TS} +%Y-%m-%d)"
42+
echo "pieeprom.bin ${TS} ${DATE}"
43+
cp -fv pieeprom.bin "${fw_out}/pieeprom-${DATE}.bin"
44+
)
45+
}
46+
47+
usage()
48+
{
49+
cat <<EOF
50+
Usage:
51+
release-fw: release.tar default|latest 2711 2712
52+
EOF
53+
}
54+
55+
[ -f "$tarball" ] || die "Release tarball ${1} not found"
56+
cd "${TMP_DIR}"
57+
tar -vxf "${tarball}"
58+
59+
branch="${2}"
60+
if [ "${branch}" != "default" ] && [ "${branch}" != "latest" ]; then
61+
die "Invalid branch \"${branch}\" branch must be \"default\" or \"latest\""
62+
fi
63+
64+
if [ -n "${3}" ]; then
65+
do_release "${branch}" "${3}"
66+
fi
67+
68+
if [ -n "${4}" ]; then
69+
do_release "${branch}" "${4}"
70+
fi
71+

0 commit comments

Comments
 (0)