forked from bithd/bithd-mcu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-bootloader.sh
More file actions
executable file
·30 lines (28 loc) · 847 Bytes
/
Copy pathbuild-bootloader.sh
File metadata and controls
executable file
·30 lines (28 loc) · 847 Bytes
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
#!/bin/bash
set -e
IMAGE=trezor-mcu-build
TAG=${1:-master}
BINFILE=build/bootloader-$TAG.bin
ELFFILE=build/bootloader-$TAG.elf
docker build -t $IMAGE .
docker run -t -v $(pwd)/build:/build:z $IMAGE /bin/sh -c "\
git clone https://github.com/trezor/trezor-mcu && \
cd trezor-mcu && \
git checkout $TAG && \
git submodule update --init && \
make -C vendor/libopencm3 && \
make && \
make -C bootloader align && \
cp bootloader/bootloader.bin /$BINFILE && \
cp bootloader/bootloader.elf /$ELFFILE"
/usr/bin/env python -c "
from __future__ import print_function
import hashlib
import sys
fn = sys.argv[1]
data = open(fn, 'rb').read()
print('\n\n')
print('Filename :', fn)
print('Fingerprint :', hashlib.sha256(hashlib.sha256(data).digest()).hexdigest())
print('Size : %d bytes (out of %d maximum)' % (len(data), 32768))
" $BINFILE