From bf61d2512c9ec10cb2810ce931e21d543750ff9c Mon Sep 17 00:00:00 2001 From: Sylvain Bellemare Date: Thu, 6 Nov 2025 22:08:14 +0900 Subject: [PATCH] Add Dockerfiles to build dabao apps & bao1x boot1 --- .dockerignore | 8 ++++++++ apps-dabao/Dockerfile | 28 ++++++++++++++++++++++++++++ apps-dabao/README.md | 9 +++++++++ bao1x-boot/Dockerfile | 30 ++++++++++++++++++++++++++++++ bao1x-boot/README.md | 11 ++++++++++- 5 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 apps-dabao/Dockerfile create mode 100644 bao1x-boot/Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..56dbef6cf --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +*.uf2 +.direnv +.github +.vscode +.envrc +.gitattributes +.gitignore +*.nix diff --git a/apps-dabao/Dockerfile b/apps-dabao/Dockerfile new file mode 100644 index 000000000..7d03391f4 --- /dev/null +++ b/apps-dabao/Dockerfile @@ -0,0 +1,28 @@ +FROM rust:1.92-slim AS toolchain +ARG RUST_VERSION="1.92.0" +ARG EXTRA="1" + +RUN set -eux; \ + apt-get update && apt-get install -y --no-install-recommends \ + curl \ + git \ + unzip \ + && rm -rf /var/lib/apt/lists/* \ + && download_url="https://github.com/betrusted-io/rust/releases/download"; \ + zipfile="riscv32imac-unknown-xous_${RUST_VERSION}.zip"; \ + curl -L -O "${download_url}/${RUST_VERSION}.${EXTRA}/${zipfile}"; \ + unzip "${zipfile}" -d "$(rustc --print sysroot)"; \ + rm "${zipfile}" + +RUN rustup target add riscv32imac-unknown-none-elf + +FROM toolchain AS builder +ARG app="helloworld" +WORKDIR /usr/src/xous-core +COPY . . +RUN --mount=type=cache,target=/root/.cargo/registry cargo xtask dabao ${app} + +FROM scratch +COPY --from=builder /usr/src/xous-core/target/riscv32imac-unknown-xous-elf/release/apps.uf2 / +COPY --from=builder /usr/src/xous-core/target/riscv32imac-unknown-xous-elf/release/loader.uf2 / +COPY --from=builder /usr/src/xous-core/target/riscv32imac-unknown-xous-elf/release/xous.uf2 / diff --git a/apps-dabao/README.md b/apps-dabao/README.md index f63a73628..02113cdb1 100644 --- a/apps-dabao/README.md +++ b/apps-dabao/README.md @@ -1,3 +1,12 @@ # Apps for Dabao These are applications targeting a minimal set of Xous services for hardware configurations that are basically "just the chip". + +## Building with Docker +From the root of the repository, run: + +```shell +mkdir -p target && docker build --file apps-dabao/Dockerfile --build-arg app=helloworld --output target . +``` + +The `uf2` files will be under `target/`. diff --git a/bao1x-boot/Dockerfile b/bao1x-boot/Dockerfile new file mode 100644 index 000000000..e50415d42 --- /dev/null +++ b/bao1x-boot/Dockerfile @@ -0,0 +1,30 @@ +FROM rust:1.92-slim AS toolchain + +ARG RUST_VERSION="1.92.0" +ARG EXTRA="1" + +RUN set -eux; \ + apt-get update && apt-get install -y --no-install-recommends \ + curl \ + git \ + unzip \ + && rm -rf /var/lib/apt/lists/* \ + && download_url="https://github.com/betrusted-io/rust/releases/download"; \ + zipfile="riscv32imac-unknown-xous_${RUST_VERSION}.zip"; \ + curl -L -O "${download_url}/${RUST_VERSION}.${EXTRA}/${zipfile}"; \ + unzip "${zipfile}" -d "$(rustc --print sysroot)"; \ + rm "${zipfile}" + +RUN rustup target add riscv32imac-unknown-none-elf + + +FROM toolchain AS builder +WORKDIR /usr/src/xous-core +COPY . . +RUN --mount=type=cache,target=/root/.cargo/registry cargo xtask bao1x-alt-boot1 +RUN --mount=type=cache,target=/root/.cargo/registry cargo xtask bao1x-boot1 + + +FROM scratch +COPY --from=builder /usr/src/xous-core/target/riscv32imac-unknown-none-elf/release/bao1x-boot1.uf2 / +COPY --from=builder /usr/src/xous-core/target/riscv32imac-unknown-none-elf/release/bao1x-alt-boot1.uf2 / diff --git a/bao1x-boot/README.md b/bao1x-boot/README.md index cd471f217..71a001af4 100644 --- a/bao1x-boot/README.md +++ b/bao1x-boot/README.md @@ -104,4 +104,13 @@ The baremetal or loader stage are both located at the exact same offset. One can Because much of the hardware initialization is done by boot0/boot1, baremetal and loader *should* shed much of the hardware initializations it does. The only re-init that needs to happen are for parameters unique or different to the environments. -Documentation of the baremetal or loader stages is deferred to the respective crates, which are located outside of this subdirectory. \ No newline at end of file +Documentation of the baremetal or loader stages is deferred to the respective crates, which are located outside of this subdirectory. + +## Building boot1 with Docker +From the root of the repository, run: + +```shell +mkdir -p target && docker build --file bao1x-boot/Dockerfile --output target . +``` + +The `uf2` files will be under `target/`.