From 8fa4b3ce82edaf938b28d352edabbf01f10e892e Mon Sep 17 00:00:00 2001 From: Rick Altherr Date: Sat, 23 Dec 2017 18:55:28 -0800 Subject: [PATCH] Vagrant configuration for easy development setup Signed-off-by: Rick Altherr --- vagrant/README.md | 21 +++++++++++++ vagrant/Vagrantfile | 59 +++++++++++++++++++++++++++++++++++++ vagrant/profile.d/vivado.sh | 6 ++++ 3 files changed, 86 insertions(+) create mode 100644 vagrant/README.md create mode 100644 vagrant/Vagrantfile create mode 100755 vagrant/profile.d/vivado.sh diff --git a/vagrant/README.md b/vagrant/README.md new file mode 100644 index 00000000..b318cb04 --- /dev/null +++ b/vagrant/README.md @@ -0,0 +1,21 @@ +Vagrant config for constructing a prjxray development environment. + +* Install vagrant and virtualbox +* Download Vivado full installer (should be ~16GB) +* Extract the Vivado tar.gz +* Move the extracted installer (Xilinx\_Vivado\_SDK\_) to this directory +* Rename the Vivado installer folder to 'Vivado' +* Run 'vagrant up' + +Be patient. While the VM will start with an Ubuntu image quickly, all of the +desktop packages need to be installed followed by Vivado. File-sharing with +the VM uses NFS by default for speed. You may need to install nfsd if you are +using Linux. macOS includes ones. + +After 'vagrant up' has finished, the VM will be booted and ready. This +directory is mounted at /vagrant and the parent directory is mounted at +/prjxray. In most cases, you'll want to change to /prjxray and follow the +instructions in README.md. + +Vivado WEBPACK edition is installed. No license is required for the artix7 part of +interest (xc7a50tfgg484). diff --git a/vagrant/Vagrantfile b/vagrant/Vagrantfile new file mode 100644 index 00000000..7c71ae31 --- /dev/null +++ b/vagrant/Vagrantfile @@ -0,0 +1,59 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + config.vm.box = "bento/ubuntu-16.04" + + config.vm.network "private_network", type: "dhcp" + + # Share an additional folder to the guest VM. The first argument is + # the path on the host to the actual folder. The second argument is + # the path on the guest to mount the folder. And the optional third + # argument is a set of non-required options. + config.vm.synced_folder "..", "/prjxray", type: "nfs" + + config.vm.provider "virtualbox" do |vb| + vb.gui = true + end + + # Base boxes are almost always server installs. Install the desktop + # components along with the C++ build tools. + config.vm.provision "shell", inline: <<-SHELL + apt-get update + apt-get upgrade -y + apt-get install -y ubuntu-desktop build-essential git cmake + SHELL + + # Strangely, headless Vivado installs still require a running X server. + # Turn on auto-login so the user's X server is active. + config.vm.provision "shell", inline: <<-SHELL + mkdir -p /etc/lightdm/ + echo "[Seat:*]" > /etc/lightdm/lightdm.conf + echo "autologin-user=vagrant" >> /etc/lightdm/lightdm.conf + systemctl start lightdm + SHELL + + # Install Vivado. + config.vm.provision "shell", inline: <<-SHELL + if [ ! -d /vagrant/Vivado ]; then + echo "No Vivado download found. Skipping install." + else + echo "Installing Vivado. This takes a while. I suggest going for a walk." + export DISPLAY=:0 + /vagrant/Vivado/xsetup --agree 3rdPartyEULA,WebTalkTerms,XilinxEULA --batch Install -e "Vivado HL WebPACK" --location "/opt/Xilinx" + cp /vagrant/profile.d/* /etc/profile.d/ + fi + SHELL + + # Turn off idle screen locking and screensaver password. + config.vm.provision "shell" do |s| + s.privileged = false + s.inline = <<-SHELL + export DISPLAY=:0 + dconf write /org/gnome/desktop/screensaver/idle-activation-enabled false + dconf write /org/gnome/desktop/screensaver/lock-enabled false + SHELL + end + + config.vm.provision :reload +end diff --git a/vagrant/profile.d/vivado.sh b/vagrant/profile.d/vivado.sh new file mode 100755 index 00000000..34b77ddb --- /dev/null +++ b/vagrant/profile.d/vivado.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +VIVADO_BIN="$(find /opt/Xilinx/Vivado -maxdepth 2 -name bin)" +if [ -n "$VIVADO_BIN" ]; then + export PATH=$PATH:$VIVADO_BIN +fi