summaryrefslogtreecommitdiff
path: root/fw/sign.sh
blob: 17fd61d130ad1ed96a3e38a9b9782540e13127f1 (plain)
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
#!/bin/sh


# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.


set -euf


ROOT="$(dirname "$0")"
MCUBOOT="${ROOT}/zephyrproject/bootloader/mcuboot"
IMGTOOL="${MCUBOOT}/scripts/imgtool.py"
INPUT="${ROOT}/../build/fw/zephyr/iot-contact-application.bin"
OUTPUT="${INPUT}.signed"


if test $# -ne 1
then
	echo "Please provide the path to the MCUboot signing key as single argument."
	exit 1
fi

key="$1"

python $IMGTOOL sign \
	--version 0.0.0 \
	--header-size 0x200 \
	--slot-size 0xc0000 \
	--key "${key}" \
	"${INPUT}" \
	"${OUTPUT}" > /dev/null

echo "${OUTPUT}"