-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·92 lines (83 loc) · 3.18 KB
/
entrypoint.sh
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/sh -e
echo "********************************************************************************"
echo "* This action is deprecated ! *
echo "* Please switch to a workflow using container rather than a step running in a *
echo "* container: *
echo "* https://github.com/SiemaApplications/zephyr-arm-docker-image/ *
echo "********************************************************************************"
MANIFESTDIR="${INPUT_MANIFESTDIR:?INPUT_MANIFESTDIR must be specified}"
INIT="${INPUT_INIT:-false}"
UPDATE="${INPUT_UPDATE:-false}"
TWISTER="${INPUT_TWISTER:-false}"
BUILD="${INPUT_BUILD:-false}"
SIGN="${INPUT_SIGN:-false}"
if [ "${INIT}" = "true" ]; then
set -x
west init -l ${MANIFESTDIR}
set +x
fi
if [ "${UPDATE}" = "true" ]; then
UPDATE_EXTRA_ARGS=${INPUT_UPDATE_EXTRA_ARGS}
set -x
west update ${UPDATE_EXTRA_ARGS}
set +x
fi
if [ "${BUILD}" = "true" ]; then
BUILD_BOARD="${INPUT_BUILD_BOARD:?Missing board target name}"
BUILD_APP_DIR="${INPUT_BUILD_APP_DIR:?Missing application directory}"
BUILD_DIR="${INPUT_BUILD_DIR:-build/${BUILD_BOARD}/$(basename ${BUILD_APP_DIR})}"
CMAKE_EXTRA_ARGS="${INPUT_CMAKE_EXTRA_ARGS}"
set -x
west build -p auto -b "${BUILD_BOARD}" -d "${BUILD_DIR}" "${BUILD_APP_DIR}" \
-- ${CMAKE_EXTRA_ARGS}
set +x
fi
if [ "${TWISTER}" = "true" ]; then
TWISTER_APP_DIR="${INPUT_TWISTER_APP_DIR:?Missing application directory}"
if [ ! -z "${INPUT_TWISTER_BOARD_ROOT}" ]; then
if [ -d ${INPUT_TWISTER_BOARD_ROOT} ]; then
TWISTER_ARGS="-A ${INPUT_TWISTER_BOARD_ROOT}"
else
echo "Error: INPUT_TWISTER_BOARD_ROOT: invalid directory ${INPUT_TWISTER_BOARD_ROOT}"
exit 1
fi
fi
if [ ! -z ${INPUT_TWISTER_BUILD_DIR} ]; then
TWISTER_ARGS="${TWISTER_ARGS} -O ${INPUT_TWISTER_BUILD_DIR}"
fi
if [ ! -z ${INPUT_TWISTER_BOARD} ]; then
TWISTER_ARGS="${TWISTER_ARGS} -p ${INPUT_TWISTER_BOARD}"
fi
set -x
./zephyr/scripts/twister ${TWISTER_ARGS} \
-T "${TWISTER_APP_DIR}" \
${INPUT_TWISTER_EXTRA_ARGS}
set +x
fi
# Signing manifest shall contain on each line path of the application to sign
# and its version separated by a ';':
# path/to/app; 1.0
# path/to/app2; 1.1
if [ "${SIGN}" = "true" ]; then
SIGN_KEY="${INPUT_SIGN_KEY:-bootloader/mcuboot/root-rsa-2048.pem}"
SIGN_ALIGNMENT="${INPUT_SIGN_ALIGNMENT:-32}"
SIGN_MANIFEST="${INPUT_SIGN_MANIFEST:?Missing signing manifest}"
if [ ! -f ${SIGN_MANIFEST} ]; then
echo "Error: INPUT_SIGN_MANIFEST: invalid file ${SIGN_MANIFEST}"
exit 1
fi
while read l; do
APP=$(echo ${l} | cut -d';' -f 1)
VERSION=$(echo ${l} | cut -d';' -f 2)
if [ ! -d "${APP}" ]; then
echo "Error: ${APP} invalid directory"
exit 1
fi
set -x
west --verbose sign -d ${APP} -t imgtool \
-p bootloader/mcuboot/scripts/imgtool.py \
-- --key ${SIGN_KEY} --align ${SIGN_ALIGNMENT} --pad \
--version ${VERSION}
set +x
done <${SIGN_MANIFEST}
fi