-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgenerate_fw_imgs.sh
More file actions
executable file
·39 lines (31 loc) · 1.07 KB
/
generate_fw_imgs.sh
File metadata and controls
executable file
·39 lines (31 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/sh
FW_PREFIX="koryuu-fw"
TARGETS="hex hex_ntp debug debug_ntp debug2 debug2_ntp no_panic no_autoreset"
ARCHIVE_NAME="${FW_PREFIX}_images.zip"
HEX_TARGETS=""
SEVENZIP_CANDIDATES="7z 7za"
SEVENZIP=""
for cnd in ${SEVENZIP_CANDIDATES}; do
SEVENZIP="$(which ${cnd})"
[ -n "${SEVENZIP}" -a -x "${SEVENZIP}" ] && break
SEVENZIP=""
done
[ -z "${SEVENZIP}" ] && echo "7zip not found!" && exit 1
COMPRESS="${SEVENZIP} a -bb1 -tzip -mx=9 ${ARCHIVE_NAME}"
for target in ${TARGETS}; do
[ "x${target}" = "xhex" ] && target="default"
[ "x${target}" = "xhex_ntp" ] && target="ntp"
HEX_TARGETS="${HEX_TARGETS} ${FW_PREFIX}_${target}.hex"
done
rm -f ${HEX_TARGETS} "${ARCHIVE_NAME}"
# Ugly repetition of the HEX_TARGETS logic... ideas anyone?
for target in ${TARGETS}; do
make "build_${target}" || exit 1
[ "x${target}" = "xhex" ] && target="default"
[ "x${target}" = "xhex_ntp" ] && target="ntp"
mv "${FW_PREFIX}.hex" "${FW_PREFIX}_${target}.hex" || exit 1
done
rm -f "${FW_PREFIX}.hex"
ln -s "${FW_PREFIX}_default.hex" "${FW_PREFIX}.hex"
ls -al ${HEX_TARGETS}
${COMPRESS} ${HEX_TARGETS}