The objective of this repository is to track the progress and pre-requisites to allow containers and Go applications on RISC-V.
The repo also hosts multiple files and images suited for the SiFive Unmatched and QEmu VMs.
There is a companion article available on https://medium.com/@carlosedp/docker-containers-on-RISC-V-architecture-5bc45725624b.
This page is also linked from http://bit.ly/riscvtracker.
If you like this project and others I've been contributing and would like to support me, please check-out my Patreon page!
- RISC-V Unleashed SBC, Virtual Machines and pre-built binaries
- Golang
- Docker and pre-reqs
- Podman - libpod
- CNI Plugins
- Base Container Images
- Docker images for projects
- Kubernetes
- K3s
- Additional projects / libraries
- Community
- References
To make the development easier, there are Qemu virtual machines based on Debian and Ubuntu with some developer tools already installed.
For the SiFive Unmatched, there is a prebuilt SDcard image at https://github.com/carlosedp/riscv-bringup/releases/download/v1.0/UbuntuHippo-RISC-V.img.gz
For QEmu, there are three distributions of RISC-V pre-packaged VM images:
The user is root
and password riscv
. For more information, check the readme.
A prebuilt Go 1.16 tarball can be downloaded here.
If required to build the complete boot stack composed of OpenSBI, U-Boot, Linux, checkout the guides for SiFive Unmatched, SiFive Unleashed and Qemu.
To run Go on the VM or board, install with:
# Start the VM
./run_debian.sh
# Download Golang tarball
wget https://github.com/carlosedp/riscv-bringup/releases/download/v1.0/go1.16.5-riscv64.tar.gz
# In the VM, unpack (in root dir for example)
tar vxf go1.16.5-riscv64.tar.gz -C /usr/local/
# Add to your PATH
export PATH="/usr/local/go/bin:$PATH"
# Addto bashrc
echo "export PATH=/usr/local/go/bin:$PATH" >> ~/.bashrc
To run Docker on your RISC-V Debian or Ubuntu environment, download a deb package and install with sudo apt install ./docker-v20.10.2-dev_riscv64.deb
.
For other distros get the tarball here and unpack to your /
dir. If the docker service doesn't start on install script, re-run systemctl start docker
.
Docker-compose install instructions
# In Debian image
sudo apt-get install python3 python3-dev python3-pip
# For Fedora image
sudo dnf install python3-devel
sudo pip3 install docker-compose
To test it out after install, just run docker run -d -p 8080:8080 carlosedp/echo-riscv
and then curl http://localhost:8080
.
There are a couple of projects that build on RISC-V in my go-playground repo.
There is also a Podman package here in both .deb
and .tar.gz
. Check more info on build-podman-env.md to build the package from scratch.
Golang has been upstreamed as an experimental architecture in Go 1.14. There are no binaries published officially but the releases section has the tarball.
To build Go from source, check build-golang.md.
- Golang upstreaming
- Tracker Issue: golang/go#27532
- Gerrit CLs: https://go-review.googlesource.com/q/riscv+OR+riscv64
- RISC-V Fork: https://github.com/4a6f656c/riscv-go
- CGO implementation(fork) - golang/go#36641
-
golang.org/x/sys
- https://go-review.googlesource.com/c/sys/+/177799 -
golang.org/x/net
- https://go-review.googlesource.com/c/net/+/177997 -
golang.org/x/sys
- Add riscv64 toendian_little.go
- golang/sys#38
- Qemu atomic bug
- Qemu patch - http://lists.nongnu.org/archive/html/qemu-riscv/2019-05/msg00134.html
- Fix for Qemu in 4.1 - https://wiki.qemu.org/ChangeLog/4.1#RISC-V
- Kernel Patch - https://patchwork.kernel.org/patch/10997887/
To build a complete Docker container stack, check the build-docker-env.md document.
Downloads for prebuilt packages are available on https://github.com/carlosedp/riscv-bringup/releases.
https://github.com/seccomp/libseccomp
Builds fine from master branch. Will be released with riscv64 support on 2.5.
- Kernel support - https://patchwork.kernel.org/project/linux-riscv/list/?series=164025
-
PR - seccomp/libseccomp#134 - PR - seccomp/libseccomp#197
- Issue - seccomp/libseccomp#110
https://github.com/opencontainers/runc
- Upstreamed / Works
- Depends on CGO (to build nsenter)
- Support
buildmode=pie
- Add
riscv64
tolibcontainer/system/syscall_linux_64.go
- After upstreaming, update
x/sys
andx/net
modules - libseccomp-dev
- apparmor - (
$ sudo aa-status -> apparmor module is not loaded.
) - Add to CI
https://github.com/giuseppe/crun
No changes required, builds fine even without Kernel support for seccomp. Depends on libseccomp.
- Upstreamed / Works
- Rebuild with libseccomp
- Add to CI
https://github.com/containerd/containerd/
- Upstreamed / Works
- PR containerd/containerd#3328
- Add to CI
https://github.com/docker/cli
- Upstreamed / Works (must be built from
master
) - Update
x/sys
andx/net
modules invendor
. PR - Add riscv64 to manifest annotation. PR#2084
- Add support for riscv64 on binfmt. PR#21
- Docker for Mac - Add RISC-V binfmt. PR#4237
- Add to CI
https://github.com/moby/moby
- Upstreamed / Works
- PR moby/moby#40664 - Build scripts support for riscv64
- PR moby/moby#39423 - Update dependencies
- PR moby/moby#39327 - Remove CGO dependency
- Update
x/sys
andx/net
modules invendor
. - Update
etcd-io/bbolt
invendor
. - Update
github.com/vishvananda/netns
invendor
- Update
github.com/vishvananda/netlink
invendor
- Update
github.com/ishidawataru/sctp
invendor
- Update
github.com/docker/libnetwork
invendor
- Add to CI
Dependency lib PRs:
- Upstreamed / Works
- netns PR - vishvananda/netns#34 or fork into moby as moby/moby#39404
- libnetwork PR - moby/libnetwork#2389
- libnetwork PR netns - moby/libnetwork#2412
https://github.com/krallin/tini
No changes required. Just build and copy tini-static to /usr/local/bin/docker-init
- Upstreamed / Works
No changes required. https://github.com/docker/libnetwork/cmd/proxy
- Upstreamed / Works
Alternative is run dockerd as: sudo dockerd --userland-proxy=false
- moby/moby#39461 - Error on interactive terminal and log tail. When launching a container with
-it
the console is not presented. After killing the container, the inputs given are shown. Also log tailing withlogs -f
does not tail. - containerd/containerd#3389 - Containerd CPU 100% Issue
- Fixed by golang/sys#40 thru PR containerd/containerd#3526
https://github.com/containers/libpod
Podman is a library and tool for running OCI-based containers in Pods
- PR to remove CGO dependency containers/podman#3437
- PR for containers/storage - containers/storage#375
- PR for containers/psgo - containers/psgo#53
- Add to CI
https://github.com/containernetworking/plugins
- Builds and runs.
- Podman CNI Issue - containers/podman#3462
- Debian Sid (Multiarch) ->
carlosedp/debian:sid
- Debian Sid Slim (Multiarch) ->
carlosedp/debian:sid-slim
- Debian Sid iptables Slim (Multiarch) ->
carlosedp/debian-iptables:sid-slim
- Busybox (1.31.0) ->
carlosedp/busybox:1.31
- Go 1.14 (Multiarch) ->
carlosedp/golang:1.14
- rabbitmq -> riscv64/rabbitmq
- busybox -> riscv64/busybox
- buildpack-deps -> riscv64/buildpack-deps
- ubuntu -> riscv64/ubuntu
- debian -> riscv64/debian
- hello-world -> riscv64/hello-world
- alpine -> riscv64/alpine
OpenFaaS:
- faas-gateway -
carlosedp/faas-gateway:riscv64
- faas-basic-auth-plugin -
carlosedp/faas-basic-auth-plugin:riscv64
- faas-swarm -
carlosedp/faas-swarm:riscv64
- faas-netes -
carlosedp/faas-netes:riscv64
- nats-streaming -
carlosedp/faas-nats-streaming:riscv64
- queue-worker -
carlosedp/faas-queue-worker:riscv64
- watchdog -
carlosedp/faas-watchdog:riscv64
- Function base -
carlosedp/faas-debianfunction:riscv64
- Figlet -
carlosedp/faas-figlet:riscv64
- MarkdownRender -
carlosedp/faas-markdownrender:riscv64
- QRCode -
carlosedp/faas-qrcode:riscv64
Prometheus:
- Prometheus -
carlosedp/prometheus:v2.11.1-riscv64
- AlertManager -
carlosedp/alertmanager:v0.18.0-riscv64
Traefik:
- traefik v2 -
carlosedp/traefik:v2.1-riscv64
- whoami -
carlosedp/whoami:riscv64
Kubernetes:
- kube-apiserver -
carlosedp/kube-apiserver:1.16.0
- kube-scheduler -
carlosedp/kube-scheduler:1.16.0
- kube-controller-manager -
carlosedp/kube-controller-manager:1.16.0
- kube-proxy -
carlosedp/kube-proxy:1.16.0
- pause -
carlosedp/pause:3.1
- flannel -
carlosedp/flannel:v0.11.0
- etcd (v3.5.0) -
carlosedp/etcd:3.3.10
- CoreDNS (v1.6.3) -
carlosedp/coredns:v1.6.2
Kubernetes images are multi-arch with manifests to arm
, arm64
, amd64
, riscv64
and ppc64le
.
Some version mismatches due to Kubernetes hard-coded version check for CoreDNS and etcd.
Misc Images:
- Echo demo -
carlosedp/echo-riscv
- Whoami (Traefik demo) -
carlosedp/whoami:riscv64
- Kubernetes Pause -
carlosedp/k8s-pause:riscv64
- CoreDNS v1.3.0 -
carlosedp/coredns:v1.3.0-riscv64
https://github.com/kubernetes/kubernetes/
Building and deploying Kubernetes or K3s on RISC-V is detailed on a dedicated readme. There is a build script(build_images.sh
) for custom images in kubernetes
dir.
-
github.com/mindprince/gonvml
- PR mindprince/gonvml#13 - Stub nocgo functions -
github.com/opencontainers/runc
- PR opencontainers/runc#2123 - Bump x/sys and support syscall. -
k8s.io/kubernetes/
- PR kubernetes/kubernetes#82342 - Bumpmindprince/gonvml
and change directives onpkg/kubelet/cadvisor
files -
k8s.io/kubernetes/
- PR kubernetes/kubernetes#82349 - Bumpopencontainers/runc
andx/sys
to support RISC-V -
k8s.io/kubernetes/
- PR kubernetes/kubernetes#86013 - Bump Ginkgo to support building on riscv64 arch -
k8s.io/kubernetes/
- PR kubernetes/kubernetes#86011 - Add build support for riscv64 arch -
google/cadvisor
- PR google/cadvisor#2364 - Ignore CPU clock for riscv64
To Do:
- Cross-platform builder image. Update
kubernetes/build/build-image/cross
adding riscv64 toolchain. Depends on Ubuntucrossbuild-essential-riscv64
be available. - Add riscv64 to ./build/pause Makefile. Depends on Go image with RISC-V support and cross-platform image.
Updating dependencies
# Update dependency
./hack/pin-dependency.sh github.com/mindprince/gonvml
# Update vendor dir
./hack/update-vendor.sh
# Build all main binaries
make KUBE_BUILD_PLATFORMS=linux/riscv64
# Build specifiv binaries
make WHAT=./cmd/${bin} KUBE_BUILD_PLATFORMS=linux/riscv64
# Binaries will be placed on _output/local/go/bin/linux_riscv64/
https://github.com/rancher/k3s/
K3s build depends on deploying external etcd database since sqlite embedded DB requires CGO. Another requirement is running k3s with Docker and crun as daemon (see Docker install) since runc, the default runtime for K3s requires CGO as well.
For more info, check file [kubernetes/Readme.md#K3s]
Bump:
-
<github.com/opencontainers/runc>
-
<github.com/rancher/kine>
-
github.com/rancher/kine
- PR#14 - Stub-out sqlite drivers to build Kine without CGO -
github.com/rancher/kine
- PR#19 - Update function signature on nocgo stub -
Bump
github.com/google/cadvisor
after merge -
Bump
github.com/mindprince/gonvml
-
Bump
github.com/rancher/kine
after merge -
Bump
k8s.io/kubernetes
after merge -
Bump
golang.org/x/sys
Future
- Embed database
- Embed runtime
https://github.com/etcd-io/etcd
Build with go build .
, run with ETCD_UNSUPPORTED_ARCH=riscv64 ./etcd
.
- Upstreamed / Works
- PR etcd-io/etcd#10834
- Bump
golang.org/x/net
- Bump
golang.org/x/sys
OpenFaaS is already upstreamed but still does not build images for RISC-V so I've built them and pushed to my DockerHub as links below. Here are the instructions to deploy OpenFaaS on your RISC-V host or VM.
The PRs do not add functionality to cross-build the images for RISC-V yet since the base images still don't support the architecture. Check the build_images.sh
script to build the images manually.
https://github.com/openfaas/faas-cli/
- Update
x/sys
- PR - openfaas/faas-cli#667
- Add to CI
https://github.com/openfaas/faas-swarm
- Depends on
x/sys
PR golang/sys#38 - Update
x/sys
,x/net
- PR - openfaas/faas-swarm#52
- Add to CI
https://github.com/nats-io/nats-streaming-server
- Bump
x/sys
,etcd/bbolt
. - PR - nats-io/nats-streaming-server#891
- Add to CI
- FaaS - https://github.com/openfaas/faas/
- Nats-queue-worker - https://github.com/openfaas/nats-queue-worker
- Faas-netes - https://github.com/openfaas/faas-netes
- Faas-idler - https://github.com/openfaas-incubator/faas-idler
https://github.com/etcd-io/bbolt
- Upstreamed / Works
- PR - etcd-io/bbolt#159
https://github.com/kr/pty
- Upstreamed / Works
-
kr/pty
(https://github.com/kr/pty/pull/81)
https://github.com/prometheus/prometheus
Builds successfully with make build
.
- Upstreamed / Works
- PR
prometheus/prometheus#5621-> prometheus/prometheus#5883 - Bump
x/sys
andx/net
modules - Apply patch from https://github.com/carlosedp/prometheus/commit/19e7ec54724240cde9768384736ff6ab88b1ace2
- Add to CI
https://github.com/prometheus/promu
- Upstreamed / Works
- PR prometheus/promu#146
- Bump
x/sys
andx/net
modules - Add to CI
https://github.com/prometheus/alertmanager
Already builds successfully with make build
.
- Upstreamed / Works
- PR prometheus/alertmanager#1984
https://github.com/containous/traefik
- Upstreamed / Works
- PR traefik/traefik#5245
Building and running
rm -rf static/ autogen/
make generate-webui
go generate
mkdir dist
GOARCH=riscv64 GOOS=linux go build -o dist/traefik ./cmd/traefik
docker build -t carlosedp/traefik:v2.1-riscv64 .
See also a complete Traefik Dockerfile for cross-compiling.
To run an example stack with Docker Compose, create the file below and start it with docker-compose up -d
. To test, you can open the address http://[IP]:8080/dashboard
or curl http://localhost:8080/api/rawdata
. Prometheus metrics are exposed on http://localhost:8080/metrics
.
Create a docker-compose.yml
version: '3'
services:
reverse-proxy:
# The official v2.0 Traefik docker image
image: carlosedp/traefik:v2.0-riscv64
# Enables the web UI and tells Traefik to listen to docker
command: --api --providers.docker --metrics.prometheus=true
ports:
# The HTTP port
- "80:80"
# The Web UI (enabled by --api)
- "8080:8080"
volumes:
# So that Traefik can listen to the Docker events
- /var/run/docker.sock:/var/run/docker.sock
whoami:
# A container that exposes an API to show its IP address
image: carlosedp/whoami:riscv64
labels:
- "traefik.http.routers.whoami.rule=Host(`whoami.docker.localhost`)"
Run with:
docker-compose up -d
SQLite builds on RISC-V but requires replacing its building files.
Repository mirror: https://github.com/CanonicalLtd/sqlite
- Upstreamed / Works
- Update
config.guess
andconfig.sub
to newer version. Posted to mailing list.
https://github.com/google/go-jsonnet
- Upstreamed / Works
- Update
x/sys
- PR google/go-jsonnet#284
https://github.com/github/hub
- Upstreamed / Works
- Update
x/sys
- PR mislav/hub#2153
https://github.com/labstack/echo
- Upstreamed / Works
- Update
x/sys
- Update
x/net
- PR labstack/echo#1344
https://github.com/labstack/gommon
- Upstreamed / Works
- Update
x/sys
- PR labstack/gommon#32
https://github.com/LK4D4/vndr
- Upstreamed / Works
- PR LK4D4/vndr#80
https://github.com/alexellis/inlets
- Upstreamed / Works
- PR https://github.com/alexellis/inlets/pull/78
- Add to CI
https://github.com/gin-gonic/gin
-
Depends on
github.com/mattn/go-isatty
. -
Upstreamed / Works
https://github.com/mattn/go-isatty
Dependency for Gin Framework
https://github.com/onsi/ginkgo
Dependency for building Kubernetes complete binaries
https://github.com/estesp/mquery
A simple utility and serverless-based backend for querying Docker v2 & OCI v1 container images and reporting on "manifest list"/OCI "index" multi-platform image support.
- Upstreamed / Works
- PR estesp/mquery#22
- Slack channel #RISC-V on https://invite.slack.golangbridge.org