Skip to content

Commit 41672f6

Browse files
gountharclaude
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>
1 parent 93af0f4 commit 41672f6

3 files changed

Lines changed: 25 additions & 9 deletions

File tree

.devcontainer/linux/Dockerfile

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

43-
# Install wasi-sdk
44-
RUN mkdir /opt/wasi-sdk && \
45-
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 | \
46-
tar zxvf - --strip-components=1 -C /opt/wasi-sdk
43+
# Install wasi-sdk (pre-built binaries available for x86_64 and arm64 only)
44+
RUN ARCH=$(uname -m); \
45+
if [ "$ARCH" = "aarch64" ]; then ARCH=arm64; fi; \
46+
if [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "arm64" ]; then \
47+
mkdir /opt/wasi-sdk && \
48+
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 | \
49+
tar zxvf - --strip-components=1 -C /opt/wasi-sdk; \
50+
else \
51+
mkdir -p /opt/wasi-sdk; \
52+
echo "WASI-SDK not available for $(uname -m), skipping (use -DOCRE_BUILD_DEMO_CONTAINERS=OFF)"; \
53+
fi
4754

4855
FROM ocre-ci AS ocre-dev
4956

.devcontainer/zephyr/Dockerfile

Lines changed: 13 additions & 5 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 && \
@@ -78,7 +85,8 @@ RUN . /opt/zephyr-venv/bin/activate && \
7885
west sdk install --install-base /opt -t \
7986
x86_64-zephyr-elf \
8087
aarch64-zephyr-elf \
81-
arm-zephyr-eabi
88+
arm-zephyr-eabi \
89+
riscv64-zephyr-elf
8290

8391
FROM base AS ocre-ci
8492

.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)