From 0f204d904764ff7dbb44b78d6ed4d91f4e7fda13 Mon Sep 17 00:00:00 2001 From: Amy Ringo Date: Sat, 4 Apr 2026 18:48:00 -0500 Subject: [PATCH 1/5] add support for cross-compiling for RVA23 --- .github/workflows/rva23.yml | 27 +++++++++++++++++++++++++++ Containerfile | 15 +++++++++++++++ scripts/zig-cc-rva23.sh | 17 +++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 .github/workflows/rva23.yml create mode 100644 Containerfile create mode 100755 scripts/zig-cc-rva23.sh diff --git a/.github/workflows/rva23.yml b/.github/workflows/rva23.yml new file mode 100644 index 0000000..9e23456 --- /dev/null +++ b/.github/workflows/rva23.yml @@ -0,0 +1,27 @@ +name: Cross-compile to RVA23 + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Build image + run: podman build -t odorobo-builder:rva23 . + - name: Build binaries + run: podman run --rm -v ${{ github.workspace }}:/code -w /code odorobo-builder:rva23 cargo build --release + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: odorobo + path: | + target/riscv64a23-unknown-linux-gnu/release/odorobo-agent + target/riscv64a23-unknown-linux-gnu/release/odoroboctl diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..8f6fe62 --- /dev/null +++ b/Containerfile @@ -0,0 +1,15 @@ +FROM alpine:3.23.3 +RUN apk add \ + bash \ + gcc \ + musl-dev \ + rustup \ + zig +RUN rustup-init \ + --profile minimal \ + --target riscv64a23-unknown-linux-gnu \ + -y +ENV CARGO_BUILD_TARGET="riscv64a23-unknown-linux-gnu" +ENV PATH="/root/.cargo/bin:$PATH" +ENV CC_riscv64a23_unknown_linux_gnu="/code/scripts/zig-cc-rva23.sh" +ENV CARGO_TARGET_RISCV64A23_UNKNOWN_LINUX_GNU_RUSTFLAGS="-C linker=scripts/zig-cc-rva23.sh" diff --git a/scripts/zig-cc-rva23.sh b/scripts/zig-cc-rva23.sh new file mode 100755 index 0000000..fd0d8e6 --- /dev/null +++ b/scripts/zig-cc-rva23.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +set -euo pipefail + +# A script for cargo to use as the C compiler and linker when building RVA23 +# binaries. This links them using zig cc. + +args=() +for arg in "$@"; do + case "$arg" in + --target=riscv64-unknown-linux-gnu) + ;; + *) + args+=("$arg") + ;; + esac +done +exec zig cc -target riscv64-linux-gnu "${args[@]}" From 7798c1cebbd5b2fef66b81e19b5d076c66feb453 Mon Sep 17 00:00:00 2001 From: Amy Ringo Date: Sat, 4 Apr 2026 18:53:53 -0500 Subject: [PATCH 2/5] add caching for intermediate files --- .github/workflows/rva23.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/rva23.yml b/.github/workflows/rva23.yml index 9e23456..6cd2761 100644 --- a/.github/workflows/rva23.yml +++ b/.github/workflows/rva23.yml @@ -14,6 +14,15 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: actions/cache@v5 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Build image run: podman build -t odorobo-builder:rva23 . - name: Build binaries From 6f73d1d0b2fa54229e824fac619309a6421a595b Mon Sep 17 00:00:00 2001 From: Hero Date: Sun, 5 Apr 2026 02:25:46 -0500 Subject: [PATCH 3/5] Add .idea to gitignore. This arguably shouldn't be in this PR, but I need it due to using RustRover. --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 27e517e..cf82bef 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,7 @@ dev # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ +.idea/ # AI Slop # Anyone who uses LLMs for slop gets to keep their own slop context. From 308dc6e598f941b6fa76fa60d0b6f06740870a76 Mon Sep 17 00:00:00 2001 From: Hero Date: Sun, 5 Apr 2026 02:27:14 -0500 Subject: [PATCH 4/5] make x86 and rva23 naming consistent and add upload artifact to x86 --- .github/workflows/{rva23.yml => build_riscv_rva23.yml} | 6 +++--- .github/workflows/{rust.yml => build_x86.yml} | 9 ++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) rename .github/workflows/{rva23.yml => build_riscv_rva23.yml} (85%) rename .github/workflows/{rust.yml => build_x86.yml} (58%) diff --git a/.github/workflows/rva23.yml b/.github/workflows/build_riscv_rva23.yml similarity index 85% rename from .github/workflows/rva23.yml rename to .github/workflows/build_riscv_rva23.yml index 6cd2761..beca89c 100644 --- a/.github/workflows/rva23.yml +++ b/.github/workflows/build_riscv_rva23.yml @@ -1,4 +1,4 @@ -name: Cross-compile to RVA23 +name: Build RISC V RVA23 via x86 cross-compile on: push: @@ -26,11 +26,11 @@ jobs: - name: Build image run: podman build -t odorobo-builder:rva23 . - name: Build binaries - run: podman run --rm -v ${{ github.workspace }}:/code -w /code odorobo-builder:rva23 cargo build --release + run: podman run --rm -v ${{ github.workspace }}:/code -w /code odorobo-builder:rva23 cargo build --release --verbose - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: odorobo + name: odorobo_riscv_rva23 path: | target/riscv64a23-unknown-linux-gnu/release/odorobo-agent target/riscv64a23-unknown-linux-gnu/release/odoroboctl diff --git a/.github/workflows/rust.yml b/.github/workflows/build_x86.yml similarity index 58% rename from .github/workflows/rust.yml rename to .github/workflows/build_x86.yml index 9fd45e0..5958a0d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/build_x86.yml @@ -1,4 +1,4 @@ -name: Rust +name: Build x86 on: push: @@ -18,5 +18,12 @@ jobs: - uses: actions/checkout@v4 - name: Build run: cargo build --verbose + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: odorobo_x86 + path: | + target/release/odorobo-agent + target/release/odoroboctl - name: Run tests run: cargo test --verbose From c6331a112818d001cfc8eca1fdc6d5087e10c84a Mon Sep 17 00:00:00 2001 From: Hero Date: Sun, 5 Apr 2026 02:35:04 -0500 Subject: [PATCH 5/5] figured out my mistake with x86. forgot to add --release. --- .github/workflows/build_x86.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_x86.yml b/.github/workflows/build_x86.yml index 5958a0d..76aae89 100644 --- a/.github/workflows/build_x86.yml +++ b/.github/workflows/build_x86.yml @@ -17,7 +17,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Build - run: cargo build --verbose + run: cargo build --verbose --release - name: Upload artifact uses: actions/upload-artifact@v4 with: