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!
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.
# 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.org/x/sys - https://go-review.googlesource.com/c/sys/+/177799golang.org/x/net - https://go-review.googlesource.com/c/net/+/177997golang.org/x/sys - Add riscv64 to endian_little.go - https://github.com/golang/sys/pull/38To 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.
https://github.com/opencontainers/runc
buildmode=pieriscv64 to libcontainer/system/syscall_linux_64.gox/sys and x/net modules$ sudo aa-status -> apparmor module is not loaded.)https://github.com/giuseppe/crun
No changes required, builds fine even without Kernel support for seccomp. Depends on libseccomp.
https://github.com/containerd/containerd/
master)x/sys and x/net modules in vendor. PRx/sys and x/net modules in vendor.etcd-io/bbolt in vendor.github.com/vishvananda/netns in vendorgithub.com/vishvananda/netlink in vendorgithub.com/ishidawataru/sctp in vendorgithub.com/docker/libnetwork in vendorDependency lib PRs:
https://github.com/krallin/tini
No changes required. Just build and copy tini-static to /usr/local/bin/docker-init
No changes required. https://github.com/docker/libnetwork/cmd/proxy
Alternative is run dockerd as: sudo dockerd --userland-proxy=false
-it the console is not presented. After killing the container, the inputs given are shown. Also log tailing with logs -f does not tail.
https://github.com/containers/libpod
Podman is a library and tool for running OCI-based containers in Pods
https://github.com/containernetworking/plugins
carlosedp/debian:sidcarlosedp/debian:sid-slimcarlosedp/debian-iptables:sid-slimcarlosedp/busybox:1.31carlosedp/golang:1.14OpenFaaS:
carlosedp/faas-gateway:riscv64carlosedp/faas-basic-auth-plugin:riscv64carlosedp/faas-swarm:riscv64carlosedp/faas-netes:riscv64carlosedp/faas-nats-streaming:riscv64carlosedp/faas-queue-worker:riscv64carlosedp/faas-watchdog:riscv64carlosedp/faas-debianfunction:riscv64carlosedp/faas-figlet:riscv64carlosedp/faas-markdownrender:riscv64carlosedp/faas-qrcode:riscv64Prometheus:
carlosedp/prometheus:v2.11.1-riscv64carlosedp/alertmanager:v0.18.0-riscv64Traefik:
carlosedp/traefik:v2.1-riscv64carlosedp/whoami:riscv64Kubernetes:
carlosedp/kube-apiserver:1.16.0carlosedp/kube-scheduler:1.16.0carlosedp/kube-controller-manager:1.16.0carlosedp/kube-proxy:1.16.0carlosedp/pause:3.1carlosedp/flannel:v0.11.0carlosedp/etcd:3.3.10carlosedp/coredns:v1.6.2Kubernetes 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:
carlosedp/echo-riscvcarlosedp/whoami:riscv64carlosedp/k8s-pause:riscv64carlosedp/coredns:v1.3.0-riscv64https://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 https://github.com/mindprince/gonvml/pull/13 - Stub nocgo functionsgithub.com/opencontainers/runc - PR https://github.com/opencontainers/runc/pull/2123 - Bump x/sys and support syscall.k8s.io/kubernetes/ - PR https://github.com/kubernetes/kubernetes/pull/82342 - Bump mindprince/gonvml and change directives on pkg/kubelet/cadvisor filesk8s.io/kubernetes/ - PR https://github.com/kubernetes/kubernetes/pull/82349 - Bump opencontainers/runc and x/sys to support RISC-Vk8s.io/kubernetes/ - PR https://github.com/kubernetes/kubernetes/pull/86013 - Bump Ginkgo to support building on riscv64 archk8s.io/kubernetes/ - PR https://github.com/kubernetes/kubernetes/pull/86011 - Add build support for riscv64 archgoogle/cadvisor - PR https://github.com/google/cadvisor/pull/2364 - Ignore CPU clock for riscv64To Do:
kubernetes/build/build-image/cross adding riscv64 toolchain. Depends on Ubuntu crossbuild-essential-riscv64 be available.# 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
https://github.com/etcd-io/etcd
Build with go build ., run with ETCD_UNSUPPORTED_ARCH=riscv64 ./etcd.
golang.org/x/netgolang.org/x/sysOpenFaaS 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/
x/syshttps://github.com/openfaas/faas-swarm
x/sys PR https://github.com/golang/sys/pull/38x/sys, x/nethttps://github.com/nats-io/nats-streaming-server
x/sys, etcd/bbolt.https://github.com/etcd-io/bbolt
kr/pty (https://github.com/kr/pty/pull/81)https://github.com/prometheus/prometheus
Builds successfully with make build.
x/sys and x/net moduleshttps://github.com/prometheus/promu
x/sys and x/net moduleshttps://github.com/prometheus/alertmanager
Already builds successfully with make build.
https://github.com/containous/traefik
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
config.guess and config.sub to newer version. Posted to mailing list.https://github.com/google/go-jsonnet
x/sysx/syshttps://github.com/labstack/echo
x/sysx/nethttps://github.com/labstack/gommon
x/syshttps://github.com/alexellis/inlets
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.
Shell
68.2%
Roff
14.5%
C
6.9%
Dockerfile
3.6%
JavaScript
3.3%
Ruby
2.3%
Go
1.1%
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!
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.
# 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.org/x/sys - https://go-review.googlesource.com/c/sys/+/177799golang.org/x/net - https://go-review.googlesource.com/c/net/+/177997golang.org/x/sys - Add riscv64 to endian_little.go - https://github.com/golang/sys/pull/38To 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.
https://github.com/opencontainers/runc
buildmode=pieriscv64 to libcontainer/system/syscall_linux_64.gox/sys and x/net modules$ sudo aa-status -> apparmor module is not loaded.)https://github.com/giuseppe/crun
No changes required, builds fine even without Kernel support for seccomp. Depends on libseccomp.
https://github.com/containerd/containerd/
master)x/sys and x/net modules in vendor. PRx/sys and x/net modules in vendor.etcd-io/bbolt in vendor.github.com/vishvananda/netns in vendorgithub.com/vishvananda/netlink in vendorgithub.com/ishidawataru/sctp in vendorgithub.com/docker/libnetwork in vendorDependency lib PRs:
https://github.com/krallin/tini
No changes required. Just build and copy tini-static to /usr/local/bin/docker-init
No changes required. https://github.com/docker/libnetwork/cmd/proxy
Alternative is run dockerd as: sudo dockerd --userland-proxy=false
-it the console is not presented. After killing the container, the inputs given are shown. Also log tailing with logs -f does not tail.
https://github.com/containers/libpod
Podman is a library and tool for running OCI-based containers in Pods
https://github.com/containernetworking/plugins
carlosedp/debian:sidcarlosedp/debian:sid-slimcarlosedp/debian-iptables:sid-slimcarlosedp/busybox:1.31carlosedp/golang:1.14OpenFaaS:
carlosedp/faas-gateway:riscv64carlosedp/faas-basic-auth-plugin:riscv64carlosedp/faas-swarm:riscv64carlosedp/faas-netes:riscv64carlosedp/faas-nats-streaming:riscv64carlosedp/faas-queue-worker:riscv64carlosedp/faas-watchdog:riscv64carlosedp/faas-debianfunction:riscv64carlosedp/faas-figlet:riscv64carlosedp/faas-markdownrender:riscv64carlosedp/faas-qrcode:riscv64Prometheus:
carlosedp/prometheus:v2.11.1-riscv64carlosedp/alertmanager:v0.18.0-riscv64Traefik:
carlosedp/traefik:v2.1-riscv64carlosedp/whoami:riscv64Kubernetes:
carlosedp/kube-apiserver:1.16.0carlosedp/kube-scheduler:1.16.0carlosedp/kube-controller-manager:1.16.0carlosedp/kube-proxy:1.16.0carlosedp/pause:3.1carlosedp/flannel:v0.11.0carlosedp/etcd:3.3.10carlosedp/coredns:v1.6.2Kubernetes 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:
carlosedp/echo-riscvcarlosedp/whoami:riscv64carlosedp/k8s-pause:riscv64carlosedp/coredns:v1.3.0-riscv64https://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 https://github.com/mindprince/gonvml/pull/13 - Stub nocgo functionsgithub.com/opencontainers/runc - PR https://github.com/opencontainers/runc/pull/2123 - Bump x/sys and support syscall.k8s.io/kubernetes/ - PR https://github.com/kubernetes/kubernetes/pull/82342 - Bump mindprince/gonvml and change directives on pkg/kubelet/cadvisor filesk8s.io/kubernetes/ - PR https://github.com/kubernetes/kubernetes/pull/82349 - Bump opencontainers/runc and x/sys to support RISC-Vk8s.io/kubernetes/ - PR https://github.com/kubernetes/kubernetes/pull/86013 - Bump Ginkgo to support building on riscv64 archk8s.io/kubernetes/ - PR https://github.com/kubernetes/kubernetes/pull/86011 - Add build support for riscv64 archgoogle/cadvisor - PR https://github.com/google/cadvisor/pull/2364 - Ignore CPU clock for riscv64To Do:
kubernetes/build/build-image/cross adding riscv64 toolchain. Depends on Ubuntu crossbuild-essential-riscv64 be available.# 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
https://github.com/etcd-io/etcd
Build with go build ., run with ETCD_UNSUPPORTED_ARCH=riscv64 ./etcd.
golang.org/x/netgolang.org/x/sysOpenFaaS 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/
x/syshttps://github.com/openfaas/faas-swarm
x/sys PR https://github.com/golang/sys/pull/38x/sys, x/nethttps://github.com/nats-io/nats-streaming-server
x/sys, etcd/bbolt.https://github.com/etcd-io/bbolt
kr/pty (https://github.com/kr/pty/pull/81)https://github.com/prometheus/prometheus
Builds successfully with make build.
x/sys and x/net moduleshttps://github.com/prometheus/promu
x/sys and x/net moduleshttps://github.com/prometheus/alertmanager
Already builds successfully with make build.
https://github.com/containous/traefik
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
config.guess and config.sub to newer version. Posted to mailing list.https://github.com/google/go-jsonnet
x/sysx/syshttps://github.com/labstack/echo
x/sysx/nethttps://github.com/labstack/gommon
x/syshttps://github.com/alexellis/inlets
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.
Shell
68.2%
Roff
14.5%
C
6.9%
Dockerfile
3.6%
JavaScript
3.3%
Ruby
2.3%
Go
1.1%