From 4b8a963938ed4648cb70d09fae8663818a9feee8 Mon Sep 17 00:00:00 2001 From: Karel Bilek Date: Mon, 19 Feb 2018 00:41:34 +0100 Subject: [PATCH] emulator: add docker build --- Dockerfile.emulator | 17 +++++++++++++++++ build-emulator.sh | 20 ++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 Dockerfile.emulator create mode 100755 build-emulator.sh diff --git a/Dockerfile.emulator b/Dockerfile.emulator new file mode 100644 index 0000000..f8c3dad --- /dev/null +++ b/Dockerfile.emulator @@ -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 diff --git a/build-emulator.sh b/build-emulator.sh new file mode 100755 index 0000000..8946969 --- /dev/null +++ b/build-emulator.sh @@ -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"