Skip to content
Risc-V journey thru containers and new projects
Shell Dockerfile Go
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
OpenFaaS Add OpenFaaS sample functions Aug 1, 2019
Qemu-VM.md Add reference to Qemu atomic bug. Jun 3, 2019
Readme.md Remove examples, move to carlosedp/go-playground Aug 19, 2019
build-docker-env.md Dockerd is upstream Jul 3, 2019
build-podman-env.md Add podman pack link Jul 1, 2019

Readme.md

Risc-V bring-up tracker

The objective of this repository is to track the progress and pre-requisites to allow containers and Go applications on Risc-V.

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!

Contents

Risc-V Virtual Machine, pre-built Go and Docker

To make the development easier, there is a Qemu virtual machine based on Debian with developer tools already installed.

The VM pack can be downloaded here. For more information, check the readme.

The prebuilt Go 1.13 tarball can be downloaded here.

To run Go on this VM, download both files and install with:

Instructions
# Copy the tarball to the VM
scp -P 22222 go-1.13dev-riscv.tar.gz root@localhost:

# In the VM, unpack (in root dir for example)
tar vxf go-1.13dev-riscv.tar.gz

# Link the files
rmdir /usr/local/go
ln -sf /root/riscv-go/ /usr/local/go

# 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 environment, get the pack here and use the install.sh script.

To test it out after install, just run docker run -d -p 8080:8080 carlosedp/echo-riscv and then curl http://localhost:8080.

There is also a Podman package. Check more info on build-podman-env.md.

Building Go on your Risc-V VM or SBC

Golang is still not upstreamed so to build it from source, you will need a machine to do the initial bootstrap, copy this bootstraped tree to your Risc-V host or VM and then build the complete Go distribution. This bootstrap host can be a Windows, Mac or Linux.

Instructions
# On bootstrap Host
git clone https://github.com/4a6f656c/riscv-go
cd riscv-go/src
GOOS=linux GOARCH=riscv64 ./bootstrap.bash
# Copy the generated boostrap pack to the VM/SBC
scp -P 22222 ../../go-linux-riscv64-bootstrap.tbz root@localhost: # In case you use the VM provided above

Now on your Risc-V VM/SBC, clone the repository, export the path and bootstrap path you unpacked and build/test:

# On Risc-V Host
tar vxf go-linux-riscv64-bootstrap.tbz
git clone https://github.com/4a6f656c/riscv-go
cd riscv-go
export GOROOT_BOOTSTRAP=$HOME/go-linux-riscv64-bootstrap
export PATH="$(pwd)/misc/riscv:$(pwd)/bin:$PATH"
cd src
GOGC=off ./make.bash                            # Builds go on $HOME/riscv-go/bin that can be added to your path
GOGC=off  GO_TEST_TIMEOUT_SCALE=10 ./run.bash   # Tests the build
# Pack built Golang into a tarball
cd ..
sudo tar -cvf go-1.13dev-riscv.tar --transform s/^riscv-go/go/ --exclude=pkg/obj --exclude .git riscv-go

Now you can use this go build for testing/developing other projects.


Go Dependencies

Core Golang

Go Libraries

External deps


Docker and pre-reqs

To build a complete container environment, check the build-docker-env.md document.

Libseccomp (https://github.com/seccomp/libseccomp)

Builds fine with PR 134 even without Kernel support.

Runc (https://github.com/opencontainers/runc)

  • Upstreamed / Works
  • CGO (to build nsenter)
  • Support buildmode=pie
  • Add riscv64 to libcontainer/system/syscall_linux_64.go
  • After upstreaming, update x/sys and x/net modules
  • libseccomp-dev
  • apparmor - ($ sudo aa-status -> apparmor module is not loaded.)
  • Add to CI

Crun (https://github.com/giuseppe/crun)

No changes required, builds fine even without Kernel support for seccomp. Depends on libseccomp.

  • Upstreamed / Works
  • libseccomp
  • Add to CI

Containerd (https://github.com/containerd/containerd/)

Docker

Docker cli (github.com/docker/cli)

  • Upstreamed / Works
  • Update x/sys and x/net modules in vendor. PR
  • Add to CI

Docker daemon

  • Upstreamed / Works
  • PR https://github.com/moby/moby/pull/39423 - Update dependencies
  • PR https://github.com/moby/moby/pull/39327 - Remove CGO dependency
  • Update x/sys and x/net modules in vendor.
  • Update etcd-io/bbolt in vendor.
  • Update github.com/vishvananda/netns in vendor
  • Update github.com/vishvananda/netlink in vendor
  • Update github.com/ishidawataru/sctp in vendor
  • Update github.com/docker/libnetwork in vendor
  • Add to CI

Dependency lib PRs:

docker-init (https://github.com/krallin/tini)

No changes required. Just build and copy tini-static to /usr/local/bin/docker-init

  • Upstreamed / Works

docker-proxy

No changes required. https://github.com/docker/libnetwork/cmd/proxy

  • Upstreamed / Works

Alternative is run dockerd as: sudo dockerd --userland-proxy=false

Issues


Podman - libpod (https://github.com/containers/libpod)

Issues


Base Container Images


Additional projects / libraries

OpenFaaS

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.

Images:

Faas-cli (https://github.com/openfaas/faas-cli/)

Faas-swarm (https://github.com/openfaas/faas-swarm)

FaaS (https://github.com/openfaas/faas/)

No changes required.

  • Add to CI

Nats-streaming-server (https://github.com/nats-io/nats-streaming-server)

Nats-queue-worker (https://github.com/openfaas/nats-queue-worker)

No changes required.

  • Add to CI

Sample Functions

Bbolt (https://github.com/etcd-io/bbolt)

Pty (https://github.com/kr/pty)

ETCD

Build with go build ., run with ETCD_UNSUPPORTED_ARCH=riscv64 ./etcd.

Kubernetes

Dependencies for kubelet:

  • Upstreamed / Works
  • x/net
  • x/sys
  • bbolt
  • runc/libcontainers -> CGO
  • cadvisor/accelerators/nvidia -> github.com/mindprince/gonvml depends on CGO
  • ???

Prometheus (https://github.com/prometheus/prometheus/)

Already builds successfully with make build after updating modules.

Promu (https://github.com/prometheus/promu/)

Already builds successfully.

AlertManager (https://github.com/prometheus/alertmanager/)

Already builds successfully with make build.

SQlite

Repository mirror: https://github.com/CanonicalLtd/sqlite

  • Upstreamed / Works
  • Update config.guess and config.sub to newer version. Posted to mailing list.

LXD

  • Upstreamed / Works
  • LXC build successfully
  • SQLite config update to build successfully
  • CGO to build storage backends

Go-Jsonnet (https://github.com/google/go-jsonnet)

Github Hub tool (https://github.com/github/hub)

Labstack Echo Framework (https://github.com/labstack/echo)

Labstack Gommon (https://github.com/labstack/gommon)

VNDR (https://github.com/LK4D4/vndr)

Inlets (https://github.com/alexellis/inlets)

Gin web framework (https://github.com/gin-gonic/gin)

go-isatty (https://github.com/mattn/go-isatty)

Dependency for Gin Framework


Community

References

You can’t perform that action at this time.