From a7df0a02799442ab38e1b365d4363cca6d93f029 Mon Sep 17 00:00:00 2001 From: Joe Eaves Date: Thu, 17 Dec 2020 13:12:06 +0000 Subject: Unify the Dockerfiles by fleshing out build.sh Script is written to handle it's own dependencies so it can be used within Docker or on the host system --- docker/Dockerfile | 37 ++++++++++++++++++++++++ docker/amd64/Dockerfile | 34 ---------------------- docker/arm64v8/Dockerfile | 37 ------------------------ docker/build.sh | 73 +++++++++++++++++++++++++++++++++++++++++++---- docker/entrypoint.sh | 7 +++++ docker/post_build.sh.in | 25 ++++++++++------ 6 files changed, 128 insertions(+), 85 deletions(-) create mode 100644 docker/Dockerfile delete mode 100644 docker/amd64/Dockerfile delete mode 100644 docker/arm64v8/Dockerfile create mode 100755 docker/entrypoint.sh (limited to 'docker') diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..8f56356c --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,37 @@ +FROM ubuntu:18.04 + +RUN \ + apt-get update -qq && \ + apt-get install -y \ +# x86_64 / generic packages + bash git gosu \ + cmake make build-essential \ + wget unzip \ + python3 python3-pip \ +# aarch64 packages + libffi-dev libssl-dev python3-dev \ + && rm -rf /var/lib/apt/lists/*; + +RUN pip3 install adafruit-nrfutil + +# build.sh knows how to compile +COPY build.sh /opt/ + +# Lets get each in a separate docker layer for better downloads +# GCC +RUN bash -c "source /opt/build.sh; GetGcc;" +# NrfSdk +RUN bash -c "source /opt/build.sh; GetNrfSdk;" +# McuBoot +RUN bash -c "source /opt/build.sh; GetMcuBoot;" + +# Set and arg and use it in the env for power to override at build AND runtime +ARG USER_ID=33333 +ARG GROUP_ID=33333 +ENV USER_ID $USER_ID +ENV GROUP_ID $GROUP_ID + +ENV SOURCES_DIR /sources +COPY entrypoint.sh /opt/ +ENTRYPOINT ["/opt/entrypoint.sh"] +CMD ["/opt/build.sh"] diff --git a/docker/amd64/Dockerfile b/docker/amd64/Dockerfile deleted file mode 100644 index 5f3c77ec..00000000 --- a/docker/amd64/Dockerfile +++ /dev/null @@ -1,34 +0,0 @@ -FROM amd64/ubuntu:18.04 - -ARG DEBIAN_FRONTEND=noninteractive -RUN apt-get update -qq \ - && apt-get install -y \ - build-essential \ - cmake \ - git \ - make \ - python3 \ - python3-pip \ - tar \ - unzip \ - wget \ - && rm -rf /var/cache/apt/* /var/lib/apt/lists/* - -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 \ - && tar -xjf gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz -C /opt \ - && rm gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz - -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 - -ARG PUID=1000 -ARG PGID=1000 -RUN groupadd --system --gid $PGID infinitime && useradd --system --uid $PUID --gid $PGID infinitime - -USER infinitime:infinitime -CMD ["/sources/docker/build.sh"] diff --git a/docker/arm64v8/Dockerfile b/docker/arm64v8/Dockerfile deleted file mode 100644 index cea2b837..00000000 --- a/docker/arm64v8/Dockerfile +++ /dev/null @@ -1,37 +0,0 @@ -FROM arm64v8/ubuntu:18.04 - -ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update -qq \ - && apt-get install -y \ - build-essential \ - cmake \ - git \ - libffi-dev \ - libssl-dev \ - make \ - python3 \ - python3-dev \ - python3-pip \ - tar \ - unzip \ - wget \ - && rm -rf /var/cache/apt/* /var/lib/apt/lists/* - -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 \ - && tar -xjf gcc-arm-none-eabi-9-2020-q2-update-aarch64-linux.tar.bz2 -C /opt \ - && rm gcc-arm-none-eabi-9-2020-q2-update-aarch64-linux.tar.bz2 - -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 - -ARG PUID=1000 -ARG PGID=1000 -RUN groupadd --system --gid $PGID infinitime && useradd --system --uid $PUID --gid $PGID infinitime - -USER infinitime:infinitime -CMD ["/sources/docker/build.sh"] diff --git a/docker/build.sh b/docker/build.sh index fcb819a6..1c697d40 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -1,12 +1,73 @@ -#!/bin/sh +#!/bin/bash +(return 0 2>/dev/null) && SOURCED="true" || SOURCED="false" export LC_ALL=C.UTF-8 export LANG=C.UTF-8 set -x +set -e -mkdir /sources/build -cd /sources/build +# Default locations if the var isn't already set +export TOOLS_DIR="${TOOLS_DIR:=/opt}" +export SOURCES_DIR="${SOURCES_DIR:=/sources}" +export BUILD_DIR="${BUILD_DIR:=$SOURCES_DIR/build}" +export OUTPUT_DIR="${OUTPUT_DIR:=$BUILD_DIR/output}" -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) +export BUILD_TYPE=${BUILD_TYPE:=Release} +export GCC_ARM_VER=${GCC_ARM_VER:="gcc-arm-none-eabi-9-2020-q2-update"} +export NRF_SDK_VER=${NRF_SDK_VER:="nRF5_SDK_15.3.0_59ac345"} -sh /sources/docker/post_build.sh +MACHINE="$(uname -m)" +[[ "$MACHINE" == "arm64" ]] && MACHINE="aarch64" + +main() { + local target="$1" + [[ ! -d "$TOOLS_DIR/$GCC_ARM_VER" ]] && GetGcc + [[ ! -d "$TOOLS_DIR/$NRF_SDK_VER" ]] && GetNrfSdk + [[ ! -d "$TOOLS_DIR/mcuboot" ]] && GetMcuBoot + + mkdir -p "$BUILD_DIR" + + CmakeGenerate + CmakeBuild "$target" + + if [[ "$DISABLE_POSTBUILD" != "true" ]]; then + source "$BUILD_DIR/post_build.sh" + fi +} + +GetGcc() { + GCC_SRC="$GCC_ARM_VER-$MACHINE-linux.tar.bz" + wget -q https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2020q2/$GCC_SRC -O - | tar -xj -C $TOOLS_DIR/ +} + +GetMcuBoot() { + git clone https://github.com/JuulLabs-OSS/mcuboot.git "$TOOLS_DIR/mcuboot" + pip3 install -r "$TOOLS_DIR/mcuboot/scripts/requirements.txt" +} + +GetNrfSdk() { + wget -q "https://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v15.x.x/$NRF_SDK_VER.zip" -O /tmp/$NRF_SDK_VER + unzip -q /tmp/$NRF_SDK_VER -d "$TOOLS_DIR/" + rm /tmp/$NRF_SDK_VER +} + +CmakeGenerate() { + # We can swap the CD and trailing SOURCES_DIR for -B and -S respectively + # once we go to newer CMake (Ubuntu 18.10 gives us CMake 3.10) + cd "$BUILD_DIR" + + cmake -G "Unix Makefiles" \ + -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ + -DUSE_OPENOCD=1 \ + -DARM_NONE_EABI_TOOLCHAIN_PATH="$TOOLS_DIR/$GCC_ARM_VER" \ + -DNRF5_SDK_PATH="$TOOLS_DIR/$NRF_SDK_VER" \ + "$SOURCES_DIR" + cmake -L -N . +} + +CmakeBuild() { + local target="$1" + [[ -n "$target" ]] && target="--target $target" + cmake --build "$BUILD_DIR" --config $BUILD_TYPE "$target" -- -j$(nproc) +} + +[[ $SOURCED == "false" ]] && main "$@" || echo "Sourced!" \ No newline at end of file diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100755 index 00000000..5adb88f5 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -e +## Create a user on-the-fly before running CMD +## This allows us to override at runtime, allowing use of a pre-built docker image +addgroup --gid $GROUP_ID user +adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID user +exec gosu user:user /bin/bash -c "$@" \ No newline at end of file diff --git a/docker/post_build.sh.in b/docker/post_build.sh.in index 0665100a..414fdb40 100755 --- a/docker/post_build.sh.in +++ b/docker/post_build.sh.in @@ -2,15 +2,24 @@ export LC_ALL=C.UTF-8 export LANG=C.UTF-8 set -x +set -e -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 +export PROJECT_VERSION="@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@" -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 +mkdir -p "$OUTPUT_DIR" +"$TOOLS_DIR"/mcuboot/scripts/imgtool.py create --version 1.0.0 \ + --align 4 --header-size 32 --slot-size 475136 --pad-header \ + "$BUILD_DIR/src/pinetime-mcuboot-app-$PROJECT_VERSION.bin" \ + "$OUTPUT_DIR/image-$PROJECT_VERSION.bin" +adafruit-nrfutil dfu genpkg --dev-type 0x0052 \ + --application "$OUTPUT_DIR/image-$PROJECT_VERSION.bin" \ + "$OUTPUT_DIR/dfu-$PROJECT_VERSION.zip" + +cp "$BUILD_DIR"/src/*.bin \ + "$BUILD_DIR"/src/*.hex \ + "$BUILD_DIR"/src/*.out \ + "$BUILD_DIR"/src/*.map \ + $OUTPUT_DIR +cp "$SOURCES_DIR"/bootloader/bootloader-5.0.4.bin $OUTPUT_DIR/bootloader.bin \ No newline at end of file -- cgit v1.2.3 From 60ef9b54fbe35c1a985c3260e8c90158da129399 Mon Sep 17 00:00:00 2001 From: Joe Eaves Date: Fri, 18 Dec 2020 17:58:34 +0000 Subject: Integrate improvements from #137 Also fixed a bug with empty quoted strings --- doc/buildWithDocker.md | 65 +++++++++++++++++++++++++++++++------------------- docker/Dockerfile | 37 +++++++++++++++------------- docker/build.sh | 4 ++-- docker/entrypoint.sh | 7 ------ 4 files changed, 63 insertions(+), 50 deletions(-) delete mode 100755 docker/entrypoint.sh (limited to 'docker') diff --git a/doc/buildWithDocker.md b/doc/buildWithDocker.md index 771dd774..7a2f3727 100644 --- a/doc/buildWithDocker.md +++ b/doc/buildWithDocker.md @@ -1,58 +1,73 @@ # Build the project using Docker -There are [Docker images (Dockerfile)](../docker) containing the build environment for AMD64 (x86_64) and ARM64 architectures. These images make the build of the firmware and the generation of the DFU file for OTA quite easy, as well as preventing clashes with any other toolchains or development environments you may have installed. + +A [Docker image (Dockerfile)](../docker) containing all the build environment is available for X86_64 and AMD64 architectures. These images make the build of the firmware and the generation of the DFU file for OTA quite easy, as well as preventing clashes with any other toolchains or development environments you may have installed. Based on Ubuntu 18.04 with the following build dependencies: -When this is done, a new image named *infinitime-build* is available. * ARM GCC Toolchain * nRF SDK * MCUBoot * adafruit-nrfutil -## Run a container to build the project: +## Run a container to build the project + The `infinitime-build` image contains all the dependencies you need. The default `CMD` will compile sources found in `/sources`, so you need only mount your code. This example will build the firmware, generate the MCUBoot image and generate the DFU file. Outputs will be written to **/build/output**: ```bash -$ cd # e.g. cd ./work/Pinetime -$ docker run --rm -it -v $(pwd):/sources infinitime-build +cd # e.g. cd ./work/Pinetime +docker run --rm -it -v $(pwd):/sources infinitime-build +``` + +If you only want to build a single CMake target, you can pass it in as the first parameter to the build script. This means calling the script explicitly as it will override the `CMD`. Here's an example For `pinetime-app`: + +```bash +docker run --rm -it -v $(pwd):/sources infinitime-build /opt/build.sh pinetime-app ``` -* `--rm` to delete the container after we're done. Build cache will be written out to host disk, so no worries. -* `-it` for better interactivity with the running container. - * `-i` Interactive - required if you want to send CTRL+C - * `-t` TTY - This lets colours work nicely etc? -* `-v` for mounting a volume to the container +The image is built using 1000:1000 for the user id and group id. If this is different to your user or group ids (run `id -u` and `id -g` to find out what your id values are if you are unsure), you will need to override them via the `--user` parameter in order to prevent permission errors with the output files (and the cmake build cache). -Output files (and the cmake build cache) will have `uid`/`gid` not matching your host user. To override them, use `docker run` like this: +Running with this image is the same as above, you just specify the ids to `docker run` ```bash -$ docker run --rm -it -v $(pwd):/sources \ - -e USER_ID=$(id -u) -e GROUP_ID=$(id -g) \ - infinitime-build +docker run --rm -it -v $(pwd):/sources --user $(id -u):$(id -g) pfeerick/infinitime-build ``` -If you only want to build a single CMake target, you can pass it in as the first parameter to the build script. This means calling the script explicitly as it will override the `CMD`. Here's an example For `pinetime-app`: +Or you can specify your user id and group id (by number, not by name) directly: ```bash -$ docker run --rm -it -v $(pwd):/sources infinitime-build /opt/build.sh pinetime-app +docker run --rm -it -v $(pwd):/sources --user 1234:1234 infinitime-build ``` -## Build the image -The image is not (yet) available on DockerHub, you need to build it yourself, but that is quite easy. The following commands must be run from the root of the project. This operation will take some time but, when done, a new image named *infinitime-build* is available. +## Using the image from Docker Hub + +The image is avaiable via Docker Hub for both the amd64 and arm64v8 architectures at [pfeerick/infinitime-build](https://hub.docker.com/repository/docker/pfeerick/infinitime-build). + +It can be pulled (downloaded) using the following command: ```bash -$ docker image build -t infinitime-build ./docker +docker pull pfeerick/infinitime-build ``` -The resulting +The default `latest` tag *should* automatically identify the correct image architecture, but if for some reason Docker does not, you can specify it manually: + +* For AMD64 (x86_64) systems: `docker pull pfeerick/infinitime-build:amd64` + +* For ARM64v8 (ARM64/aarch64) systems: `docker pull pfeerick/infinitime-build:arm64v8` + +## Build the image + +You can build the image yourself if you like! + +The following commands must be run from the root of the project. This operation will take some time but, when done, a new image named *infinitime-build* is available. + +```bash +docker image build -t infinitime-build ./docker +``` -You can bake your custom USER_ID and GROUP_ID numbers in to the image, then you don't have to pass them to `docker run` every time. +The `PUID` and `PGID` build arguments are used to set the user and group ids used in the container, meaning you will not need to specify it later unless they change for some reason. Specifying them is not mandatory, as this can be over-ridden at build time via the `--user` flag, but doing so will make the command you need to run later a bit shorter. In the below examples, they are set to your current user id and group id automatically. You can specify them manually, but they must be specified by number, not by name. ```bash -docker image build -t infinitime-build \ - --build-arg USER_ID=$(id -u) \ - --build-arg GROUP_ID=$(id -g) \ - ./docker +docker image build -t infinitime-build --build-arg PUID=$(id -u) --build-arg PGID=$(id -g) ./docker ``` diff --git a/docker/Dockerfile b/docker/Dockerfile index 8f56356c..7f0fb4b0 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,16 +1,24 @@ FROM ubuntu:18.04 -RUN \ - apt-get update -qq && \ - apt-get install -y \ +ARG DEBIAN_FRONTEND=noninteractive +RUN apt-get update -qq \ + && apt-get install -y \ # x86_64 / generic packages - bash git gosu \ - cmake make build-essential \ - wget unzip \ - python3 python3-pip \ + bash \ + build-essential \ + cmake \ + git \ + make \ + python3 \ + python3-pip \ + tar \ + unzip \ + wget \ # aarch64 packages - libffi-dev libssl-dev python3-dev \ - && rm -rf /var/lib/apt/lists/*; + libffi-dev \ + libssl-dev \ + python3-dev \ + && rm -rf /var/cache/apt/* /var/lib/apt/lists/*; RUN pip3 install adafruit-nrfutil @@ -25,13 +33,10 @@ RUN bash -c "source /opt/build.sh; GetNrfSdk;" # McuBoot RUN bash -c "source /opt/build.sh; GetMcuBoot;" -# Set and arg and use it in the env for power to override at build AND runtime -ARG USER_ID=33333 -ARG GROUP_ID=33333 -ENV USER_ID $USER_ID -ENV GROUP_ID $GROUP_ID +ARG PUID=1000 +ARG PGID=1000 +RUN groupadd --system --gid $PGID infinitime && useradd --system --uid $PUID --gid $PGID infinitime +USER infinitime:infinitime ENV SOURCES_DIR /sources -COPY entrypoint.sh /opt/ -ENTRYPOINT ["/opt/entrypoint.sh"] CMD ["/opt/build.sh"] diff --git a/docker/build.sh b/docker/build.sh index 1c697d40..48dd9f33 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -27,7 +27,7 @@ main() { mkdir -p "$BUILD_DIR" CmakeGenerate - CmakeBuild "$target" + CmakeBuild $target if [[ "$DISABLE_POSTBUILD" != "true" ]]; then source "$BUILD_DIR/post_build.sh" @@ -67,7 +67,7 @@ CmakeGenerate() { CmakeBuild() { local target="$1" [[ -n "$target" ]] && target="--target $target" - cmake --build "$BUILD_DIR" --config $BUILD_TYPE "$target" -- -j$(nproc) + cmake --build "$BUILD_DIR" --config $BUILD_TYPE $target -- -j$(nproc) } [[ $SOURCED == "false" ]] && main "$@" || echo "Sourced!" \ No newline at end of file diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh deleted file mode 100755 index 5adb88f5..00000000 --- a/docker/entrypoint.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -e -## Create a user on-the-fly before running CMD -## This allows us to override at runtime, allowing use of a pre-built docker image -addgroup --gid $GROUP_ID user -adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID user -exec gosu user:user /bin/bash -c "$@" \ No newline at end of file -- cgit v1.2.3 From 1f243aeedbc42349dbaba0ad3c2801606f4a5623 Mon Sep 17 00:00:00 2001 From: Joe Eaves Date: Tue, 22 Dec 2020 11:38:57 +0000 Subject: Make TOOLS_DIR if needed Added some extra dir names to gitignore --- .gitignore | 8 +++++--- docker/build.sh | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'docker') diff --git a/.gitignore b/.gitignore index 8d416f85..100e2580 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,13 @@ .idea/ # CMake -cmake-build-*/ -CMakeFiles/ +cmake-build-* +cmake-* +CMakeFiles **/CMakeCache.txt cmake_install.cmake Makefile -build/ +build +tools # Resulting binary files *.a diff --git a/docker/build.sh b/docker/build.sh index 48dd9f33..f35c2f3a 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -20,6 +20,9 @@ MACHINE="$(uname -m)" main() { local target="$1" + + mkdir -p "$TOOLS_DIR" + [[ ! -d "$TOOLS_DIR/$GCC_ARM_VER" ]] && GetGcc [[ ! -d "$TOOLS_DIR/$NRF_SDK_VER" ]] && GetNrfSdk [[ ! -d "$TOOLS_DIR/mcuboot" ]] && GetMcuBoot -- cgit v1.2.3 From 6c6ffc61ee273ba29f2a094e9953dbaf3df920d6 Mon Sep 17 00:00:00 2001 From: Joe Eaves Date: Tue, 22 Dec 2020 11:39:21 +0000 Subject: Make the post_build output a little cleaner --- docker/post_build.sh.in | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'docker') diff --git a/docker/post_build.sh.in b/docker/post_build.sh.in index 414fdb40..52824c5b 100755 --- a/docker/post_build.sh.in +++ b/docker/post_build.sh.in @@ -7,6 +7,7 @@ set -e export PROJECT_VERSION="@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@" mkdir -p "$OUTPUT_DIR" +cp "$SOURCES_DIR"/bootloader/bootloader-5.0.4.bin $OUTPUT_DIR/bootloader.bin "$TOOLS_DIR"/mcuboot/scripts/imgtool.py create --version 1.0.0 \ --align 4 --header-size 32 --slot-size 475136 --pad-header \ @@ -17,9 +18,9 @@ adafruit-nrfutil dfu genpkg --dev-type 0x0052 \ --application "$OUTPUT_DIR/image-$PROJECT_VERSION.bin" \ "$OUTPUT_DIR/dfu-$PROJECT_VERSION.zip" -cp "$BUILD_DIR"/src/*.bin \ - "$BUILD_DIR"/src/*.hex \ - "$BUILD_DIR"/src/*.out \ - "$BUILD_DIR"/src/*.map \ - $OUTPUT_DIR -cp "$SOURCES_DIR"/bootloader/bootloader-5.0.4.bin $OUTPUT_DIR/bootloader.bin \ No newline at end of file +pushd "$BUILD_DIR" + cp src/*.bin $OUTPUT_DIR + cp src/*.hex $OUTPUT_DIR + cp src/*.out $OUTPUT_DIR + cp src/*.map $OUTPUT_DIR +popd \ No newline at end of file -- cgit v1.2.3 From 5cdd3f6e6f0abf439da0389b38ebc13bd30fc8e5 Mon Sep 17 00:00:00 2001 From: Joe Eaves Date: Tue, 22 Dec 2020 12:40:21 +0000 Subject: Improve the post_build again, again? --- docker/post_build.sh.in | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'docker') diff --git a/docker/post_build.sh.in b/docker/post_build.sh.in index 52824c5b..53ae343a 100755 --- a/docker/post_build.sh.in +++ b/docker/post_build.sh.in @@ -1,12 +1,13 @@ #!/bin/sh export LC_ALL=C.UTF-8 export LANG=C.UTF-8 -set -x set -e +set +x export PROJECT_VERSION="@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@" mkdir -p "$OUTPUT_DIR" + cp "$SOURCES_DIR"/bootloader/bootloader-5.0.4.bin $OUTPUT_DIR/bootloader.bin "$TOOLS_DIR"/mcuboot/scripts/imgtool.py create --version 1.0.0 \ @@ -18,9 +19,11 @@ adafruit-nrfutil dfu genpkg --dev-type 0x0052 \ --application "$OUTPUT_DIR/image-$PROJECT_VERSION.bin" \ "$OUTPUT_DIR/dfu-$PROJECT_VERSION.zip" -pushd "$BUILD_DIR" - cp src/*.bin $OUTPUT_DIR - cp src/*.hex $OUTPUT_DIR - cp src/*.out $OUTPUT_DIR - cp src/*.map $OUTPUT_DIR -popd \ No newline at end of file +mkdir -p "$OUTPUT_DIR/src" +cd "$BUILD_DIR" +cp src/*.bin "$OUTPUT_DIR/src" +cp src/*.hex "$OUTPUT_DIR/src" +cp src/*.out "$OUTPUT_DIR/src" +cp src/*.map "$OUTPUT_DIR/src" + +ls -RUv1 "$OUTPUT_DIR" | sed 's;^\([^/]\); \1;g' \ No newline at end of file -- cgit v1.2.3