-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.gnu.toolchain
executable file
·46 lines (41 loc) · 1.86 KB
/
Dockerfile.gnu.toolchain
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
FROM ubuntu
EXPOSE 9999
ARG GNU_TOOLCHAIN=riscv-gnu-toolchain
ARG MULTILIB_PREFIX=/opt/riscv/gnu-toolchain/multilib
ARG RV64_PREFIX=/opt/riscv/gnu-toolchain/rv64
ARG RV64_LINUX_PREFIX=/opt/riscv/gnu-toolchain/rv64-linux
ARG RV64_LINUX_SYSROOT_LIB=${RV64_LINUX_PREFIX}/sysroot/lib
ARG RVV_NEXT_PREFIX=/opt/riscv/gnu-toolchain/rvv-next
# Install Packages
RUN apt update && apt upgrade -y && apt install -y \
autoconf automake autotools-dev curl python3 libmpc-dev libmpfr-dev libgmp-dev \
git gawk build-essential bison flex texinfo gperf libtool patchutils bc \
zlib1g-dev libexpat-dev libusb-1.0-0-dev device-tree-compiler pkg-config vim && \
apt autoremove -y && apt clean && rm -rf /var/lib/apt/lists/*
# Build GNU Toolchain
WORKDIR "/root/build"
RUN git clone https://github.com/riscv/${GNU_TOOLCHAIN} && \
cd ${GNU_TOOLCHAIN} && \
# RV64 \
git submodule init && git submodule update && \
./configure --prefix=${RV64_PREFIX} \
--with-arch=rv64imafdcv --with-abi=lp64d --with-isa-spec=20191213 --with-sim=spike && \
make -j`nproc` build-sim SIM=spike && make clean && \
# RV64 Linux \
./configure --prefix=${RV64_LINUX_PREFIX} \
--with-arch=rv64imafdcv --with-abi=lp64d --with-isa-spec=20191213 && \
make -j`nproc` linux && make clean && \
# Multilib \
./configure --prefix=${MULTILIB_PREFIX} \
--enable-multilib --with-isa-spec=20191213 && \
make -j`nproc` && make clean && \
# RVV-Next \
git reset --hard origin/master && git checkout rvv-next && \
./configure --prefix=${RVV_NEXT_PREFIX} \
--with-arch=rv64imafdcv --with-abi=lp64d --with-isa-spec=20191213 && \
make -j`nproc` && \
cd - && rm -rf ${GNU_TOOLCHAIN} && \
# Configurations \
ln -svf ${RV64_LINUX_SYSROOT_LIB}/ld-linux-riscv64-lp64d.so.1 /lib/ld-linux-riscv64-lp64d.so.1
ENV LD_LIBRARY_PATH=${RV64_LINUX_SYSROOT_LIB}
CMD bash