STAR-future's picture
add chips/openroad_flow_scripts
d664931 verified
Raw History Blame Contribute Delete
4.37 kB
# syntax=docker/dockerfile:1.7-labs
# Target with dependencies to build all flow tools from their sources.
# i.e., "./build_openroad.sh --local" from inside a docker container
# NOTE: don't use this file directly unless you know what you are doing,
# instead use etc/DockerHelper.sh
ARG fromImage=openroad/flow-ubuntu26.04-dev:latest
# Image holding the prebuilt tools/install of every tool except OpenROAD
# (a build of the orfs-tools target). By default they are built here.
ARG toolsImage=orfs-tools
FROM $fromImage AS orfs-base
WORKDIR /OpenROAD-flow-scripts
COPY --link dev_env.sh dev_env.sh
COPY --link build_openroad.sh build_openroad.sh
FROM orfs-base AS orfs-builder-base
# Add compiler wrapper scripts for reproducible builds
COPY --link etc/setup_compiler_wrappers.sh /tmp/
RUN sh /tmp/setup_compiler_wrappers.sh && rm /tmp/setup_compiler_wrappers.sh
# Prepend wrapper directory to PATH so they override system compilers
ENV PATH="/usr/local/bin/wrapped-cc:$PATH"
FROM orfs-builder-base AS orfs-tools-builder
# Exclude install so a local build's output (e.g. tools/install/OpenROAD)
# cannot leak into the image; the build below starts from an empty install.
COPY --link --exclude=OpenROAD --exclude=AutoTuner --exclude=install tools tools
COPY --link etc/kepler-formal etc/kepler-formal
ARG numThreads=$(nproc)
ARG verificPath=""
RUN <<EOF
set -e
echo "" > tools/yosys/abc/.gitcommit
if [ -n "${verificPath}" ]; then
verificArgs="--with-verific ${verificPath}"
else
verificArgs=""
fi
./build_openroad.sh --no_init \
--local \
--skip_openroad \
--threads ${numThreads} \
${verificArgs}
if [ -n "${verificPath}" ]; then
rm -rf "${verificPath}"
fi
EOF
# Collect LICENSE files from tool source trees into the install directory so
# they are available in the final image.
RUN find /OpenROAD-flow-scripts/tools \( -name "*LICENSE*" -o -name "*LICENSES*" \) \
| grep -v '^/OpenROAD-flow-scripts/tools/install/' \
| while IFS= read -r f; do \
rel="${f#/OpenROAD-flow-scripts/tools/}"; \
mkdir -p "/OpenROAD-flow-scripts/tools/install/licenses/$(dirname "$rel")"; \
cp -r "$f" "/OpenROAD-flow-scripts/tools/install/licenses/$rel"; \
done
# Yosys, kepler-formal and their licenses, without sources or build trees.
FROM orfs-base AS orfs-tools
COPY --link --from=orfs-tools-builder /OpenROAD-flow-scripts/tools/install tools/install
FROM $toolsImage AS tools
FROM orfs-builder-base AS orfs-openroad-builder
COPY --link --from=tools /OpenROAD-flow-scripts/tools/install tools/install
COPY --link tools/OpenROAD tools/OpenROAD
ARG numThreads=$(nproc)
RUN <<EOF
set -e
./build_openroad.sh --no_init \
--local \
--openroad_only \
--threads ${numThreads}
if [ ! -x tools/install/OpenROAD/bin/openroad ]; then
echo "Error: tools/install/OpenROAD/bin/openroad is missing or not executable." >&2
exit 1
fi
EOF
# tools/OpenROAD/openroad/sta is excluded because it is covered by a separate
# commercial license agreement.
RUN find /OpenROAD-flow-scripts/tools/OpenROAD \( -name "*LICENSE*" -o -name "*LICENSES*" \) \
| grep -v '/OpenROAD/openroad/sta/' \
| while IFS= read -r f; do \
rel="${f#/OpenROAD-flow-scripts/tools/}"; \
mkdir -p "/OpenROAD-flow-scripts/tools/install/licenses/$(dirname "$rel")"; \
cp -r "$f" "/OpenROAD-flow-scripts/tools/install/licenses/$rel"; \
done
FROM orfs-base
# The order for copying the directories is based on the frequency of changes (ascending order),
# and the layer size (descending order)
COPY --link docker docker
COPY --link flow/tutorials flow/tutorials
COPY --link docs docs
COPY --link flow/test flow/test
COPY --link flow/platforms flow/platforms
COPY --link flow/util flow/util
COPY --link flow/scripts flow/scripts
COPY --link flow/designs flow/designs
COPY --link tools/AutoTuner tools/AutoTuner
COPY --link tools/FakeRAM2.0 tools/FakeRAM2.0
COPY --link --from=orfs-openroad-builder /OpenROAD-flow-scripts/tools/install tools/install
COPY --link \
--exclude=.git* --exclude=tools/ --exclude=docs/ --exclude=docker/ \
--exclude=flow/designs --exclude=flow/platforms --exclude=flow/scripts \
--exclude=flow/test --exclude=flow/tutorials --exclude=flow/util \
. ./