initial commit
This commit is contained in:
commit
ac672a42c8
2
READEME.md
Normal file
2
READEME.md
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Tools for building infinitime and infinisim.
|
||||||
|
Place this directory in the same directory containing a InfiniTime and InfiniSim directory:w
|
2
build-scripts/docker-infinisim-build.sh
Normal file
2
build-scripts/docker-infinisim-build.sh
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
sudo docker run --rm -it -v ./InfiniTime:/infinitime -v ./InfiniSim:/infinisim -v ./build-scripts:/build-scripts --user $(id -u):$(id -g) sha256:d98e39f8c51e606ab0ceea093054ae7009eb95a37ec949f8f9bcb204e3fb0771 bash /build-scripts/infinisim-build.sh
|
4
build-scripts/infinisim-build.sh
Normal file
4
build-scripts/infinisim-build.sh
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
cd /infinisim
|
||||||
|
cmake -S . -B build -DInfiniTime_DIR=/infinitime -DENABLE_USERAPPS="Apps::Music, Apps::Calculator"
|
||||||
|
cmake --build build -j4
|
6
build-scripts/infinisim-run.sh
Normal file
6
build-scripts/infinisim-run.sh
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
echo loading resources
|
||||||
|
/infinisim/build/littlefs-do res load /infinitime/build/output/infinitime-resources-1.14.0.zip
|
||||||
|
echo loaded reources, starting simulator
|
||||||
|
/infinisim/build/infinisim --hide-status
|
||||||
|
|
43
docker/.gitpod.Dockerfile
vendored
Normal file
43
docker/.gitpod.Dockerfile
vendored
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
FROM gitpod/workspace-full
|
||||||
|
|
||||||
|
USER root
|
||||||
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
RUN apt-get update -qq \
|
||||||
|
&& apt-get install -y \
|
||||||
|
# x86_64 / generic packages
|
||||||
|
bash \
|
||||||
|
build-essential \
|
||||||
|
cmake \
|
||||||
|
git \
|
||||||
|
make \
|
||||||
|
python3 \
|
||||||
|
python3-pip \
|
||||||
|
tar \
|
||||||
|
unzip \
|
||||||
|
wget \
|
||||||
|
# aarch64 packages
|
||||||
|
libffi-dev \
|
||||||
|
libssl-dev \
|
||||||
|
python3-dev \
|
||||||
|
git \
|
||||||
|
&& rm -rf /var/cache/apt/* /var/lib/apt/lists/*;
|
||||||
|
|
||||||
|
# Git needed for PROJECT_GIT_COMMIT_HASH variable setting
|
||||||
|
|
||||||
|
# Needs to be installed as root
|
||||||
|
RUN pip3 install adafruit-nrfutil
|
||||||
|
RUN pip3 install -Iv cryptography==3.3
|
||||||
|
|
||||||
|
COPY docker/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;"
|
||||||
|
|
||||||
|
# Link the default checkout workspace in to the default $SOURCES_DIR
|
||||||
|
RUN ln -s /workspace/InfiniTime /sources
|
||||||
|
|
||||||
|
USER gitpod
|
63
docker/Dockerfile
Normal file
63
docker/Dockerfile
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
FROM ubuntu:22.04
|
||||||
|
|
||||||
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
ARG NODE_MAJOR=20
|
||||||
|
RUN apt-get update -qq \
|
||||||
|
&& apt-get install -y ca-certificates curl gnupg \
|
||||||
|
&& mkdir -p /etc/apt/keyrings \
|
||||||
|
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
|
||||||
|
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" > /etc/apt/sources.list.d/nodesource.list \
|
||||||
|
&& apt-get update -qq \
|
||||||
|
&& apt-get install -y \
|
||||||
|
# x86_64 / generic packages
|
||||||
|
bash \
|
||||||
|
build-essential \
|
||||||
|
cmake \
|
||||||
|
git \
|
||||||
|
make \
|
||||||
|
nodejs \
|
||||||
|
python3 \
|
||||||
|
python3-pip \
|
||||||
|
python3-pil \
|
||||||
|
python-is-python3 \
|
||||||
|
tar \
|
||||||
|
unzip \
|
||||||
|
wget \
|
||||||
|
# aarch64 packages
|
||||||
|
libffi-dev \
|
||||||
|
libssl-dev \
|
||||||
|
python3-dev \
|
||||||
|
git \
|
||||||
|
apt-utils \
|
||||||
|
pkg-config \
|
||||||
|
libpixman-1-dev \
|
||||||
|
libcairo2-dev \
|
||||||
|
libpango-1.0-0 \
|
||||||
|
ibpango1.0-dev \
|
||||||
|
libpangocairo-1.0-0 \
|
||||||
|
libsdl2-dev \
|
||||||
|
g++ \
|
||||||
|
libpng-dev \
|
||||||
|
&& rm -rf /var/cache/apt/* /var/lib/apt/lists/*;
|
||||||
|
|
||||||
|
# Git needed for PROJECT_GIT_COMMIT_HASH variable setting
|
||||||
|
|
||||||
|
RUN pip3 install adafruit-nrfutil
|
||||||
|
RUN pip3 install -Iv cryptography==3.3
|
||||||
|
RUN pip3 install cbor
|
||||||
|
RUN npm i lv_font_conv@1.5.2 -g
|
||||||
|
RUN npm install ts-node@10.9.1 @swc/core@1.3.82 lv_img_conv@0.3.0 -g
|
||||||
|
|
||||||
|
# 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;"
|
||||||
|
|
||||||
|
ENV SOURCES_DIR /sources
|
||||||
|
CMD ["/opt/build.sh"]
|
2
docker/README.md
Normal file
2
docker/README.md
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Docker images and build script for building the project using Docker.
|
||||||
|
See [this page for more info](../doc/buildWithDocker.md).
|
90
docker/build.sh
Normal file
90
docker/build.sh
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
#!/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
|
||||||
|
|
||||||
|
# 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:=$SOURCES_DIR/build/output}"
|
||||||
|
|
||||||
|
# Specify a folder with read/write access to NPM
|
||||||
|
export NPM_DIR="$BUILD_DIR/npm"
|
||||||
|
export npm_config_cache="${NPM_DIR}"
|
||||||
|
|
||||||
|
export BUILD_TYPE=${BUILD_TYPE:=Release}
|
||||||
|
export GCC_ARM_VER=${GCC_ARM_VER:="10.3-2021.10"}
|
||||||
|
export NRF_SDK_VER=${NRF_SDK_VER:="nRF5_SDK_15.3.0_59ac345"}
|
||||||
|
|
||||||
|
MACHINE="$(uname -m)"
|
||||||
|
[ "$MACHINE" = "arm64" ] && MACHINE="aarch64"
|
||||||
|
|
||||||
|
export GCC_ARM_PATH="gcc-arm-none-eabi-$GCC_ARM_VER"
|
||||||
|
|
||||||
|
main() {
|
||||||
|
local target="$1"
|
||||||
|
|
||||||
|
mkdir -p "$TOOLS_DIR"
|
||||||
|
|
||||||
|
[ ! -d "$TOOLS_DIR/$GCC_ARM_PATH" ] && GetGcc
|
||||||
|
[ ! -d "$TOOLS_DIR/$NRF_SDK_VER" ] && GetNrfSdk
|
||||||
|
[ ! -d "$TOOLS_DIR/mcuboot" ] && GetMcuBoot
|
||||||
|
|
||||||
|
mkdir -p "$BUILD_DIR"
|
||||||
|
|
||||||
|
CmakeGenerate
|
||||||
|
CmakeBuild $target
|
||||||
|
BUILD_RESULT=$?
|
||||||
|
if [ "$DISABLE_POSTBUILD" != "true" -a "$BUILD_RESULT" == 0 ]; then
|
||||||
|
source "$BUILD_DIR/post_build.sh"
|
||||||
|
fi
|
||||||
|
# assuming post_build.sh will never fail on a successful build
|
||||||
|
return $BUILD_RESULT
|
||||||
|
}
|
||||||
|
|
||||||
|
GetGcc() {
|
||||||
|
wget -q https://developer.arm.com/-/media/Files/downloads/gnu-rm/$GCC_ARM_VER/$GCC_ARM_PATH-$MACHINE-linux.tar.bz2 -O - | tar -xj -C $TOOLS_DIR/
|
||||||
|
}
|
||||||
|
|
||||||
|
GetMcuBoot() {
|
||||||
|
git clone https://github.com/mcu-tools/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() {
|
||||||
|
cmake -G "Unix Makefiles" \
|
||||||
|
-S "$SOURCES_DIR" \
|
||||||
|
-B "$BUILD_DIR" \
|
||||||
|
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
|
||||||
|
-DARM_NONE_EABI_TOOLCHAIN_PATH="$TOOLS_DIR/$GCC_ARM_PATH" \
|
||||||
|
-DNRF5_SDK_PATH="$TOOLS_DIR/$NRF_SDK_VER" \
|
||||||
|
-DBUILD_DFU=1 \
|
||||||
|
-DBUILD_RESOURCES=1
|
||||||
|
}
|
||||||
|
|
||||||
|
CmakeBuild() {
|
||||||
|
local target="$1"
|
||||||
|
[ -n "$target" ] && target="--target $target"
|
||||||
|
cmake --build "$BUILD_DIR" --config $BUILD_TYPE $target -- -j$(nproc)
|
||||||
|
BUILD_RESULT=$?
|
||||||
|
return $BUILD_RESULT
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ $SOURCED = "false" ]; then
|
||||||
|
# It is important to return exit code of main
|
||||||
|
# To be future-proof, this is handled explicitely
|
||||||
|
main "$@"
|
||||||
|
BUILD_RESULT=$?
|
||||||
|
exit $BUILD_RESULT
|
||||||
|
else
|
||||||
|
echo "Sourced!"
|
||||||
|
fi
|
26
docker/post_build.sh.in
Normal file
26
docker/post_build.sh.in
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
export LC_ALL=C.UTF-8
|
||||||
|
export LANG=C.UTF-8
|
||||||
|
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
|
||||||
|
cp "$BUILD_DIR/src/pinetime-mcuboot-app-image-$PROJECT_VERSION.bin" "$OUTPUT_DIR/pinetime-mcuboot-app-image-$PROJECT_VERSION.bin"
|
||||||
|
cp "$BUILD_DIR/src/pinetime-mcuboot-app-dfu-$PROJECT_VERSION.zip" "$OUTPUT_DIR/pinetime-mcuboot-app-dfu-$PROJECT_VERSION.zip"
|
||||||
|
|
||||||
|
cp "$BUILD_DIR/src/pinetime-mcuboot-recovery-loader-image-$PROJECT_VERSION.bin" "$OUTPUT_DIR/pinetime-mcuboot-recovery-loader-image-$PROJECT_VERSION.bin"
|
||||||
|
cp "$BUILD_DIR/src/pinetime-mcuboot-recovery-loader-dfu-$PROJECT_VERSION.zip" "$OUTPUT_DIR/pinetime-mcuboot-recovery-loader-dfu-$PROJECT_VERSION.zip"
|
||||||
|
|
||||||
|
cp "$BUILD_DIR/src/resources/infinitime-resources-$PROJECT_VERSION.zip" "$OUTPUT_DIR/infinitime-resources-$PROJECT_VERSION.zip"
|
||||||
|
|
||||||
|
mkdir -p "$OUTPUT_DIR/src"
|
||||||
|
cp $BUILD_DIR/src/*.bin "$OUTPUT_DIR/src/"
|
||||||
|
cp $BUILD_DIR/src/*.hex "$OUTPUT_DIR/src/"
|
||||||
|
cp $BUILD_DIR/src/*.out "$OUTPUT_DIR/src/"
|
||||||
|
cp $BUILD_DIR/src/*.map "$OUTPUT_DIR/src/"
|
||||||
|
|
||||||
|
ls -RUv1 "$OUTPUT_DIR" | sed 's;^\([^/]\); \1;g'
|
11
infinisim-build/docker-compose.yml
Normal file
11
infinisim-build/docker-compose.yml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
version: "3.3"
|
||||||
|
services:
|
||||||
|
bash:
|
||||||
|
stdin_open: true
|
||||||
|
tty: true
|
||||||
|
volumes:
|
||||||
|
- ../../InfiniTime:/infinitime
|
||||||
|
- ../../InfiniSim:/infinisim
|
||||||
|
- ../build-scripts:/build-scripts
|
||||||
|
image: infini-build
|
||||||
|
command: bash /build-scripts/infinisim-build.sh
|
16
infinisim-run/docker-compose.yml
Normal file
16
infinisim-run/docker-compose.yml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
version: "3.3"
|
||||||
|
services:
|
||||||
|
bash:
|
||||||
|
stdin_open: true
|
||||||
|
tty: true
|
||||||
|
volumes:
|
||||||
|
- ../../InfiniTime:/infinitime
|
||||||
|
- ../../InfiniSim:/infinisim
|
||||||
|
- ../build-scripts:/build-scripts
|
||||||
|
- /tmp/.X11-unix:/tmp/.X11-unix
|
||||||
|
- /home/brickman/.Xauthority:/root/.Xauthority:rw
|
||||||
|
environment:
|
||||||
|
- DISPLAY=${DISPLAY}
|
||||||
|
image: sha256:d98e39f8c51e606ab0ceea093054ae7009eb95a37ec949f8f9bcb204e3fb0771
|
||||||
|
command: /infinisim/build/infinisim
|
||||||
|
network_mode: host
|
9
infinitime-build/docker-compose.yml
Normal file
9
infinitime-build/docker-compose.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
version: "3.3"
|
||||||
|
services:
|
||||||
|
bash:
|
||||||
|
stdin_open: true
|
||||||
|
tty: true
|
||||||
|
volumes:
|
||||||
|
- ../../InfiniTime:/sources
|
||||||
|
image: infini-build
|
||||||
|
#command: bash /build-scripts/infinisim-build.sh
|
Loading…
Reference in New Issue
Block a user