This repository has been archived by the owner on Oct 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
102 lines (88 loc) · 1.91 KB
/
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Builds docker image to compile and run s3k-monitor
#
# Stage 0: build RISC-V GNU Toolchain & QEMU
#
FROM ubuntu:latest
ENV PATH "$PATH:/opt/riscv/bin:/opt/qemu/bin"
WORKDIR /work
ARG GNU_TOOLCHAIN_VERSION=2023.02.21
ARG QEMU_VERSION=v7.2.0
# RISC-V GNU Toolchain prerequisites
RUN apt-get update -y && apt-get install -y \
autoconf \
automake \
autotools-dev \
curl \
python3 \
python3-pip \
libmpc-dev \
libmpfr-dev \
libgmp-dev \
gawk \
build-essential \
bison \
flex \
texinfo \
gperf \
libtool \
patchutils \
bc \
zlib1g-dev \
libexpat-dev \
ninja-build \
git \
cmake \
libglib2.0-dev \
libncurses5-dev
# Build RISC-V GNU Toolchain
RUN git clone https://github.com/riscv/riscv-gnu-toolchain
WORKDIR /work/riscv-gnu-toolchain
RUN git switch --detach tags/${GNU_TOOLCHAIN_VERSION}
RUN mkdir -p /opt/riscv
RUN ./configure --prefix=/opt/riscv --enable-multilib
RUN make -j$(nproc)
WORKDIR /work
# QEMU prerequisites
RUN apt update -y && apt install -y \
make \
git \
libglib2.0-dev \
libfdt-dev \
libpixman-1-dev \
zlib1g-dev \
ninja-build
# Build QEMU
RUN git clone https://github.com/qemu/qemu.git
WORKDIR /work/qemu
RUN git switch --detach tags/${QEMU_VERSION}
RUN mkdir -p /opt/qemu/bin
WORKDIR /opt/qemu/bin
RUN /work/qemu/configure --target-list=riscv64-softmmu
RUN make -j$(nproc)
#
# Stage 1: Assemble light weight image
#
FROM ubuntu:latest
ENV PATH "$PATH:/opt/riscv/bin:/opt/qemu/bin"
WORKDIR /work/s3k-monitor
# s3k-monitor prerequisites
RUN apt update -y && apt-get install -y \
# Requirements for qemu
libglib2.0-dev \
libfdt-dev \
libpixman-1-dev \
# Requirements for s3k-monitor
python3 \
python3-pip \
tmux \
bsdmainutils \
less \
make
# Required for s3k-monitor
RUN pip install pyelftools
# Copy binaries built in stage 0
COPY --from=0 /opt/ /opt/
# Default argument
CMD ["options"]
# Default command
ENTRYPOINT ["make"]