rv32emu ships two reproducible Docker images that bundle the toolchains
needed for development and architectural testing across x86-64 and
aarch64 hosts. The build script docker/build.sh pushes both images to
Docker Hub via docker buildx, producing linux/amd64 and linux/arm64/v8
manifests for each image.
| Image | Purpose | Recipe |
|---|---|---|
sysprog21/rv32emu-gcc |
RISC-V cross-compiler for building target binaries | docker/Dockerfile-gcc |
sysprog21/rv32emu-sail |
RISC-V SAIL reference simulator used by RISCOF | docker/Dockerfile-sail |
Both images share ubuntu:24.04 as the base layer.
docker/Dockerfile-gcc builds the cross-compiler from source against
riscv/riscv-gnu-toolchain
at tag 2024.04.12. Building from source rather than installing
gcc-riscv64-unknown-elf from apt avoids the
"unsupported ISA subset 'z'" error that the Ubuntu-packaged toolchain
produces on aarch64 hosts (Apple silicon in particular), and building from
source rather than fetching the upstream nightly tarball is required
because that nightly only ships an x86-64 binary.
Build flags used by the image:
--prefix=/opt/riscv--with-arch=rv32gc--with-abi=ilp32dmake newlib(newlib-based bare-metal toolchain, tripleriscv32-unknown-elf-)
To bump GCC, change the git checkout tags/2024.04.12 line in
docker/Dockerfile-gcc and rerun
docker/build.sh.
Host builds outside Docker use
.ci/riscv-toolchain-install.shinstead, which downloads a prebuilt xpackriscv-none-elf-gccrelease (or, withriscv-collabas the first argument, the upstream nightly). That script is not invoked by the Docker images described above.
docker/Dockerfile-sail installs SAIL via opam:
- OCaml base compiler:
5.2.0 sail:0.17.1sail-riscv: cloned fromriscv/sail-riscvand pinned to commit0e9850fed5bee44346e583f334c6e2a6a25d5cd3, then built against the installed SAIL withARCH=RV32 make.
System dependencies installed in the image: opam, zlib1g-dev,
pkg-config, libgmp-dev, z3, and device-tree-compiler.
The final stage copies sail-riscv/c_emulator/riscv_sim_RV32 into the
output image. That binary is the reference signature generator used by
RISCOF (see riscof.md).
$ cd docker
$ ./build.shdocker/build.sh creates a buildx builder named cross-platform-builder
and pushes multi-arch manifests for sysprog21/rv32emu-gcc and
sysprog21/rv32emu-sail. Run it whenever a pinned version above changes.