I am commonly asked how I setup my FPGA development environment on a Mac OS platform, so every time that I make a major upgrade or overhaul I take the time to document it. I personally prefer to do my development in a Linux environment (specifically Ubuntu) but I still like to have access to the Mac OS because I prefer to do my admin stuff on the Mac side (ie - word processing, calendar, email, etc.). Therefore running Ubuntu in a VM is the ideal solution for me.
Specifically, I highly recommend Parallels even though there are free options out there. Personally, I've found that you really get what you pay for with Parallels: it's very stable, setup & integration is easy, and it's well supported.
Today I'm finally upgrading to Ubuntu 20.04, but I don't want to let go of my known-good and stable Ubuntu 18.04 VM. So I decided to pick up an extra 1TB external SSD and install my Ubuntu 20.04 on. I'm guessing VMs on external hard drives is going to be my MO going forward so I can easily have whatever version of Ubuntu (or Windows) on hand at any time.
Download Ubuntu 20.04 ISOFirst things first, download the image file of the Linux distribution to install. In this case: ubuntu-xx.xx.x-desktop-amd64.iso where xx.xx.x is your desired version of Ubuntu, which in my case is 20.04.1. Find whatever version of Ubuntu you want here and save it to your Downloads folder.
Plug in the external hard drive to install the VM on and launch Parallels.
Upon launching Parallels, I see my existing Ubuntu 18.04 VM so to create a new VM launch the Installation Assistant by selecting File > New...
The Installation Assistant will detect any valid image files in the system for you to select. I have both an Ubuntu 18.04.4 and Ubuntu 20.04.1 image file saved to my MacBook Pro:
Once the desired image file for the installation has been selected, Parallels will prompt you to set your username and password for Ubuntu:
Next select the installation location, which is the external hard drive that's showing up on my MacBook Pro as Extreme SSD. Also be sure to check the box to Customize settings before installation, then click Continue.
The settings this allows you to customize is the hardware configuration for the VM, such as how much hard drive space, DDR, graphics, processor cores, etc. it is allocated. By default, Parallels sets all of these values very low (64GB hard drive space, 2GB DDR memory, 2 processor cores).
You don't want to allow the VM to have full access to all hardware because that will conflict with the host OS (Mac OS), so I usually give it access to half. My MacBook Pro has 16 available processor cores and 64GB of DDR, so I allow the VM access to 8 processor cores and 32GB of DDR.
Since this 1TB external hard drive is being dedicated to this VM however, I did configure it to have full access to it.
Once the hardware for the VM is configured as desired, close the Configuration window to return to the Installation Assistant and click Continue.
This will boot from the ISO and start the installation. Since I'm using an external hard drive I did get this little reminder pop up window telling me to make sure to not unplug the external drive while the VM is running.
The Ubuntu 20.04 installation did seem to take a little long on the external drive compared to how long it took with my Ubuntu 18.04 installation on my internal drive, but it wasn't a huge difference (thanks USB C).
Ubuntu Environment PrepAt this point, just walk through the setup and configuration of the Ubuntu OS as per usual.
Once fully booted, I like to rename the device/computer as a personal preference so that when I transfer my Vivado projects between Ubuntu images, the absolute paths in the projects end up being the same (the default device/computer name is "parallels"):
With Ubuntu ready to go now, the next step is to install the necessary Vivado/Vitis 2021.2 dependencies and configure the environment.
Vivado/Vitis, and PetaLinux require the 32-bit architecture to be enabled in the system, as well as the shell being set to bash (by default it's configured to dash on a fresh install of Ubuntu 20.04):
~$ sudo dpkg --add-architecture i386
~$ sudo dpkg-reconfigure dash
Use apt to install (~$ sudo apt-get install <package>) the following dependencies for Vivado/Vitis and PetaLinux:
iproute2
make
libncurses5-dev
tftpd
libselinux1
wget
diffstat
chrpath
socat
tar
unzip
gzip
python
tofrodos
lib32stdc++6
libgtk2.0-0:i386
libfontconfig1:i386
libx11-6:i386
libxext6:i386
libxrender1:i386
libsm6:i386
xinetd
gawk
gcc
net-tools
ncurses-dev
openssl
libssl-dev
flex
bison
xterm
autoconf
libtool
texinfo
zlib1g-dev
gcc-multilib
build-essential
automake
screen
putty
pax
g++
python3-pip
xz-utils
python3-git
python3-jinja2
python3-pexpect
debianutils
iputils-ping
libegl1-mesa
libsdl1.2-dev
pylint3
python3
cpio
tftpd-hpa
gnupg
zlib1g:i386
haveged
perl
liberror-perl
mtd-utils
xtrans-dev
libxcb-randr0-dev
libxcb-xtest0-dev
libxcb-xinerama0-dev
libxcb-shape0-dev
libxcb-xkb-dev
openssh-server
util-linux
sysvinit-utils
cython
google-perftools
libncurses5
libncurses5-dev
libncursesw5-dev
libncurses5:i386
libtinfo5
libstdc++6:i386
libgtk2.0-0:i386
dpkg-dev:i386
Create a TFTP server for PetaLinux:
~$ sudo gedit /etc/xinetd.d/tftp
Then copy+paste the following into the PetaLinux TFTP server:
service tftp
{
protocol = udp
port = 69
socket_type = dgram
wait = yes
user = nobody
server = /usr/sbin/in.tftpd
server_args = /tftpboot
disable = no
}
Create the directory where the boot files would be copied from during a TFTP boot and give it the appropriate permissions. Stop and restart the extended internet service in Ubuntu to make the changes take effect in the system:
~$ sudo mkdir /tftpboot
~$ sudo chmod -R 777 /tftpboot
~$ sudo chown -R nobody /tftpboot
~$ sudo /etc/init.d/xinetd stop
~$ sudo /etc/init.d/xinetd start
Add the user to the dial out group so Vitis/Vivado can access the USB ports of the computer:
~$ sudo adduser $USER dialout
Install Vitis 2021.2The Vitis SW installer includes the option to install Vivado as well, so you only need to download the Vitis SW installer from Xilinx website:
Extract the tarball and run the installer script:
~$ cd ./Downloads/Xilinx_Unified_2021.2_1021_0703/
~/Downloads/Xilinx_Unified_2021.2_1021_0703$ sudo ./xsetup
A GUI will pop up to walk you through the installation. Be sure to choose the option for Vitis that include Vivado in the installation. Once you've walked through all of the configuration steps in the GUI you'll be shown a summary of what's about to be installed on the system.
My installation took a little over half an hour with the way I have the hardware configured in the VM.
Once the main installation is complete, close the installation GUI and install the cable drivers using the appropriate script now available in the Xilinx directory:
~$ cd /tools/Xilinx/Vivado/2021.2/data/xicom/cable_drivers/lin64/install_script/install_drivers/
~/tools/Xilinx/Vivado/2021.2/data/xicom/cable_drivers/lin64/install_script/install_drivers$ sudo ./install_drivers
Test by launching Vivado/Vitis:
~$ source /tools/Xilinx/Vivado/2021.2/settings64.sh
~$ vivado
~$ source /tools/Xilinx/Vitis/2021.2/settings64.sh
~$ vitis
Install PetaLinux 2021.2Create a directory for PetaLinux in the Xilinx installation directory:
~$ sudo mkdir -p /tools/Xilinx/PetaLinux/2021.2/
Give the PetaLinux directory the appropriate permissions:
~$ sudo chmod -R 755 /tools/Xilinx/PetaLinux/2021.2/
~$ sudo chown -R whitney:whitney /tools/Xilinx/PetaLinux/2021.2/
Download the PetaLinux installer from Xilinx website:
Then make the installer executable:
~$ sudo chmod 777 ./Downloads/petalinux-v2021.2-final-installer.run
Run installer
~$ ./Downloads/petalinux-v2021.2-final-installer.run --dir /tools/Xilinx/PetaLinux/2021.2/
Note: when you press enter to view the agreement page in the terminal window, press q to escape and return to be able to select y and move forward with the installation.
Test by sourcing PetaLinux tools:
~$ source /tools/Xilinx/Petalinux/2021.2/settings.sh
And that's it!
I have also filmed this tutorial for my Ubuntu 18.04 VM installed on my internal drive for reference as well:
You can find other various tutorials such as this on my YouTube channel if you prefer some tutorials in video form.
Comments