1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 23:48:12 +00:00
trezor-firmware/build-docker.sh

33 lines
836 B
Bash
Raw Normal View History

#!/bin/sh
2017-11-04 00:56:05 +00:00
set -e
if [ "$1" = "--gcc_source" ]; then
2018-10-12 12:13:39 +00:00
TOOLCHAIN_FLAVOR=src
shift
else
2018-10-12 12:13:39 +00:00
TOOLCHAIN_FLAVOR=linux
fi
2018-10-12 12:13:39 +00:00
IMAGE=trezor-core-build.$TOOLCHAIN_FLAVOR
2017-11-04 00:56:05 +00:00
TAG=${1:-master}
REPOSITORY=${2:-trezor}
PRODUCTION=${PRODUCTION:-0}
if [ "$REPOSITORY" = "local" ]; then
REPOSITORY=file:///local/
else
REPOSITORY=https://github.com/$REPOSITORY/trezor-core.git
fi
2017-11-04 00:56:05 +00:00
2018-10-12 12:13:39 +00:00
docker build -t $IMAGE --build-arg TOOLCHAIN_FLAVOR=$TOOLCHAIN_FLAVOR .
2018-10-23 10:00:42 +00:00
mkdir -p $(pwd)/build-docker
docker run -t -v $(pwd):/local -v $(pwd)/build-docker:/build:z --user="$(stat -c "%u:%g" .)" $IMAGE /bin/sh -c "\
cd /tmp && \
git clone $REPOSITORY trezor-core && \
2017-11-04 00:56:05 +00:00
cd trezor-core && \
ln -s /build build &&
git checkout $TAG && \
git submodule update --init --recursive && \
PRODUCTION=$PRODUCTION make clean vendor build_boardloader build_bootloader build_firmware"