summaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
authorJF <jf@codingfield.com>2020-09-26 15:09:24 (GMT)
committerGitea <gitea@fake.local>2020-09-26 15:09:24 (GMT)
commitb6a910e52ed98b662e6586f45cfe9c6997f8f158 (patch)
treed74185cbf682cde40e5de5bfa2f620ae201565a9 /docker
parentbe05997272b7b1d1b25b122c8162ac6f4c1c12a2 (diff)
parent3e612e79ba82bac69258094d468c996c41b29612 (diff)
Merge branch 'develop' of JF/PineTime into master
Diffstat (limited to 'docker')
-rw-r--r--docker/README.md2
-rw-r--r--docker/arm64/Dockerfile17
-rwxr-xr-xdocker/build.sh12
-rwxr-xr-xdocker/post_build.sh.in16
-rw-r--r--docker/x86_64/Dockerfile17
5 files changed, 64 insertions, 0 deletions
diff --git a/docker/README.md b/docker/README.md
new file mode 100644
index 0000000..71ad258
--- /dev/null
+++ b/docker/README.md
@@ -0,0 +1,2 @@
+Docker images and build script for building the project using Docker.
+See [this page for more info](../doc/buildWithDocker.md). \ No newline at end of file
diff --git a/docker/arm64/Dockerfile b/docker/arm64/Dockerfile
new file mode 100644
index 0000000..87c5c62
--- /dev/null
+++ b/docker/arm64/Dockerfile
@@ -0,0 +1,17 @@
+FROM ubuntu:18.04
+
+ARG USER_ID
+ARG GROUP_ID
+
+RUN addgroup --gid $GROUP_ID user
+RUN adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID user
+
+RUN apt-get update -qq && apt-get install -y wget unzip cmake make build-essential git python3 python3-pip libffi-dev libssl-dev python3-dev
+RUN wget -q https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2020q2/gcc-arm-none-eabi-9-2020-q2-update-aarch64-linux.tar.bz2 -O - | tar -xj -C /opt/
+RUN wget -q https://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v15.x.x/nRF5_SDK_15.3.0_59ac345.zip && unzip -q nRF5_SDK_15.3.0_59ac345.zip -d /opt/ && rm nRF5_SDK_15.3.0_59ac345.zip
+
+RUN git clone https://github.com/JuulLabs-OSS/mcuboot.git /opt/mcuboot && pip3 install -r /opt/mcuboot/scripts/requirements.txt
+RUN pip3 install adafruit-nrfutil
+
+USER user
+CMD ["/sources/docker/build.sh"]
diff --git a/docker/build.sh b/docker/build.sh
new file mode 100755
index 0000000..fcb819a
--- /dev/null
+++ b/docker/build.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+export LC_ALL=C.UTF-8
+export LANG=C.UTF-8
+set -x
+
+mkdir /sources/build
+cd /sources/build
+
+cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=/opt/gcc-arm-none-eabi-9-2020-q2-update -DNRF5_SDK_PATH=/opt/nRF5_SDK_15.3.0_59ac345 -DUSE_OPENOCD=1 ../
+make -j$(nproc)
+
+sh /sources/docker/post_build.sh
diff --git a/docker/post_build.sh.in b/docker/post_build.sh.in
new file mode 100755
index 0000000..0665100
--- /dev/null
+++ b/docker/post_build.sh.in
@@ -0,0 +1,16 @@
+#!/bin/sh
+export LC_ALL=C.UTF-8
+export LANG=C.UTF-8
+set -x
+
+mkdir -p /sources/build/output
+/opt/mcuboot/scripts/imgtool.py create --align 4 --version 1.0.0 --header-size 32 --slot-size 475136 --pad-header /sources/build/src/pinetime-mcuboot-app-@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.bin /sources/build/output/image-@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.bin
+adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application /sources/build/output/image-@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.bin /sources/build/output/dfu-@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.zip
+
+cp /sources/build/src/*.bin /sources/build/output/
+cp /sources/build/src/*.hex /sources/build/output/
+cp /sources/build/src/*.out /sources/build/output/
+cp /sources/build/src/*.map /sources/build/output/
+cp /sources/bootloader/bootloader-5.0.4.bin /sources/build/output/bootloader.bin
+
+
diff --git a/docker/x86_64/Dockerfile b/docker/x86_64/Dockerfile
new file mode 100644
index 0000000..7899c8c
--- /dev/null
+++ b/docker/x86_64/Dockerfile
@@ -0,0 +1,17 @@
+FROM ubuntu:18.04
+
+ARG USER_ID
+ARG GROUP_ID
+
+RUN addgroup --gid $GROUP_ID user
+RUN adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID user
+
+RUN apt-get update -qq && apt-get install -y wget unzip cmake make build-essential git python3 python3-pip
+RUN wget -q https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2020q2/gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz -O - | tar -xj -C /opt/
+RUN wget -q https://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v15.x.x/nRF5_SDK_15.3.0_59ac345.zip && unzip -q nRF5_SDK_15.3.0_59ac345.zip -d /opt/ && rm nRF5_SDK_15.3.0_59ac345.zip
+
+RUN git clone https://github.com/JuulLabs-OSS/mcuboot.git /opt/mcuboot && pip3 install -r /opt/mcuboot/scripts/requirements.txt
+RUN pip3 install adafruit-nrfutil
+
+USER user
+CMD ["/sources/docker/build.sh"] \ No newline at end of file