1- FROM ubuntu:24.10 AS gcc_build
2-
3- # Build GCC RISC-V
4- COPY ./install_gcc.sh /home/install_gcc.sh
5- RUN bash /home/install_gcc.sh
6-
7- FROM ubuntu:24.10 AS sdk_setup
1+ FROM ubuntu:24.04
82
93RUN apt-get update -y && \
104 apt-get upgrade -y && \
115 apt-get install --no-install-recommends -y \
12- git \
13- ca-certificates \
14- python3 \
15- tar \
16- build-essential \
17- gcc-arm-none-eabi \
18- libnewlib-arm-none-eabi \
19- libstdc++-arm-none-eabi-newlib \
20- cmake && \
6+ build-essential \
7+ ca-certificates \
8+ cmake \
9+ gcc-arm-none-eabi \
10+ git \
11+ libnewlib-arm-none-eabi \
12+ libstdc++-arm-none-eabi-newlib \
13+ python3 \
14+ tar \
15+ wget && \
2116 apt-get clean && \
2217 rm -rf /var/lib/apt/lists/*
2318
19+ # RISC-V toolchain
20+ ARG RISCV_VERSION=15.2.0-1
21+ ARG TARGETARCH
22+
23+ RUN if [ "$TARGETARCH" = "arm64" ]; then \
24+ ARCH=linux-arm64; \
25+ elif [ "$TARGETARCH" = "amd64" ]; then \
26+ ARCH=linux-x64; \
27+ else \
28+ echo "Unsupported arch: $TARGETARCH" && exit 1; \
29+ fi && \
30+ wget -q https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v${RISCV_VERSION}/xpack-riscv-none-elf-gcc-${RISCV_VERSION}-${ARCH}.tar.gz \
31+ -O /tmp/riscv.tar.gz && \
32+ tar -xzf /tmp/riscv.tar.gz -C /opt && \
33+ rm /tmp/riscv.tar.gz
34+
35+ # Add toolchain to PATH
36+ ENV PATH="/opt/xpack-riscv-none-elf-gcc-${RISCV_VERSION}/bin:${PATH}"
37+
38+ RUN TOOLCHAIN=/opt/xpack-riscv-none-elf-gcc-${RISCV_VERSION}/bin && \
39+ for f in $TOOLCHAIN/riscv-none-elf-*; do \
40+ name=$(basename $f | sed 's/riscv-none-elf/riscv32-unknown-elf/' ); \
41+ ln -s $f /usr/local/bin/$name; \
42+ done
43+
2444# Raspberry Pi Pico SDK
2545ARG SDK_PATH=/usr/local/picosdk
2646RUN git clone --depth 1 --branch 2.1.1 https://github.com/raspberrypi/pico-sdk $SDK_PATH && \
@@ -46,8 +66,3 @@ RUN git clone --depth 1 --branch 2.1.1 https://github.com/raspberrypi/picotool.g
4666 make -j$(nproc) && \
4767 cmake --install . && \
4868 rm -rf /home/picotool
49-
50- # Install GCC RISC-V
51- COPY --from=gcc_build /opt/riscv/gcc14-rp2350-no-zcmp /opt/riscv/gcc14-rp2350-no-zcmp
52- ENV PATH="$PATH:/opt/riscv/gcc14-rp2350-no-zcmp/bin"
53-
0 commit comments