├── .dockerignore ├── Dockerfile ├── README.md └── install_config.txt /.dockerignore: -------------------------------------------------------------------------------- 1 | README.md 2 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:22.04 2 | 3 | # based on Dockerfile from Colm Ryan 4 | MAINTAINER Matteo Vit 5 | 6 | # build with docker build --build-arg VIVADO_TAR_HOST=host:port --build-arg VIVADO_TAR_FILE=Xilinx_Vivado_SDK_2016.3_1011_1 -t vivado . 7 | 8 | #install dependences for: 9 | # * downloading Vivado (wget) 10 | # * xsim (gcc build-essential to also get make) 11 | # * MIG tool (libglib2.0-0 libsm6 libxi6 libxrender1 libxrandr2 libfreetype6 libfontconfig) 12 | # * CI (git) 13 | RUN dpkg --add-architecture i386 14 | RUN apt-get update && apt-get install -y \ 15 | wget \ 16 | build-essential \ 17 | libglib2.0-0 \ 18 | libsm6 \ 19 | libxi6 \ 20 | libxrender1 \ 21 | libxrandr2 \ 22 | libfreetype6 \ 23 | libfontconfig \ 24 | locales \ 25 | git \ 26 | gawk \ 27 | iproute2 \ 28 | python3 \ 29 | gcc \ 30 | make \ 31 | net-tools \ 32 | libncurses5-dev \ 33 | tftpd \ 34 | zlib1g-dev \ 35 | libssl-dev \ 36 | flex \ 37 | bison \ 38 | libselinux1 \ 39 | gnupg \ 40 | git-core \ 41 | diffstat \ 42 | chrpath \ 43 | socat \ 44 | xterm \ 45 | autoconf \ 46 | libtool \ 47 | rsync \ 48 | texinfo \ 49 | gcc-multilib \ 50 | zlib1g:i386 \ 51 | lsb-release \ 52 | libtinfo5 \ 53 | dnsutils \ 54 | bc \ 55 | unzip \ 56 | iverilog \ 57 | python3-pip 58 | 59 | 60 | # copy in config file 61 | COPY install_config.txt / 62 | 63 | RUN locale-gen en_US.UTF-8 64 | ENV LANG en_US.UTF-8 65 | ENV LANGUAGE en_US:en 66 | ENV LC_ALL en_US.UTF-8 67 | 68 | # set bash as default shell 69 | RUN echo "dash dash/sh boolean false" | debconf-set-selections 70 | RUN DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash 71 | 72 | # download and run the install 73 | ARG VIVADO_TAR_HOST 74 | ARG VIVADO_TAR_FILE 75 | ARG VIVADO_VERSION 76 | RUN echo "Downloading ${VIVADO_TAR_FILE} from ${VIVADO_TAR_HOST}" && \ 77 | wget ${VIVADO_TAR_HOST}/${VIVADO_TAR_FILE}.tar.gz -q && \ 78 | echo "Extracting Vivado tar file" && \ 79 | tar xzf ${VIVADO_TAR_FILE}.tar.gz && \ 80 | /${VIVADO_TAR_FILE}/xsetup --agree 3rdPartyEULA,XilinxEULA --batch Install --config install_config.txt && \ 81 | rm -rf ${VIVADO_TAR_FILE}* 82 | 83 | # get boards files 84 | RUN wget https://github.com/Xilinx/XilinxBoardStore/archive/refs/heads/${VIVADO_VERSION}.zip && \ 85 | unzip ${VIVADO_VERSION}.zip && \ 86 | cp -a XilinxBoardStore-${VIVADO_VERSION}/boards/* /opt/Xilinx/Vivado/${VIVADO_VERSION}/data/xhub/boards/ && \ 87 | rm -rf ${VIVADO_VERSION}.zip && \ 88 | rm -rf XilinxBoardStore-${VIVADO_VERSION} 89 | 90 | #make a xilinx user 91 | RUN adduser --disabled-password --gecos '' xilinx 92 | USER xilinx 93 | WORKDIR /home/xilinx 94 | #add vivado tools to path 95 | RUN echo "source /opt/Xilinx/Vivado/${VIVADO_VERSION}/settings64.sh" >> /home/xilinx/.profile 96 | 97 | #copy in the license file 98 | RUN mkdir /home/xilinx/.Xilinx 99 | #COPY Xilinx.lic /home/xilinx/.Xilinx/ 100 | 101 | ARG PETALINUX_VERSION 102 | # install petalinux 103 | ENV PETALINUX_FILE petalinux-v${VIVADO_VERSION}-${PETALINUX_VERSION}-installer.run 104 | RUN echo "Downloading ${PETALINUX_FILE} from ${VIVADO_TAR_HOST}" && \ 105 | wget ${VIVADO_TAR_HOST}/${PETALINUX_FILE} -q && \ 106 | chmod a+x ${PETALINUX_FILE} && \ 107 | mkdir -p /home/xilinx/petalinux && \ 108 | ./${PETALINUX_FILE} -y --dir /home/xilinx/petalinux/${VIVADO_VERSION} --platform "arm aarch64" && \ 109 | rm -rf ${PETALINUX_FILE} 110 | 111 | RUN echo "source /home/xilinx/petalinux/${VIVADO_VERSION}/settings.sh" >> /home/xilinx/.profile 112 | 113 | USER root 114 | #add vivado tools to path (root) 115 | RUN echo "source /opt/Xilinx/Vivado/${VIVADO_VERSION}/settings64.sh" >> /root/.profile 116 | 117 | #copy in the license file (root) 118 | RUN mkdir -p /root/.Xilinx 119 | #COPY Xilinx.lic /root/.Xilinx/ 120 | 121 | USER xilinx 122 | 123 | # install cocotb 124 | RUN pip install cocotb 125 | RUN pip install cocotb-bus 126 | RUN pip install pytest 127 | 128 | RUN echo 'export PATH="$PATH:~/.local/bin"' >> /home/xilinx/.bashrc 129 | RUN echo "source /opt/Xilinx/Vivado/${VIVADO_VERSION}/settings64.sh" >> /home/xilinx/.bashrc 130 | RUN echo "source /home/xilinx/petalinux/${VIVADO_VERSION}/settings.sh" >> /home/xilinx/.bashrc 131 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vivado-docker 2 | 3 | Vivado and Petalinux installed into a docker image for CI purposes. 4 | 5 | ## Build instructions 6 | 7 | 1. This docker file assumes the Vivado and Petalinux download are available on a webserver somewhere. This can easily be the build machine using the webserver in Python. 8 | ```shell 9 | cd /path/to/Vivado/download 10 | python -m http.server 11 | ``` 12 | 2. Copy your Vivado `Xilinx.lic` file into the directory. 13 | 3. Potentialy modify the `install_config.txt` to change the install options. 14 | 4. Build the image (will take about 10 minutes) passing in a build arg 15 | ```shell 16 | docker build --build-arg VIVADO_TAR_HOST=192.168.1.219:8000 --build-arg VIVADO_TAR_FILE=Xilinx_Unified_2022.2_1014_8888 -t xilinx:2022.2 --build-arg VIVADO_VERSION=2022.2 --build-arg PETALINUX_VERSION=10141622 . 17 | ``` 18 | 19 | ## Running 20 | 21 | The `Dockerfile` sets up a `vivado` user to avoid running as root. I have only considered running Vivado in `batch` mode for running CI simulations and building bit files. For development work with the GUI you may have to fiddle with X11 settings. 22 | -------------------------------------------------------------------------------- /install_config.txt: -------------------------------------------------------------------------------- 1 | #### Vivado ML Standard Install Configuration #### 2 | Edition=Vivado ML Standard 3 | 4 | Product=Vivado 5 | 6 | # Path where AMD FPGAs & Adaptive SoCs software will be installed. 7 | Destination=/opt/Xilinx 8 | 9 | # Choose the Products/Devices the you would like to install. 10 | Modules=Virtex UltraScale+ HBM:1,Kintex UltraScale:1,Vitis Networking P4:0,Artix UltraScale+:1,Spartan-7:1,Artix-7:1,Virtex UltraScale+:1,Vitis Model Composer(Toolbox for MATLAB and Simulink. Includes the functionality of System Generator for DSP):1,DocNav:1,Zynq UltraScale+ MPSoC:1,Zynq-7000:1,Virtex UltraScale+ 58G:1,Power Design Manager (PDM):0,Vitis Embedded Development:0,Kintex-7:1,Install Devices for Kria SOMs and Starter Kits:1,Kintex UltraScale+:1 11 | 12 | # Choose the post install scripts you'd like to run as part of the finalization step. Please note that some of these scripts may require user interaction during runtime. 13 | InstallOptions= 14 | 15 | ## Shortcuts and File associations ## 16 | # Choose whether Start menu/Application menu shortcuts will be created or not. 17 | CreateProgramGroupShortcuts=1 18 | 19 | # Choose the name of the Start menu/Application menu shortcut. This setting will be ignored if you choose NOT to create shortcuts. 20 | ProgramGroupFolder=Xilinx Design Tools 21 | 22 | # Choose whether shortcuts will be created for All users or just the Current user. Shortcuts can be created for all users only if you run the installer as administrator. 23 | CreateShortcutsForAllUsers=0 24 | 25 | # Choose whether shortcuts will be created on the desktop or not. 26 | CreateDesktopShortcuts=1 27 | 28 | # Choose whether file associations will be created or not. 29 | CreateFileAssociation=1 30 | 31 | # Choose whether disk usage will be optimized (reduced) after installation 32 | EnableDiskUsageOptimization=1 33 | 34 | --------------------------------------------------------------------------------