Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,8 @@
*~

# Python cache file
__pycache__/
__pycache__/


# output generated by the end to end flow
outputs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not sure if this change affects anything related to the Olympia setup. To be safer, I’d suggest ignoring only the outputs inside the docker stf trace gen folder instead of applying it more broadly.

45 changes: 23 additions & 22 deletions traces/docker_stf_trace_gen/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
FROM ubuntu:24.04

# Set environment variables early
# Set environment variables early (separate lines)
ENV RISCV=/riscv
ENV QEMU_DIR=/qemu
ENV QEMU_PLUGINS=/qemu/build/contrib/plugins
ENV PATH=$RISCV/bin:/opt/riscv/riscv32-elf/bin:/opt/riscv/riscv64-elf/bin:/opt/riscv/riscv32-glibc/bin:/SimPoint/bin:/qemu/build:$PATH
ENV DEBIAN_FRONTEND=noninteractive
ENV WORKDIR=/workspace
ENV WORKLOADS=/workloads
ENV OUTPUT=/output
ENV OUTPUT=/outputs
ENV PATH=$RISCV/bin:/opt/riscv/riscv32-elf/bin:/opt/riscv/riscv64-elf/bin:/opt/riscv/riscv32-glibc/bin:/SimPoint/bin:/qemu/build:$PATH
ENV STF_DIR=$RISCV/condor.riscv-isa-sim/stf_lib

# Install dependencies and clean up in one layer
RUN apt update && apt install -y \
RUN apt-get update && apt-get install -y \
autoconf \
automake \
autotools-dev \
Expand Down Expand Up @@ -54,15 +54,18 @@ RUN apt update && apt install -y \
wget \
zlib1g-dev \
zstd \
python3-yaml
python3-yaml \
python3-pyelftools \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean

# Configure git for building
RUN git config --global url."https://github.com/".insteadOf "git@github.com:" && \
git config --global user.email "builder@docker.com" && \
git config --global user.name "Docker Builder"

# Create directory structure
RUN mkdir -p /output
RUN mkdir -p /workloads /outputs /workspace $RISCV
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line seems redundant since each folder already has its own WORKDIR command. As for the output directory, it is only used for host system binds, so there is also no need to create it in the dockerfile


# Clone repositories in RISCV directory
WORKDIR $RISCV
Expand All @@ -83,11 +86,11 @@ RUN git clone https://github.com/riscv-software-src/riscv-tests.git && \

# Copy and execute toolchain setup script
COPY utils/get-tool.sh $RISCV/get-tool.sh
RUN chmod +x $RISCV/get-tool.sh && \
$RISCV/get-tool.sh && \
echo "Toolchain version:" && \
riscv64-unknown-linux-gnu-gcc --version 2>/dev/null || echo "Toolchain setup pending"
RUN chmod +x $RISCV/get-tool.sh
RUN $RISCV/get-tool.sh || true
RUN echo "Toolchain version:" && (riscv64-unknown-linux-gnu-gcc --version 2>/dev/null || echo "Toolchain setup pending")

RUN mkdir -p /qemu/build
# Build QEMU with plugins support
WORKDIR /qemu/build
RUN ../configure \
Expand All @@ -107,16 +110,15 @@ RUN make -j$(nproc)
WORKDIR $RISCV/stf_tools
RUN git submodule update --init --recursive
WORKDIR $RISCV/stf_tools/release
RUN cmake .. -DCMAKE_BUILD_TYPE=Release && make -j$(nproc)
RUN cmake .. -DCMAKE_BUILD_TYPE=Release
RUN make -j$(nproc)

# Build condor.riscv-isa-sim (Spike)
# make the builddir ?
WORKDIR $RISCV/condor.riscv-isa-sim/build
RUN ../configure --prefix=$RISCV/condor.riscv-isa-sim/install
RUN make -j$(nproc)
RUN make regress
RUN make install
ENV STF_DIR=$RISCV/condor.riscv-isa-sim/stf_lib

# Create mount points for runtime mounting
# Environment and flow scripts will be mounted at runtime
Expand All @@ -128,18 +130,17 @@ RUN mkdir -p /workloads/environment /flow /outputs
# - Host outputs -> /outputs

RUN cp $RISCV/condor.riscv-isa-sim/install/bin/spike /usr/bin/

WORKDIR $RISCV/trace-gen
RUN make
RUN make
RUN make install

# Build riscv-pk (to provide pk for Spike if requested)
WORKDIR $RISCV/riscv-pk
RUN mkdir -p build
WORKDIR $RISCV/riscv-pk/build
RUN mkdir $RISCV/pk
RUN ../configure --prefix=$RISCV/pk --host=riscv64-unknown-elf
RUN ../configure --host=riscv64-unknown-elf
RUN make -j$(nproc)
RUN make install
ENV PATH=$RISCV/pk:$PATH

WORKDIR /workspace

CMD ["/bin/bash"]

# Volumes are mounted at runtime
Loading