|
1 | 1 | FROM ubuntu:24.04
|
2 | 2 |
|
3 |
| -# Combine apt-get commands and clean up to reduce image size |
| 3 | +# Set environment variables early |
| 4 | +ENV RISCV=/riscv \ |
| 5 | + QEMU_PLUGINS=/qemu/build/contrib/plugins \ |
| 6 | + PATH=$RISCV/bin:/opt/riscv/riscv32-elf/bin:/opt/riscv/riscv64-elf/bin:/opt/riscv/riscv32-glibc/bin:/SimPoint/bin:/qemu/build:$PATH \ |
| 7 | + DEBIAN_FRONTEND=noninteractive \ |
| 8 | + WORKDIR=/workspace \ |
| 9 | + WORKLOADS=/workloads \ |
| 10 | + OUTPUT=/output |
| 11 | + |
| 12 | +# Install dependencies and clean up in one layer |
4 | 13 | RUN apt-get update && apt-get install -y \
|
| 14 | + autoconf \ |
| 15 | + automake \ |
| 16 | + autotools-dev \ |
| 17 | + bc \ |
| 18 | + binutils \ |
| 19 | + bison \ |
| 20 | + build-essential \ |
| 21 | + cmake \ |
| 22 | + curl \ |
| 23 | + cython3 \ |
5 | 24 | device-tree-compiler \
|
| 25 | + flex \ |
| 26 | + gawk \ |
| 27 | + gcc-riscv64-linux-gnu \ |
| 28 | + gperf \ |
| 29 | + git \ |
| 30 | + jq \ |
| 31 | + libboost-json-dev \ |
| 32 | + libboost-program-options-dev \ |
6 | 33 | libboost-regex-dev \
|
7 | 34 | libboost-system-dev \
|
8 |
| - libboost-program-options-dev \ |
9 |
| - libboost-json-dev \ |
10 |
| - rapidjson-dev \ |
| 35 | + libbz2-dev \ |
| 36 | + libexpat-dev \ |
| 37 | + libglib2.0-dev \ |
| 38 | + libgmp-dev \ |
11 | 39 | libhdf5-dev \
|
12 | 40 | liblzma-dev \
|
13 |
| - libbz2-dev \ |
14 |
| - cython3 \ |
15 |
| - git \ |
16 |
| - binutils \ |
17 |
| - build-essential \ |
18 |
| - cmake \ |
19 |
| - gcc-riscv64-linux-gnu \ |
20 |
| - zstd \ |
| 41 | + libmpc-dev \ |
| 42 | + libmpfr-dev \ |
| 43 | + libslirp-dev \ |
| 44 | + libtool \ |
21 | 45 | libzstd-dev \
|
22 |
| - autoconf \ |
23 |
| - automake \ |
24 |
| - autotools-dev \ |
25 |
| - curl \ |
| 46 | + ninja-build \ |
| 47 | + patchutils \ |
26 | 48 | python3 \
|
27 | 49 | python3-pip \
|
28 | 50 | python3-tomli \
|
29 |
| - libmpc-dev \ |
30 |
| - libmpfr-dev \ |
31 |
| - libgmp-dev \ |
32 |
| - gawk \ |
33 |
| - bison \ |
34 |
| - flex \ |
| 51 | + rapidjson-dev \ |
35 | 52 | texinfo \
|
36 |
| - gperf \ |
37 |
| - libtool \ |
38 |
| - patchutils \ |
39 |
| - bc \ |
40 |
| - zlib1g-dev \ |
41 |
| - libexpat-dev \ |
42 |
| - ninja-build \ |
43 |
| - libglib2.0-dev \ |
44 |
| - libslirp-dev \ |
45 | 53 | wget \
|
46 |
| - && rm -rf /var/lib/apt/lists/* |
47 |
| - |
48 |
| -# Set up RISCV environment |
49 |
| -ENV RISCV=/riscv |
50 |
| -ENV PATH=$RISCV/bin:/opt/riscv/bin:$PATH |
51 |
| -RUN mkdir -p $RISCV |
52 |
| - |
53 |
| -# Using HTTP instead of SSH to avoid setting git credentials |
54 |
| -RUN git config --global url. "https://github.com/".insteadOf "[email protected]:" |
| 54 | + zlib1g-dev \ |
| 55 | + zstd \ |
| 56 | + && rm -rf /var/lib/apt/lists/* \ |
| 57 | + && apt-get clean |
55 | 58 |
|
56 |
| -# Generic config details required during the cloning (git am, apply,patch done during the toolchain build process) |
57 |
| -RUN git config --global user.email "[email protected]" && \ |
| 59 | +# Configure git for building |
| 60 | +RUN git config --global url. "https://github.com/".insteadOf "[email protected]:" && \ |
| 61 | + git config --global user.email "[email protected]" && \ |
58 | 62 | git config --global user.name "Docker Builder"
|
59 | 63 |
|
| 64 | +# Create directory structure |
| 65 | +RUN mkdir -p /workloads /output /workspace $RISCV |
60 | 66 |
|
61 |
| -# Clone repositories |
| 67 | +# Clone repositories in RISCV directory |
62 | 68 | WORKDIR $RISCV
|
63 |
| -RUN git clone https://github.com/condorcomputing/condor.riscv-isa-sim.git --recurse-submodules || exit 1 |
64 |
| -RUN git clone https://github.com/sparcians/stf_tools || exit 1 |
65 |
| -RUN git clone https://github.com/riscv-software-src/riscv-pk.git || exit 1 |
66 |
| -RUN git clone https://github.com/riscv-collab/riscv-gnu-toolchain.git || exit 1 |
| 69 | +RUN git clone https://github.com/condorcomputing/condor.riscv-isa-sim.git --recurse-submodules && \ |
| 70 | + git clone https://github.com/sparcians/stf_tools && \ |
| 71 | + git clone https://github.com/riscv-software-src/riscv-pk.git |
67 | 72 |
|
68 |
| -# Build riscv-gnu-toolchain |
69 |
| -WORKDIR $RISCV/riscv-gnu-toolchain |
70 |
| -RUN ./configure --prefix=/opt/riscv && make -j$(nproc) && make install |
| 73 | +# Clone QEMU and SimPoint |
| 74 | +WORKDIR / |
| 75 | +RUN git clone https://gitlab.com/qemu-project/qemu.git && \ |
| 76 | + git clone https://github.com/hanhwi/SimPoint.git |
71 | 77 |
|
72 |
| -# Build riscv-pk |
73 |
| -WORKDIR $RISCV/riscv-pk/build |
74 |
| -RUN ../configure --prefix=$RISCV --host=riscv64-unknown-elf && make -j$(nproc) && make install |
| 78 | +# Clone workloads with Embench PR |
| 79 | +WORKDIR /workloads |
| 80 | +RUN git clone https://github.com/riscv-software-src/riscv-tests.git && \ |
| 81 | + git clone -b spike-as-board https://github.com/widlarizer/embench-iot.git |
| 82 | + |
| 83 | +# Copy and execute toolchain setup script |
| 84 | +COPY utils/get-tool.sh $RISCV/get-tool.sh |
| 85 | +RUN chmod +x $RISCV/get-tool.sh && \ |
| 86 | + $RISCV/get-tool.sh && \ |
| 87 | + echo "Toolchain version:" && \ |
| 88 | + riscv64-unknown-linux-gnu-gcc --version 2>/dev/null || echo "Toolchain setup pending" |
| 89 | + |
| 90 | +RUN mkdir -p /qemu/build |
| 91 | +# Build QEMU with plugins support |
| 92 | +WORKDIR /qemu/build |
| 93 | +RUN ../configure \ |
| 94 | + --target-list=riscv32-linux-user,riscv64-linux-user,riscv32-softmmu,riscv64-softmmu \ |
| 95 | + --enable-plugins \ |
| 96 | + --disable-docs \ |
| 97 | + --disable-gtk \ |
| 98 | + --disable-sdl |
| 99 | +RUN make -j$(nproc) |
| 100 | +RUN make install |
| 101 | + |
| 102 | +# Build SimPoint |
| 103 | +WORKDIR /SimPoint |
| 104 | +RUN make -j$(nproc) |
75 | 105 |
|
76 | 106 | # Build stf_tools
|
77 | 107 | WORKDIR $RISCV/stf_tools
|
78 |
| -RUN git submodule update --init --recursive || exit 1 |
| 108 | +RUN git submodule update --init --recursive |
79 | 109 | WORKDIR $RISCV/stf_tools/release
|
80 | 110 | RUN cmake .. -DCMAKE_BUILD_TYPE=Release && make -j$(nproc)
|
81 | 111 |
|
82 |
| -# Build condor.riscv-isa-sim |
83 |
| -WORKDIR $RISCV/condor.riscv-isa-sim |
84 |
| -RUN bash scripts/download-bm-compiler.sh && \ |
85 |
| - COMPILER_DIR=$(find . -maxdepth 1 -type d -name "riscv-embecosm-*" | head -n 1) && \ |
86 |
| - [ -n "$COMPILER_DIR" ] || (echo "Error: riscv-embecosm-* directory not found!" && exit 1) && \ |
87 |
| - export PATH=$(pwd)/$COMPILER_DIR/bin:$PATH && \ |
88 |
| - echo "export PATH=/riscv/condor.riscv-isa-sim/$COMPILER_DIR/bin:\$PATH" >> /root/.bashrc |
89 |
| - |
90 |
| -RUN mkdir -p build && cd build && \ |
91 |
| - ../configure --prefix=$RISCV/condor.riscv-isa-sim/install && \ |
92 |
| - make -j$(nproc) && \ |
93 |
| - make regress && \ |
94 |
| - make install |
95 |
| - |
96 |
| -# shell |
| 112 | +# Build condor.riscv-isa-sim (Spike) |
| 113 | +# make the builddir ? |
| 114 | +WORKDIR $RISCV/condor.riscv-isa-sim/build |
| 115 | +RUN ../configure --prefix=$RISCV/condor.riscv-isa-sim/install |
| 116 | +RUN make -j$(nproc) |
| 117 | +RUN make regress |
| 118 | +RUN make install |
| 119 | + |
| 120 | +# Create mount points for runtime mounting |
| 121 | +# Environment and flow scripts will be mounted at runtime |
| 122 | +RUN mkdir -p /workloads/environment /flow /outputs |
| 123 | + |
| 124 | +# Note: The following are mounted at runtime: |
| 125 | +# - Host flow scripts -> /flow |
| 126 | +# - Host environment -> /workloads/environment |
| 127 | +# - Host outputs -> /outputs |
| 128 | + |
| 129 | +RUN cp $RISCV/condor.riscv-isa-sim/install/bin/spike /usr/bin/ |
| 130 | +WORKDIR /workspace |
| 131 | + |
| 132 | + |
97 | 133 | CMD ["/bin/bash"]
|
| 134 | + |
| 135 | +# need to mount Volumes and show it in the documenation when runnignthis |
0 commit comments