Skip to content

Commit 8017b40

Browse files
committed
chore: create hid-flash wrapper
Since aarch64 support, it requires to wrap to the correct binary. Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent 81b5afb commit 8017b40

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

hid-flash.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/sh -
2+
#
3+
# Use the correct hid-flash program based on the host
4+
#
5+
6+
# Get the directory where the script is running.
7+
DIR=$(cd "$(dirname "$0")" && pwd)
8+
UNAME_OS="$(uname -s)"
9+
case "${UNAME_OS}" in
10+
Linux*)
11+
# Choose program by arch
12+
UNAME_ARCH="$(uname -m)"
13+
case "${UNAME_ARCH}" in
14+
x86_64)
15+
HID_FLASH=${DIR}/linux/x86_64/hid-flash
16+
;;
17+
aarch64|arm64)
18+
HID_FLASH=${DIR}/linux/aarch64/hid-flash
19+
;;
20+
*)
21+
echo "Unsupported Linux architecture: ${UNAME_ARCH}."
22+
exit 1
23+
;;
24+
esac
25+
;;
26+
Darwin*)
27+
HID_FLASH=${DIR}/macosx/hid-flash
28+
;;
29+
Windows*)
30+
HID_FLASH=${DIR}/win/hid-flash.exe
31+
;;
32+
*)
33+
echo "Unknown host OS: ${UNAME_OS}."
34+
exit 1
35+
;;
36+
esac
37+
38+
# Not found!
39+
if [ ! -x "${HID_FLASH}" ]; then
40+
echo "$0: error: cannot find ${HID_FLASH}" >&2
41+
exit 2
42+
fi
43+
44+
# Pass all parameters through
45+
"${HID_FLASH}" "$@"

0 commit comments

Comments
 (0)