Vagrant configuration for easy development setup

Signed-off-by: Rick Altherr <kc8apf@kc8apf.net>
This commit is contained in:
Rick Altherr 2017-12-23 18:55:28 -08:00
parent f602ed79d8
commit 8fa4b3ce82
3 changed files with 86 additions and 0 deletions

21
vagrant/README.md Normal file
View File

@ -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\_<version>) 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).

59
vagrant/Vagrantfile vendored Normal file
View File

@ -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

6
vagrant/profile.d/vivado.sh Executable file
View File

@ -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