├── .gitignore ├── README.markdown ├── UNLICENSE ├── lattice-diamond ├── .dockerignore ├── .gitignore ├── Dockerfile ├── install.sh ├── root.sh ├── run.sh ├── scripts │ ├── install.sh │ └── run.sh └── work │ └── .gitkeep └── lattice-icecube2 ├── .dockerignore ├── .gitignore ├── Dockerfile ├── install.sh ├── root.sh ├── run.sh └── scripts ├── install.sh └── run.sh /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.bak 3 | *.log 4 | *.tmp 5 | *.swp 6 | -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | # Dockerized FPGA toolchain experiments 2 | 3 | Special thanks to the author of the [Dockerized FPGA toolchains](https://section5.ch/index.php/2017/01/20/669/) blog post. 4 | 5 | ## Lattice Diamond 6 | 7 | Basic dockerization scripts for Lattice Diamond 3.13 can be found in `lattice-diamond/`. 8 | 9 | ### Initial setup 10 | 11 | 1. Run `docker build -t diamond .` 12 | 2. Download and copy these files into the `work` folder: 13 | - `diamond_3_13-base-56-2-x86_64-linux.rpm` 14 | 3. Copy your license.dat to the `work` folder 15 | 4. Run `./install.sh` 16 | 17 | This should build a docker image containing a working Lattice Diamond installation set up for *your current user*. 18 | 19 | ### Usage 20 | 21 | Run `./run.sh` to start Lattice Diamond. The script sets up X11 forwarding, mounts a persistent volume at `/home/youruser`, mounts your host-side home directory as a writable volume at `/home/youruser/home`. 22 | 23 | ### Debugging Lattice Diamond problems 24 | 25 | Run `./root.sh` to start a root bash shell. 26 | 27 | ## Lattice iCEcube2 28 | 29 | Basic dockerization scripts for Lattice iCEcube2 2020.12 can be found in `lattice-icecube2/`. 30 | 31 | ### Initial setup 32 | 33 | 1. Run `docker build -t icecube2 .` 34 | 2. Download and copy these files into the `work` folder: 35 | - `iCEcube2setup_Dec_10_2020_2012` (not the zip file you can download but the installer file inside it!) 36 | 3. Copy your license.dat to the `work` folder 37 | 4. Run `./install.sh` 38 | 5. **Install iCEcube2 to `/opt/docker-fpga/icecube2` when prompted**. Ignore the warning about the directory already existing, skip the license file selection, and uncheck the box "Launch iCEcube2 now". 39 | 40 | This should build a docker image containing a working Lattice iCEcube2 installation set up for *your current user*. 41 | 42 | ### Usage 43 | 44 | Run `./run.sh` to start Lattice iCEcube2. The script sets up X11 forwarding, mounts a persistent volume at `/home/youruser`, mounts your host-side home directory as a writable volume at `/home/youruser/home`. 45 | 46 | ### Debugging Lattice iCEcube2 problems 47 | 48 | Run `./root.sh` to start a root bash shell. 49 | 50 | ## License 51 | 52 | These scripts are released into the public domain according to [The Unlicense](http://unlicense.org). 53 | 54 | Note: Lattice Diamond and iCEcube2 themselves are proprietary licensed software, and you as the user are responsible for following their license agreements. 55 | -------------------------------------------------------------------------------- /UNLICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /lattice-diamond/.dockerignore: -------------------------------------------------------------------------------- 1 | work/ 2 | -------------------------------------------------------------------------------- /lattice-diamond/.gitignore: -------------------------------------------------------------------------------- 1 | work/*.rpm 2 | work/license.dat 3 | -------------------------------------------------------------------------------- /lattice-diamond/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rockylinux:8 2 | 3 | # Source: Lattice Diamond 3.13 installation guide 4 | # First yum install adds all dependencies listed in the guide 5 | # Second yum install adds all 32-bit dependencies for ModelSim listed in the guide 6 | # Third yum install adds all dependencies *not listed* in the guide, but which 7 | # are absolutely required for Diamond to work... 8 | RUN yum update -y && \ 9 | yum install -y glibc nss-softokn-freebl libjpeg libtiff zlib glib2 libselinux \ 10 | gamin libusb freetype fontconfig expat libX11 libxcb libXau libICE libSM \ 11 | libuuid libXt libXext libXrender libXi libXft && \ 12 | yum install -y bzip2-libs.i686 expat.i686 fontconfig.i686 freetype.i686 \ 13 | ncurses-libs.i686 nss-softokn-freebl.i686 zlib.i686 \ 14 | libXft.i686 libXrender.i686 libpng.i686 libuuid.i686 libX11.i686 \ 15 | libXau.i686 libxcb.i686 libXext.i686 && \ 16 | yum install -y perl tcsh libXScrnSaver && \ 17 | yum install -y firefox && \ 18 | yum clean all -y 19 | 20 | COPY scripts/install.sh scripts/run.sh /opt/docker-fpga/ 21 | -------------------------------------------------------------------------------- /lattice-diamond/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | 4 | ID=`docker run -dti \ 5 | --privileged --ipc host \ 6 | -v "${PWD}"/work:/opt/docker-fpga/work \ 7 | -e USER_UID=$(id -u) \ 8 | -e USER_GID=$(id -g) \ 9 | -e USER_NAME="${USER}" \ 10 | -w /opt/docker-fpga \ 11 | diamond:latest \ 12 | /opt/docker-fpga/install.sh` 13 | 14 | docker attach "${ID}" 15 | docker commit "${ID}" diamond:"${USER}" 16 | -------------------------------------------------------------------------------- /lattice-diamond/root.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | 4 | NET_DEVICE=`ip route show default | awk '{print $5}'` 5 | MAC_ADDRESS=`cat /sys/class/net/"${NET_DEVICE}"/address` 6 | 7 | ID=`docker run -dit -e DISPLAY="${DISPLAY}" \ 8 | --mac-address="${MAC_ADDRESS}" \ 9 | --privileged --ipc host \ 10 | -v docker-fpga-${USER}:"${HOME}" \ 11 | -v /etc/machine-id:/etc/machine-id \ 12 | -v /dev/bus/usb/:/dev/bus/usb/ \ 13 | -v /tmp/.X11-unix/:/tmp/.X11-unix \ 14 | -v "${HOME}":"${HOME}"/home \ 15 | -e MOZ_NO_REMOTE=1 \ 16 | -u root \ 17 | diamond:"${USER}" \ 18 | /bin/bash` 19 | 20 | docker attach "${ID}" 21 | 22 | read -r -p "Commit changes to image? (type y to continue): " 23 | if [[ $REPLY =~ ^[Yy]$ ]] 24 | then 25 | docker commit "${ID}" diamond:"${USER}" 26 | fi 27 | -------------------------------------------------------------------------------- /lattice-diamond/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | 4 | NET_DEVICE=`ip route show default | awk '{print $5}'` 5 | MAC_ADDRESS=`cat /sys/class/net/"${NET_DEVICE}"/address` 6 | 7 | docker run -it -d --rm -e DISPLAY="${DISPLAY}" \ 8 | --mac-address="${MAC_ADDRESS}" \ 9 | --privileged --ipc host \ 10 | -v docker-fpga-${USER}:"${HOME}" \ 11 | -v /etc/machine-id:/etc/machine-id \ 12 | -v /dev/bus/usb/:/dev/bus/usb/ \ 13 | -v /tmp/.X11-unix/:/tmp/.X11-unix \ 14 | -v "${HOME}":"${HOME}"/home \ 15 | -e MOZ_NO_REMOTE=1 \ 16 | -u "${USER}" \ 17 | -w "${HOME}" \ 18 | diamond:"${USER}" \ 19 | /bin/bash -c /opt/docker-fpga/run.sh 20 | -------------------------------------------------------------------------------- /lattice-diamond/scripts/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | 4 | rpm -i /opt/docker-fpga/work/diamond_3_13-base-56-2-x86_64-linux.rpm 5 | cp /opt/docker-fpga/work/license.dat /usr/local/diamond/3.13/license/license.dat 6 | 7 | groupadd -g "${USER_GID}" "${USER_NAME}" 8 | adduser -u "${USER_UID}" -g "${USER_GID}" "${USER_NAME}" 9 | -------------------------------------------------------------------------------- /lattice-diamond/scripts/run.sh: -------------------------------------------------------------------------------- 1 | DIAMOND_DIR=/usr/local/diamond/3.13 2 | bindir=$DIAMOND_DIR/bin/lin64 3 | export QT_GRAPHICSSYSTEM=native 4 | source $bindir/diamond_env 5 | diamond 6 | -------------------------------------------------------------------------------- /lattice-diamond/work/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gekkio/docker-fpga/236a5133b918ab3193efa39727bb7c937ce9d2bb/lattice-diamond/work/.gitkeep -------------------------------------------------------------------------------- /lattice-icecube2/.dockerignore: -------------------------------------------------------------------------------- 1 | work/ 2 | -------------------------------------------------------------------------------- /lattice-icecube2/.gitignore: -------------------------------------------------------------------------------- 1 | /work/ 2 | -------------------------------------------------------------------------------- /lattice-icecube2/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rockylinux:8 2 | 3 | RUN yum update -y && \ 4 | yum install -y glibc.i686 zlib.i686 glib2.i686 \ 5 | freetype.i686 fontconfig.i686 expat.i686 libX11.i686 libICE.i686 libSM.i686 \ 6 | libuuid.i686 libXext.i686 libXrender.i686 libXi.i686 \ 7 | libXcursor.i686 libXfixes.i686 libXinerama.i686 libXrandr.i686 libpng12.i686 libpng15.i686 \ 8 | libstdc++.i686 libnsl.i686 \ 9 | elfutils-libelf.i686 && \ 10 | yum install -y perl tcsh && \ 11 | yum install -y firefox && \ 12 | yum clean all -y 13 | 14 | COPY scripts/install.sh scripts/run.sh /opt/docker-fpga/ 15 | -------------------------------------------------------------------------------- /lattice-icecube2/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | 4 | ID=`docker run -dti -e DISPLAY="${DISPLAY}" \ 5 | --privileged --ipc host \ 6 | -v "${PWD}"/work:/opt/docker-fpga/work \ 7 | -v /etc/machine-id:/etc/machine-id \ 8 | -v /tmp/.X11-unix/:/tmp/.X11-unix \ 9 | -e USER_UID=$(id -u) \ 10 | -e USER_GID=$(id -g) \ 11 | -e USER_NAME="${USER}" \ 12 | -w /opt/docker-fpga \ 13 | icecube2:latest \ 14 | /opt/docker-fpga/install.sh` 15 | 16 | echo Instructions: 17 | echo - choose /opt/docker-fpga/icecube2 as the installation directory, ignoring the warning about the directory already existing 18 | echo - skip the license file selection 19 | echo - uncheck the box \"Launch iCEcube2 now\". 20 | 21 | docker attach "${ID}" 22 | docker commit "${ID}" icecube2:"${USER}" 23 | -------------------------------------------------------------------------------- /lattice-icecube2/root.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | 4 | NET_DEVICE=`ip route show default | awk '{print $5}'` 5 | MAC_ADDRESS=`cat /sys/class/net/"${NET_DEVICE}"/address` 6 | 7 | ID=`docker run -dit -e DISPLAY="${DISPLAY}" \ 8 | --mac-address="${MAC_ADDRESS}" \ 9 | --privileged --ipc host \ 10 | -v docker-fpga-${USER}:"${HOME}" \ 11 | -v /etc/machine-id:/etc/machine-id \ 12 | -v /dev/bus/usb/:/dev/bus/usb/ \ 13 | -v /tmp/.X11-unix/:/tmp/.X11-unix \ 14 | -v "${HOME}":"${HOME}"/home \ 15 | -e MOZ_NO_REMOTE=1 \ 16 | -u root \ 17 | icecube2:"${USER}" \ 18 | /bin/bash` 19 | 20 | docker attach "${ID}" 21 | 22 | read -r -p "Commit changes to image? (type y to continue): " 23 | if [[ $REPLY =~ ^[Yy]$ ]] 24 | then 25 | docker commit "${ID}" icecube2:"${USER}" 26 | fi 27 | -------------------------------------------------------------------------------- /lattice-icecube2/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | 4 | NET_DEVICE=`ip route show default | awk '{print $5}'` 5 | MAC_ADDRESS=`cat /sys/class/net/"${NET_DEVICE}"/address` 6 | 7 | docker run -it -d --rm -e DISPLAY="${DISPLAY}" \ 8 | --mac-address="${MAC_ADDRESS}" \ 9 | --privileged --ipc host \ 10 | -v docker-fpga-${USER}:"${HOME}" \ 11 | -v /etc/machine-id:/etc/machine-id \ 12 | -v /dev/bus/usb/:/dev/bus/usb/ \ 13 | -v /tmp/.X11-unix/:/tmp/.X11-unix \ 14 | -v "${HOME}":"${HOME}"/home \ 15 | -e MOZ_NO_REMOTE=1 \ 16 | -u "${USER}" \ 17 | -w "${HOME}" \ 18 | icecube2:"${USER}" \ 19 | /bin/bash -c /opt/docker-fpga/run.sh 20 | -------------------------------------------------------------------------------- /lattice-icecube2/scripts/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | 4 | groupadd -g "${USER_GID}" "${USER_NAME}" 5 | adduser -u "${USER_UID}" -g "${USER_GID}" "${USER_NAME}" 6 | 7 | mkdir /opt/docker-fpga/icecube2 8 | chown "${USER_UID}":"${USER_GID}" /opt/docker-fpga/icecube2 9 | cp /opt/docker-fpga/work/license.dat /opt/docker-fpga/icecube2/license.dat 10 | 11 | su "${USER_NAME}" -c /opt/docker-fpga/work/iCEcube2setup_Dec_10_2020_2012 12 | -------------------------------------------------------------------------------- /lattice-icecube2/scripts/run.sh: -------------------------------------------------------------------------------- 1 | #/bin/bash 2 | set -euo pipefail 3 | 4 | export LM_LICENSE_FILE=/opt/docker-fpga/icecube2/license.dat 5 | 6 | /opt/docker-fpga/icecube2/iCEcube2 7 | --------------------------------------------------------------------------------