1
0
mirror of https://github.com/mist-devel/mist-board.git synced 2026-01-11 23:43:02 +00:00

Dockerized Quartus 13.1 for new distros

This commit is contained in:
Gyorgy Szombathelyi 2021-11-26 17:19:31 +01:00
parent 900e7cc05c
commit 0757bdeb0f
8 changed files with 176 additions and 0 deletions

3
tools/docker-quartus/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
.Xauthority
container-image-built
Quartus*

View File

@ -0,0 +1,38 @@
FROM ubuntu:18.04 as install
ADD libpng12-0_1.2.54-1ubuntu1.1_amd64.deb /libpng12-0_1.2.54-1ubuntu1.1_amd64.deb
ADD libpng12-0_1.2.54-1ubuntu1.1_i386.deb /libpng12-0_1.2.54-1ubuntu1.1_i386.deb
ADD Quartus-web-13.1.0.162-linux.tar /quartus
ADD QuartusSetup-13.1.4.182.run /quartus
RUN set -eux && \
dpkg --add-architecture i386 && \
apt-get update && \
apt-get install --no-install-recommends -y \
ca-certificates \
lib32ncurses5-dev \
libc6:i386 \
libfontconfig1 \
libglib2.0-0 \
libncurses5:i386 \
libsm6 \
libsm6:i386 \
libssl-dev \
libstdc++6:i386 \
libxext6:i386 \
libxft2:i386 \
libxrender1 \
libzmq3-dev \
locales \
make \
openjdk-8-jdk \
pkg-config \
unixodbc-dev \
wget \
xauth \
xvfb && \
dpkg --install /libpng12-0_1.2.54-1ubuntu1.1_amd64.deb /libpng12-0_1.2.54-1ubuntu1.1_i386.deb && \
ln -s /usr/bin/env /bin/env && \
/quartus/setup.sh --mode unattended --installdir /opt/quartus && \
chmod a+x /quartus/QuartusSetup-13.1.4.182.run && \
/quartus/QuartusSetup-13.1.4.182.run --mode unattended --installdir /opt/quartus && \
rm -rf /quartus

View File

@ -0,0 +1,34 @@
TOOL=quartus131
INSTALLER_URL=http://download.altera.com/akdlm/software/acdsinst/13.1/162/ib_tar/Quartus-web-13.1.0.162-linux.tar
UPDATE_URL=http://download.altera.com/akdlm/software/acdsinst/13.1.4/182/update/QuartusSetup-13.1.4.182.run
INSTALLER=Quartus-web-13.1.0.162-linux.tar
UPDATE=QuartusSetup-13.1.4.182.run
INSTALLER_CHECKSUM=BA705F9D15F3A43AB7E86D297F394EE3
UPDATE_CHECKSUM=172C8CD0EB631B988516F1182054F976
FILES=$(INSTALLER) $(UPDATE) Dockerfile
all: container-image-built
${INSTALLER}:
# curl -O $(INSTALLER_URL)
wget $(INSTALLER_URL)
@SUM=$$(md5sum $(INSTALLER) | awk '{print toupper($$1)}'); \
if [ "$$SUM" != "$(INSTALLER_CHECKSUM)" ]; then echo "Installer checksum doesn't match."; exit 1; fi
${UPDATE}:
# curl -O $(UPDATE_URL)
wget $(UPDATE_URL)
@SUM=$$(md5sum $(UPDATE) | awk '{print toupper($$1)}'); \
if [ "$$SUM" != "$(UPDATE_CHECKSUM)" ]; then echo "Updater checksum doesn't match."; exit 1; fi
container-image-built: $(FILES)
@docker rmi fpga:$(TOOL) &>/dev/null || true
@docker build -t fpga:$(TOOL) --build-arg "TOOL=$(TOOL)" .
@touch $@
.PHONY: clean
clean:
docker rmi fpga:$(TOOL) >&/dev/null || true
rm -f container-image-built

36
tools/docker-quartus/gen-xauth Executable file
View File

@ -0,0 +1,36 @@
#!/bin/bash
# generate xauth file for Docker container
CONTAINER_HOSTNAME=$1
XAUTH_FILE=$2
mkdir -p $(dirname $XAUTH_FILE)
# attempt to bring host DISPLAY/xauth to container
rm -f $XAUTH_FILE && touch $XAUTH_FILE
DOCKER_XAUTH=$(xauth list $DISPLAY | awk '{print $3}')
DOCKER_DISPLAY=$DISPLAY
# assume that <hostname>:# displays are TCP displays, use docker host IP as display in container
# this requres sshd_config option "X11UseLocalhost no"
if [[ $DISPLAY == $(hostname)* ]]; then
DOCKER_DISPLAY="172.17.0.1:$(echo $DISPLAY | cut -d : -f 2)"
fi
# if we have no magic cookie (e.g. bad DISPLAY, or wide-open DISPLAY), just bail
if [ "$DOCKER_XAUTH" == "" ]; then
echo $DOCKER_DISPLAY
exit
fi
# if DISPLAY is just :# (no hostname), assume this is a local unix-socket X11 server
if [[ $DOCKER_DISPLAY == :* ]]; then
xauth -f $XAUTH_FILE add $CONTAINER_HOSTNAME/unix$DOCKER_DISPLAY . $DOCKER_XAUTH
else
xauth -f $XAUTH_FILE add $DOCKER_DISPLAY . $DOCKER_XAUTH
fi
echo $DOCKER_DISPLAY

View File

@ -0,0 +1,11 @@
Create a docker image for quartus 13.1
Heavily based on https://github.com/halfmanhalftaco/fpga-docker, but uses
Ubuntu 18.04 as a base image (no need for a docker hub account).
Usage:
======
Create the docker image with 'make' and start it with 'run-fpga'.
Recomended for newer distros where this old Quartus version doesn't run
flawlessly.

54
tools/docker-quartus/run-fpga Executable file
View File

@ -0,0 +1,54 @@
#!/bin/bash
list_tools () {
echo "Available tools:"
docker images fpga
exit
}
tool=quartus131
container_id=$(docker images "fpga:$tool" --format "{{.ID}}")
if [ -z "$container_id" ]; then
echo "Couldn't locate an image for \"$tool\"."
list_tools
exit 1
fi
echo "Starting $tool-$container_id"
# settings overrides
docker_home=$(dirname $0)
### Set up X11 forwarding/authentication
if [[ "$DISPLAY" == "" ]]; then
echo "DISPLAY environment variable is not set. An X display is required to run."
exit 1
fi
username=$(whoami)
hostname="$tool-$username"
DISPLAY=$($docker_home/gen-xauth $hostname $docker_home/.Xauthority)
if [[ "$DISPLAY" == :* ]]; then
x11flags="--ipc=host -v /tmp/.X11-unix:/tmp/.X11-unix"
echo "Using DISPLAY=$DISPLAY via UNIX socket"
else
x11flags="-e QT_X11_NO_MITSHM=1 -e _X11_NO_MITSHM=1 -e _MITSHM=0"
echo "Using DISPLAY=$DISPLAY via TCP"
fi
docker run --rm -it \
-l fpga-docker --name $hostname -h $hostname \
-e "DISPLAY=$DISPLAY" $x11flags \
-e "FPGA_UID=$(id -u)" -e "FPGA_GID=$(id -g)" -e "FPGA_UNAME=$username" -e "HOME=/home/$username" \
-v /home/$username:/home/$username \
--device-cgroup-rule 'c 189:* rmw' \
-v /dev/bus/usb:/dev/bus/usb \
$container_id \
/opt/quartus/quartus/bin/quartus --64bit