Browse Source

Add dockerfile & make targets for risc-v toolchain

bullseye
T. Meissner 3 years ago
parent
commit
fd4317edb7
2 changed files with 50 additions and 9 deletions
  1. +11
    -9
      Makefile
  2. +39
    -0
      riscv-gcc.Dockerfile

+ 11
- 9
Makefile View File

@ -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 # Support for make environment variable NOCACHE
ifeq (NOCACHE,$(lastword $(MAKECMDGOALS))) ifeq (NOCACHE,$(lastword $(MAKECMDGOALS)))
@ -19,25 +19,27 @@ else
endif 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: .SECONDEXPANSION:
symbiyosys ghdl-formal: $$@.Dockerfile
symbiyosys ghdl-formal riscv-gcc: $$@.Dockerfile
docker build ${OPTIONS} -t $@:${TAG} -f $@.Dockerfile . docker build ${OPTIONS} -t $@:${TAG} -f $@.Dockerfile .
ghdl-formal_${TAG}.tar.gz:
%_${TAG}.tar.gz:
mkdir -p artefacts 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 $@ . tar -C artefacts -czf $@ .
shasum --algorithm 256 --UNIVERSAL $@ > $@.sha256 shasum --algorithm 256 --UNIVERSAL $@ > $@.sha256
clean: clean:
rm -rf artefacts rm -rf artefacts
rm -f ghdl-formal_*.tar.*
rm -f *.tar.*

+ 39
- 0
riscv-gcc.Dockerfile View File

@ -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

Loading…
Cancel
Save