-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathriscv-toolchain.Dockerfile
80 lines (69 loc) · 1.74 KB
/
riscv-toolchain.Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#
# RISC-V Development Dockerfile
#
# Inspired by https://github.com/sbates130272/docker-riscv
#
# This Dockerfile creates a container full of lots of useful tools for
# RISC-V development.
# Pull base image (use Wily for now).
FROM ubuntu:22.04
# Set the maintainer
MAINTAINER Nicolas Brunie
# Install some base tools that we will need to get the risc-v
# toolchain working.
RUN apt update && apt install -y git \
build-essential \
autoconf \
automake \
autotools-dev \
curl \
libmpc-dev \
libmpfr-dev \
libgmp-dev \
libusb-1.0-0-dev \
gawk \
build-essential \
bison \
flex \
texinfo \
gperf \
libtool \
patchutils \
bc \
zlib1g-dev \
device-tree-compiler \
pkg-config \
libexpat-dev \
python3 \
cmake \
ninja-build \
libglib2.0-dev \
python3-venv
# Make a working folder and set the necessary environment variables.
ENV RISCV /opt/riscv
ENV NUMJOBS 1
RUN mkdir -p $RISCV
# Make a directory to download sources and build programs
ENV RISCV_SRCS /home/riscv_srcs/
RUN mkdir -p $RISCV_SRCS
# Add the GNU utils bin folder to the path.
ENV PATH $RISCV/bin:$PATH
# GNU toolchain
WORKDIR $RISCV_SRCS
RUN git clone https://github.com/riscv/riscv-gnu-toolchain
WORKDIR $RISCV_SRCS/riscv-gnu-toolchain
RUN ./configure --prefix=$RISCV --enable-llvm
RUN make -j5
RUN make build-qemu -j5
RUN make stamps/build-spike -j5
RUN make stamps/build-pk64 -j5
RUN make install
# LLVM update and build
WORKDIR $RISCV_SRCS/riscv-gnu-toolchain/llvm
RUN git fetch origin
RUN git checkout -B main origin/main
RUN git submodule update --init --recursive
WORKDIR $RISCV_SRCS/riscv-gnu-toolchain
RUN make build-llvm -j5
# Defaulting to the /home/app directory (where we are going to bind the rvv-examples directory)
WORKDIR /home/app