A straightforward dockerfile to get the risc-v toolchain built for all possible abi/arch configurations. Includes a script to generate a bin
directory that can be added to your path, with a wrapper script for each of the gcc commands that calls into docker with the current working directory mapped.
RISC-V toolchain setup is not always trivial. Thus packaged the RISC-V toolchain into a docker image. Running make inside docker, opens this project up inside docker container, which has RISC-V toolchain, and build the project. A good way to make sure, its reproducible.
Clone the riscv-gnu-toolchain repo, locally and run the following command from the root of the repo.
git clone https://github.com/riscv/riscv-gnu-toolchain --recursive --depth 1 /riscv/
Once the git repo is cloned, run the following command from the root of the repo.
docker build -t rv-toolchain-docker .
Once the docker image is built locally, ready to be used. Go to the root of the xv6-riscv
project and run the following command. Takes around 25 minutes to build.
docker run --rm -v $(pwd):/project -w /project -it rv-toolchain-docker:latest make