Skip to content

Commit 8fba0d9

Browse files
gountharclaude
authored andcommitted
feat(riscv64): add RISC-V build support to devcontainers and CI
Make WASI-SDK installation conditional in both linux and zephyr Dockerfiles since pre-built binaries are only available for x86_64 and arm64. Add riscv64-zephyr-elf toolchain to the Zephyr SDK install and qemu_riscv64 to the Zephyr CI build matrix. Tested on Banana Pi F3 (SpacemiT K1, rv64gc, 16 GB RAM, Debian Trixie): all three sample apps (mini, demo, supervisor) build successfully. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Bruno Verachten <gounthar@gmail.com> Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
1 parent 8609048 commit 8fba0d9

3 files changed

Lines changed: 23 additions & 8 deletions

File tree

.devcontainer/linux/Dockerfile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,17 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
4242
&& apt-get clean -y\
4343
&& update-alternatives --install /usr/bin/python python /usr/bin/python3 50
4444

45-
# Install wasi-sdk
46-
RUN mkdir /opt/wasi-sdk && \
47-
curl -sSL https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$WASI_SDK_VERSION/wasi-sdk-$WASI_SDK_VERSION.0-$(uname -m | sed s/aarch64/arm64/)-linux.tar.gz | \
48-
tar zxvf - --strip-components=1 -C /opt/wasi-sdk
45+
# Install wasi-sdk (pre-built binaries available for x86_64 and arm64 only)
46+
RUN ARCH=$(uname -m); \
47+
if [ "$ARCH" = "aarch64" ]; then ARCH=arm64; fi; \
48+
if [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "arm64" ]; then \
49+
mkdir /opt/wasi-sdk && \
50+
curl -sSL https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$WASI_SDK_VERSION/wasi-sdk-$WASI_SDK_VERSION.0-${ARCH}-linux.tar.gz | \
51+
tar zxvf - --strip-components=1 -C /opt/wasi-sdk; \
52+
else \
53+
mkdir -p /opt/wasi-sdk; \
54+
echo "WASI-SDK not available for $(uname -m), skipping (use -DOCRE_BUILD_DEMO_CONTAINERS=OFF)"; \
55+
fi
4956

5057
FROM ocre-ci AS ocre-dev
5158

.devcontainer/zephyr/Dockerfile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,17 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
5151
&& apt-get clean -y\
5252
&& update-alternatives --install /usr/bin/python python /usr/bin/python3 50
5353

54-
# Install wasi-sdk
55-
RUN mkdir /opt/wasi-sdk && \
56-
curl -sSL https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$WASI_SDK_VERSION/wasi-sdk-$WASI_SDK_VERSION.0-$(uname -m | sed s/aarch64/arm64/)-linux.tar.gz | \
57-
tar zxvf - --strip-components=1 -C /opt/wasi-sdk
54+
# Install wasi-sdk (pre-built binaries available for x86_64 and arm64 only)
55+
RUN ARCH=$(uname -m); \
56+
if [ "$ARCH" = "aarch64" ]; then ARCH=arm64; fi; \
57+
if [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "arm64" ]; then \
58+
mkdir /opt/wasi-sdk && \
59+
curl -sSL https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$WASI_SDK_VERSION/wasi-sdk-$WASI_SDK_VERSION.0-${ARCH}-linux.tar.gz | \
60+
tar zxvf - --strip-components=1 -C /opt/wasi-sdk; \
61+
else \
62+
mkdir -p /opt/wasi-sdk; \
63+
echo "WASI-SDK not available for $(uname -m), skipping (use -DOCRE_BUILD_DEMO_CONTAINERS=OFF)"; \
64+
fi
5865

5966
RUN python -m venv /opt/zephyr-venv && \
6067
. /opt/zephyr-venv/bin/activate && \

.github/workflows/zephyr.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
- pico_plus2/rp2350b/m33
2828
- native_sim/native/64
2929
- b_u585i_iot02a
30+
- qemu_riscv64
3031
app:
3132
- mini
3233
- demo

0 commit comments

Comments
 (0)