1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-15 20:19:23 +00:00

emulator: add docker build

This commit is contained in:
Karel Bilek 2018-02-19 00:41:34 +01:00 committed by Pavol Rusnak
parent 7376b97ee6
commit 4b8a963938
2 changed files with 37 additions and 0 deletions

17
Dockerfile.emulator Normal file
View File

@ -0,0 +1,17 @@
# initialize from the image
FROM debian:9
# install build tools and dependencies
RUN dpkg --add-architecture i386 && \
apt-get update && \
apt-get install -y \
build-essential curl unzip git python3 python3-pip gcc-arm-none-eabi libnewlib-arm-none-eabi libsdl2-dev:i386 libsdl2-image-dev:i386 gcc-multilib
ENV PROTOBUF_VERSION=3.4.0
RUN curl -LO "https://github.com/google/protobuf/releases/download/v${PROTOBUF_VERSION}/protoc-${PROTOBUF_VERSION}-linux-x86_64.zip"
RUN unzip "protoc-${PROTOBUF_VERSION}-linux-x86_64.zip" -d /usr
RUN pip3 install "protobuf==${PROTOBUF_VERSION}" ecdsa
RUN ln -s python3 /usr/bin/python

20
build-emulator.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
set -e
IMAGE=trezor-mcu-build-emulator
TAG=${1:-master}
ELFFILE=build/trezor-emulator-$TAG
docker build -f Dockerfile.emulator -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 -C vendor/nanopb/generator/proto && \
make -C firmware/protob && \
EMULATOR=1 make && \
EMULATOR=1 make -C emulator && \
EMULATOR=1 make -C firmware && \
cp firmware/trezor.elf /$ELFFILE"