From dc69feee26109619023cf4f645fc96a3df3d45b9 Mon Sep 17 00:00:00 2001
From: Yaman Umuroglu <maltanar@gmail.com>
Date: Tue, 28 Jul 2020 15:35:19 +0200
Subject: [PATCH] [Docker] download PYNQ board files in entrypoint script, add
 .gitignore

---
 .gitignore                 |  3 +++
 docker/Dockerfile.finn_ci  |  2 +-
 docker/Dockerfile.finn_dev |  2 +-
 docker/finn_entrypoint.sh  | 15 +++++++++++++++
 4 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index 8b3166a44..d7ee7e014 100644
--- a/.gitignore
+++ b/.gitignore
@@ -81,3 +81,6 @@ MANIFEST
 
 # SSH key dir mounted into Docker
 /ssh_keys/
+
+# PYNQ board files
+/board_files/
diff --git a/docker/Dockerfile.finn_ci b/docker/Dockerfile.finn_ci
index 7d5772d9f..0d122133a 100644
--- a/docker/Dockerfile.finn_ci
+++ b/docker/Dockerfile.finn_ci
@@ -37,7 +37,7 @@ RUN apt-get update
 RUN apt-get -y upgrade
 RUN apt-get install -y build-essential libglib2.0-0 libsm6 libxext6 libxrender-dev
 RUN apt-get install -y verilator zsh
-RUN apt-get -y install sshpass
+RUN apt-get -y install sshpass wget unzip
 RUN echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config
 
 # cloning dependency repos
diff --git a/docker/Dockerfile.finn_dev b/docker/Dockerfile.finn_dev
index 8c1502eb4..f8e15f34f 100644
--- a/docker/Dockerfile.finn_dev
+++ b/docker/Dockerfile.finn_dev
@@ -43,7 +43,7 @@ RUN apt-get update
 RUN apt-get -y upgrade
 RUN apt-get install -y build-essential libglib2.0-0 libsm6 libxext6 libxrender-dev
 RUN apt-get install -y verilator nano zsh rsync
-RUN apt-get -y install sshpass
+RUN apt-get -y install sshpass wget unzip
 RUN echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config
 
 COPY requirements.txt .
diff --git a/docker/finn_entrypoint.sh b/docker/finn_entrypoint.sh
index ee75089c6..727518173 100644
--- a/docker/finn_entrypoint.sh
+++ b/docker/finn_entrypoint.sh
@@ -57,4 +57,19 @@ if [ ! -z "$VITIS_PATH" ];then
   export XILINX_VITIS=$VITIS_PATH
   source $VITIS_PATH/settings64.sh
 fi
+
+# download PYNQ board files if not already there
+if [ ! -d "/workspace/finn/board_files" ]; then
+    gecho "Downloading PYNQ board files for Vivado"
+    wget -q https://github.com/cathalmccabe/pynq-z1_board_files/raw/master/pynq-z1.zip
+    wget -q https://d2m32eurp10079.cloudfront.net/Download/pynq-z2.zip
+    unzip -q pynq-z1.zip
+    unzip -q pynq-z2.zip
+    mkdir /workspace/finn/board_files
+    mv pynq-z1/ board_files/
+    mv pynq-z2/ board_files/
+    rm pynq-z1.zip
+    rm pynq-z2.zip
+fi
+
 exec "$@"
-- 
GitLab