|
1 |
| -FROM ubuntu:22.04 |
| 1 | +FROM ubuntu:24.04 |
2 | 2 |
|
3 |
| -RUN apt-get update |
4 |
| -RUN apt-get install -y device-tree-compiler libboost-regex-dev libboost-system-dev git binutils build-essential cmake gcc-riscv64-linux-gnu zstd libzstd-dev autoconf automake autotools-dev curl python3 python3-pip python3-tomli 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 libslirp-dev |
| 3 | +# Combine apt-get commands and clean up to reduce image size |
| 4 | +RUN apt-get update && apt-get install -y \ |
| 5 | + device-tree-compiler \ |
| 6 | + libboost-regex-dev \ |
| 7 | + libboost-system-dev \ |
| 8 | + libboost-program-options-dev \ |
| 9 | + libboost-json-dev \ |
| 10 | + rapidjson-dev \ |
| 11 | + libhdf5-dev \ |
| 12 | + liblzma-dev \ |
| 13 | + libbz2-dev \ |
| 14 | + cython3 \ |
| 15 | + git \ |
| 16 | + binutils \ |
| 17 | + build-essential \ |
| 18 | + cmake \ |
| 19 | + gcc-riscv64-linux-gnu \ |
| 20 | + zstd \ |
| 21 | + libzstd-dev \ |
| 22 | + autoconf \ |
| 23 | + automake \ |
| 24 | + autotools-dev \ |
| 25 | + curl \ |
| 26 | + python3 \ |
| 27 | + python3-pip \ |
| 28 | + python3-tomli \ |
| 29 | + libmpc-dev \ |
| 30 | + libmpfr-dev \ |
| 31 | + libgmp-dev \ |
| 32 | + gawk \ |
| 33 | + bison \ |
| 34 | + flex \ |
| 35 | + 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 | + wget \ |
| 46 | + && rm -rf /var/lib/apt/lists/* |
5 | 47 |
|
6 |
| -RUN mkdir riscv |
| 48 | +# Set up RISCV environment |
7 | 49 | ENV RISCV=/riscv
|
8 |
| -ENV PATH=$RISCV/bin:$PATH |
9 |
| - |
10 |
| -RUN git clone https://github.com/jeffnye-gh/riscv-isa-sim.git |
11 |
| -RUN git clone https://github.com/riscv-software-src/riscv-pk.git |
12 |
| -RUN git clone https://github.com/riscv-collab/riscv-gnu-toolchain.git |
13 |
| - |
14 |
| -WORKDIR /riscv-gnu-toolchain |
15 |
| -RUN ./configure --prefix=/opt/riscv |
16 |
| -ENV PATH=/opt/riscv/bin:$PATH |
17 |
| -RUN make -j$(nproc) |
18 |
| - |
19 |
| -WORKDIR /riscv-pk/build |
20 |
| -RUN ../configure --prefix=$RISCV --host=riscv64-unknown-elf |
21 |
| -RUN make -j$(nproc) |
22 |
| -RUN make install |
23 |
| - |
24 |
| -WORKDIR /riscv-isa-sim/build |
25 |
| -RUN git checkout spike_stf |
26 |
| -RUN git submodule update --init --recursive |
27 |
| -RUN ../configure --prefix=$RISCV |
28 |
| -RUN make -j$(nproc) |
29 |
| -RUN make install |
| 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 "git@github.com:" |
| 55 | + |
| 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 "builder@example.com" && \ |
| 58 | + git config --global user.name "Docker Builder" |
| 59 | + |
| 60 | + |
| 61 | +# Clone repositories |
| 62 | +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 |
| 67 | + |
| 68 | +# Build riscv-gnu-toolchain |
| 69 | +WORKDIR $RISCV/riscv-gnu-toolchain |
| 70 | +RUN ./configure --prefix=/opt/riscv && make -j$(nproc) && make install |
| 71 | + |
| 72 | +# Build riscv-pk |
| 73 | +WORKDIR $RISCV/riscv-pk/build |
| 74 | +RUN ../configure --prefix=$RISCV --host=riscv64-unknown-elf && make -j$(nproc) && make install |
| 75 | + |
| 76 | +# Build stf_tools |
| 77 | +WORKDIR $RISCV/stf_tools |
| 78 | +RUN git submodule update --init --recursive || exit 1 |
| 79 | +WORKDIR $RISCV/stf_tools/release |
| 80 | +RUN cmake .. -DCMAKE_BUILD_TYPE=Release && make -j$(nproc) |
| 81 | + |
| 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 | + mkdir -p build && cd build && \ |
| 90 | + ../configure --prefix=$RISCV/condor.riscv-isa-sim/install && \ |
| 91 | + make -j$(nproc) && \ |
| 92 | + make regress && \ |
| 93 | + make install |
| 94 | + |
| 95 | +# shell |
| 96 | +CMD ["/bin/bash"] |
| 97 | + |
0 commit comments