From fd4317edb750d797c68c92415b15a7d35b48f6b2 Mon Sep 17 00:00:00 2001 From: tmeissner Date: Fri, 30 Jul 2021 10:58:17 +0200 Subject: [PATCH] Add dockerfile & make targets for risc-v toolchain --- Makefile | 20 +++++++++++--------- riscv-gcc.Dockerfile | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 9 deletions(-) create mode 100644 riscv-gcc.Dockerfile diff --git a/Makefile b/Makefile index b3be621..3340ee1 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: symbiyosys ghdl-formal all NOCACHE clean copy +.PHONY: symbiyosys ghdl-formal riscv-gcc all NOCACHE clean copy # Support for make environment variable NOCACHE ifeq (NOCACHE,$(lastword $(MAKECMDGOALS))) @@ -19,25 +19,27 @@ else endif -all: symbiyosys ghdl-formal +all: symbiyosys ghdl-formal riscv-gcc -copy: ghdl-formal_${TAG}.tar.gz +copy: copy-ghdl copy-riscv +copy-ghdl: ghdl-formal_${TAG}.tar.gz +copy-riscv: riscv-gcc_${TAG}.tar.gz .SECONDEXPANSION: -symbiyosys ghdl-formal: $$@.Dockerfile +symbiyosys ghdl-formal riscv-gcc: $$@.Dockerfile docker build ${OPTIONS} -t $@:${TAG} -f $@.Dockerfile . -ghdl-formal_${TAG}.tar.gz: +%_${TAG}.tar.gz: mkdir -p artefacts - docker run --rm -dit --name=ghdl-dummy ghdl-formal:${TAG} > /dev/null - docker cp ghdl-dummy:/opt/. artefacts - docker rm -f ghdl-dummy > /dev/null + docker run --rm -dit --name=$*-dummy $*:${TAG} > /dev/null + docker cp $*-dummy:/opt/. artefacts + docker rm -f $*-dummy > /dev/null tar -C artefacts -czf $@ . shasum --algorithm 256 --UNIVERSAL $@ > $@.sha256 clean: rm -rf artefacts - rm -f ghdl-formal_*.tar.* + rm -f *.tar.* diff --git a/riscv-gcc.Dockerfile b/riscv-gcc.Dockerfile new file mode 100644 index 0000000..d6c3567 --- /dev/null +++ b/riscv-gcc.Dockerfile @@ -0,0 +1,39 @@ +# Dockerfile to build Risc-V toolchain for +# rv32i instruction set and ilp32 ABI +# Useful to compile for NEORV32 target + +FROM debian:buster-slim as riscv-gcc + +# Get dependencies +RUN apt-get update -qq && \ + DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \ + ca-certificates \ + autoconf \ + automake \ + autotools-dev \ + curl \ + python3 \ + libmpc-dev \ + libmpfr-dev \ + libgmp-dev \ + gawk \ + build-essential \ + bison \ + flex \ + texinfo \ + gperf \ + libtool \ + patchutils \ + bc \ + zlib1g-dev \ + libexpat-dev \ + git && \ + apt-get autoclean && apt-get clean && apt-get -y autoremove && \ + update-ca-certificates && \ + rm -rf /var/lib/apt/lists/* && \ + cd /root && \ + git clone https://github.com/riscv/riscv-gnu-toolchain &&\ + de riscv-gnu-toolchain && \ + ./configure --prefix=/opt/riscv-gcc --with-arch=rv32i --with-abi=ilp32 && \ + make && \ + make clean