Run the docker container, SSH in, and you’re on an emulated RISC-V core running Debian.

I wanted to see if I could make a simpler version of the RISC-V emulated system on WSL2, allowing anyone to quickly get started without too much setup. I was able to solve by packing it all into a Docker container.

What is it

A pre-configured QEMU & Debian RISC-V Docker image. Allows you to get started working on an emulated RISC-V environment. Is a quick way to see what libraries and frameworks work on RISC-V without sourcing hardware.

Structure:

  • Debian host (debian:11)
    • QEMU. Running as emulated RISC-V with soft-mmu support
      • Debian guest. RISC-V image
      • RISC-V u-boot kernel

Get started immediately with DockerHub

To get started, you need to run the Docker image, and SSH in. You’ll then be in a Debian envornment running an emulated RISC-V core, ready to compile and run applications.

# 1 Get the image
docker pull davidburela/riscv-emulator

# 2. 
# Run with QEMU default of 2CPU & 2G ram. 
# Expose port 2222 which is routed through into the QEMU RISC-V guest
docker run -d --publish 127.0.0.1:2222:2222/tcp davidburela/riscv-emulator

# 3. SSH directly into the QEMU RISC-V guest, the default password is "root". (Might take a few minutes for guest to start)
ssh root@localhost -p 2222

Seeing RISC-V cores in Debian

Build the image yourself

The docker file is available on GitHub. If you want to see how it is put together. Also allows you to manually upgrade versions of docker base image, QEMU, or the risc-v debian image.

Background

I have been experimenting with getting different projects running on RISC-V. This docker image allowed me to quickly spin up new experiments and validate