Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip #2

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
74 changes: 35 additions & 39 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,39 +1,35 @@
FROM ubuntu:20.04

ENV QORC_SDK_PATH=/home/qorc-sdk/qorc-sdk

RUN useradd -p locked -m qorc-sdk -G dialout

RUN apt-get update && apt-get install -y \
git \
sudo \
wget \
curl \
lbzip2 \
libtbb2

RUN mkdir -p /home/qorc-sdk && chown qorc-sdk:qorc-sdk -R /home/qorc-sdk

USER qorc-sdk

# FIXME: use fixed commit instead of master
RUN git clone https://github.com/QuickLogic-Corp/qorc-sdk.git $QORC_SDK_PATH

# Toolchains are downloaded and configured on first inclusion of this script.
# Do it now to save time later.
#
# Even though 'sudo' is installed, it will print errors because below command
# isn't run in terminal. Nevertheless, steps that require root permissions
# have to be performed on host system, not in Docker.
#
# Note that 'sudo' still must be installed, without it Python throws an
# exception instead of "completing successfully with errors".
RUN /bin/bash -ic ". $QORC_SDK_PATH/envsetup.sh"

# Library provided by toolchain doesn't work, use system library instead
RUN mv $QORC_SDK_PATH/fpga_toolchain_install/v1.3.1/conda/lib/libffi.so.7 \
$QORC_SDK_PATH/fpga_toolchain_install/v1.3.1/conda/lib/libffi.so.7.backup

WORKDIR /home/qorc-sdk

RUN echo ". $QORC_SDK_PATH/envsetup.sh" > .bashrc
FROM ubuntu:23.04
RUN useradd -p locked -m builder -G dialout
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get -y install wget vim && mkdir -pm755 /etc/apt/keyrings && \
wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key && \
wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/lunar/winehq-lunar.sources && \
dpkg --add-architecture i386 && \
apt-get update && \
apt-get -y install --install-recommends winehq-staging p7zip-full xvfb && \
apt-get -y install unzip make && apt-get clean
USER builder
# Initialize wine, install QuickWorks and yosys.
RUN wine wineboot && mkdir /tmp/install && cd /tmp/install && \
wget https://github.com/QuickLogic-Corp/yosys-quickworks/raw/master/Releases/v1.0/ql-yosys-QuickWorks-v1.0.zip && \
unzip ql-yosys-QuickWorks-v1.0.zip && \
mv ql-yosys-v1.0 /home/builder && \
cd QW2016.1.1_ReleaseBuild_0817 && \
mkdir temp && cd temp && \
7z x ../QW2016.1.1_ReleaseBuild_0817.exe && \
xvfb-run wine QuickWorks.exe /qn && \
cd / && rm -rf /tmp/install && ( \
if [ ! -e ~/.wine/drive_c/QuickLogic/QuickWorks_2016.1.1_Release/spde/spde.exe ]; then \
echo "SPDE not found" && exit 1; \
fi \
) && wineserver -k && wine reg add "HKEY_LOCAL_MACHINE\\Software\\QuickLogic\\QuickWorks 2016.1.1 Release" \
/t REG_SZ /v InstallPath /d "C:\\QuickLogic\\QuickWorks_2016.1.1_Release\\spde" /f
# Rename Clk_C16 and Clk_C21 to Sys_Clk0/1 for compatibility with SpDE which still
# uses older names for those signals.
RUN cd /home/builder/ql-yosys-v1.0/share/yosys/quicklogic/pp3 && \
sed -i 's|Clk_C16|Sys_Clk0|g;s|Clk_C21|Sys_Clk1|g' 'qlal4s3b_sim.v'
# Variables used by TwPM build system
ENV TWPM_SPDE_DIR /home/builder/.wine/drive_c/QuickLogic/QuickWorks_2016.1.1_Release/spde
ENV TWPM_YOSYS_DIR /home/builder/ql-yosys-v1.0
RUN mkdir /home/builder/workspace
WORKDIR /home/builder/workspace