First version
This commit is contained in:
142
Containerfile
Normal file
142
Containerfile
Normal file
@@ -0,0 +1,142 @@
|
||||
FROM alpine:edge AS builder
|
||||
|
||||
# Update databases
|
||||
RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
|
||||
apk update
|
||||
|
||||
# Download base dependencies
|
||||
RUN apk add \
|
||||
git \
|
||||
make \
|
||||
cmake \
|
||||
build-base \
|
||||
linux-headers \
|
||||
boost-dev \
|
||||
eigen-dev \
|
||||
gawk \
|
||||
py3-pip \
|
||||
py3-setuptools \
|
||||
py3-wheel \
|
||||
py3-gpep517 \
|
||||
py3-build \
|
||||
ghc \
|
||||
stack \
|
||||
cython \
|
||||
py3-yaml \
|
||||
py3-simplejson \
|
||||
py3-intervaltree
|
||||
|
||||
# Install yosys
|
||||
RUN apk add yosys
|
||||
|
||||
WORKDIR /home/root/aur-install
|
||||
|
||||
# Install prjxray librairies
|
||||
RUN git clone https://github.com/supersurviveur/prjxray.git && \
|
||||
cd prjxray && \
|
||||
git submodule update --init && \
|
||||
# include fasm2frames in python package
|
||||
mv utils/fasm2frames.py prjxray/ && \
|
||||
sed -E 's/(fasm2frames=)utils/\1prjxray/' -i setup.py && \
|
||||
cmake -B build \
|
||||
-S "." \
|
||||
-DCMAKE_BUILD_TYPE=None \
|
||||
-DCMAKE_INSTALL_PREFIX='/usr' \
|
||||
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
|
||||
-Wno-dev && \
|
||||
cmake --build build && \
|
||||
python -m build --wheel --no-isolation --skip-dependency-check && \
|
||||
python -m installer dist/*.whl && \
|
||||
python -m build third_party/fasm --wheel --no-isolation --skip-dependency-check && \
|
||||
python -m installer third_party/fasm/dist/*.whl
|
||||
|
||||
# prjxray dependency not available on apk
|
||||
RUN pip install textx --break-system-packages
|
||||
|
||||
# RUN fasm2frames
|
||||
# Install the zynq7 prjxray database
|
||||
RUN git clone https://github.com/f4pga/prjxray-db.git && \
|
||||
cd prjxray-db && \
|
||||
install -dm 755 /usr/share/xray/database && \
|
||||
cp -r zynq7 /usr/share/xray/database/ && \
|
||||
# Delete the xc7z020 chip since we don't need it for the xc7z010 chip
|
||||
rm /usr/share/xray/database/zynq7/xc7z020 -rf
|
||||
|
||||
# Install nextpnr-himbaechel
|
||||
RUN git clone https://github.com/YosysHQ/nextpnr && \
|
||||
cd nextpnr && \
|
||||
git submodule update --remote --init himbaechel/uarch/xilinx/meta && \
|
||||
cmake -S "." -B build \
|
||||
-DARCH=himbaechel \
|
||||
-DHIMBAECHEL_UARCH=xilinx \
|
||||
-DHIMBAECHEL_XILINX_DEVICES="xc7z010" \
|
||||
-DHIMBAECHEL_PRJXRAY_DB="/usr/share/xray/database" \
|
||||
-DBUILD_PYTHON=OFF \
|
||||
-DBUILD_GUI=OFF \
|
||||
-DCMAKE_BUILD_TYPE=None \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DUSE_OPENMP=ON && \
|
||||
make -C build
|
||||
|
||||
# This part is specific to djtgcfg but it doesn't detect the card over USB (missing driver ?)
|
||||
# # Install djtgcfg
|
||||
# # Install avahi (djtcfg dependency)
|
||||
# RUN apk add avahi
|
||||
# RUN git clone https://aur.archlinux.org/digilent.adept.runtime.git && \
|
||||
# cd digilent.adept.runtime && makepkg -si --noconfirm --needed
|
||||
# RUN git clone https://aur.archlinux.org/digilent.adept.utilities.git && \
|
||||
# cd digilent.adept.utilities && makepkg -si --noconfirm --needed
|
||||
|
||||
# Install sv2v
|
||||
RUN git clone https://github.com/zachjs/sv2v && \
|
||||
cd sv2v && \
|
||||
make
|
||||
|
||||
COPY copy_bin_deps.sh /usr/bin/
|
||||
RUN chmod +x /usr/bin/copy_bin_deps.sh
|
||||
|
||||
# Copy all binaries and their dependencies in a /dependencies dir which will be copied in the final image
|
||||
RUN mkdir -p /dependencies
|
||||
|
||||
RUN copy_bin_deps.sh /usr/bin/yosys
|
||||
RUN copy_bin_deps.sh /home/root/aur-install/nextpnr/build/nextpnr-himbaechel
|
||||
RUN copy_bin_deps.sh /home/root/aur-install/prjxray/build/tools/xc7frames2bit
|
||||
RUN copy_bin_deps.sh /home/root/aur-install/sv2v/bin/sv2v
|
||||
RUN cp /usr/bin/fasm2frames /dependencies/usr/bin/
|
||||
|
||||
# djtgcfg
|
||||
# RUN copy_bin_deps.sh /usr/bin/djtgcfg
|
||||
# RUN copy_bin_deps.sh /usr/bin/dftdrvdtch
|
||||
|
||||
# Final image
|
||||
FROM alpine:edge
|
||||
|
||||
# Install dependencies available in apk
|
||||
RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
|
||||
apk update && \
|
||||
apk add abc py3-yaml py3-simplejson py3-intervaltree py3-arpeggio
|
||||
|
||||
# Get dependencies back
|
||||
COPY --from=builder /dependencies /
|
||||
|
||||
# Some files are needed in addition to libs files
|
||||
COPY --from=builder /usr/share/yosys /usr/share/yosys
|
||||
# Chip databases
|
||||
COPY --from=builder /home/root/aur-install/nextpnr/build/share /usr/share/nextpnr
|
||||
COPY --from=builder /usr/share/xray/database/zynq7 /usr/share/xray/database/zynq7
|
||||
|
||||
# These 3 python dependencies were built in the previous image
|
||||
COPY --from=builder /usr/lib/python3.12/site-packages/prjxray /usr/lib/python3.12/site-packages/prjxray
|
||||
COPY --from=builder /usr/lib/python3.12/site-packages/fasm /usr/lib/python3.12/site-packages/fasm
|
||||
COPY --from=builder /usr/lib/python3.12/site-packages/textx /usr/lib/python3.12/site-packages/textx
|
||||
|
||||
# This part is specific to djtgcfg but it doesn't detect the card over USB (missing driver ?)
|
||||
# COPY --from=builder /usr/share/digilent /usr/share/digilent
|
||||
# COPY --from=builder /etc/digilent-adept.conf /etc/digilent-adept.conf
|
||||
# COPY --from=builder /etc/ld.so.conf.d/digilent-adept-libraries.conf /etc/ld.so.conf.d/digilent-adept-libraries.conf
|
||||
# Generate ld configuration for digilent programs
|
||||
# RUN ldconfig
|
||||
|
||||
WORKDIR /root/code
|
||||
|
||||
CMD ["/bin/bash -c \"$@\""]
|
||||
15
copy_bin_deps.sh
Normal file
15
copy_bin_deps.sh
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
binary=$1
|
||||
echo "=== Copying dependencies for binary $binary"
|
||||
|
||||
mkdir -p /dependencies/usr/bin
|
||||
cp "$binary" /dependencies/usr/bin/
|
||||
|
||||
ldd "$binary" | grep "=>" | awk '{print $3}' | while read lib; do
|
||||
if [ -f "$lib" ]; then
|
||||
echo "Copying dependency: $lib"
|
||||
mkdir -p "/dependencies$(dirname "$lib")"
|
||||
cp "$lib" "/dependencies$lib"
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user