This is my guide for installing PetaLinux 2019.1 from scratch on a virtual machine. The VM will run Ubuntu 18.04.4 64-bit and the host workstation is an Intel Xeon with 64GB RAM and 3TB HDD running Windows 10 64-bit. The PetaLinux user guide says that the latest supported version of Ubuntu is 18.04.1 however in my experience it works just fine in the more recent 18.04.4 version.
Step 1: Create the Virtual Machine
- Get VirtualBox from here, then install and launch it.
- Create a new virtual machine and use the following options:
- Ubuntu 64-bit
- 16 GB RAM (8GB minimum according to user guide)
- VirtualBox Disk Image
- Dynamic hard disk (resizable)
- 200 GB size (the resulting VM will have about 113GB free after all of these installs so you can reduce this if you like)
Step 2: Install Ubuntu 18.04.4 LTS onto the VM
We need to have the Ubuntu installation boot disk (or the ISO) so that the VM can be booted from it on the first time it is powered up.
- Download Ubuntu 18.04.4 install ISO here
- Once the download completes, open up an explorer window at the ISO file location and then double
.isofile. Windows should automatically mount that ISO file to it’s own drive letter, in my case
F:. You will be able to refer to this drive letter to install Ubuntu on the VM.
- Back in VirtualBox, click on the VM we created earlier and click “Start”. You will be asked to select the drive letter of your Ubuntu installation disk. Select either your DVD drive letter, or the ISO file’s drive letter.
- Ubuntu installer will run. Choose the option to “Install Ubuntu” using the “Normal installation” and DON’T “Download updates while installing Ubuntu”. We choose not to apply the updates just so that we end up with version 18.04.4.
- After installation, you will be asked to reboot. It will first ask you to remove the boot disk. To do this, open Windows Explorer, find the drive for the mounted ISO file, then right click on it and select “Eject”. The ISO will be unmounted and you will be able to continue the Ubuntu boot.
- When Ubuntu has booted and you are logged in, it may tell you that there is a newer version available. Be sure to refuse the update.
Step 3: Install PetaLinux dependencies
- Open a terminal and then run the following command to install all of the PetaLinux 2019.1 dependencies:
sudo apt-get -y install tofrodos \ iproute2 \ gawk \ make \ net-tools \ libncurses5-dev \ tftpd \ zlib1g:i386 \ libssl-dev \ flex \ bison \ libselinux1 \ gnupg \ wget \ diffstat \ chrpath \ socat \ xterm \ autoconf \ libtool \ tar \ unzip \ texinfo \ zlib1g-dev \ gcc-multilib \ build-essential \ screen \ pax \ gzip
Step 4: Install PetaLinux
- From the VM, open up Firefox browser and download the PetaLinux 2019.1 Installer
from the Xilinx website here. By default, the installer should end up in the
~/Downloadsdirectory and the following commands will assume that it is there.
- In the terminal, make the installer executable:
chmod +x ~/Downloads/petalinux-v2019.1-final-installer.run
- Create a directory for the PetaLinux installation and then run the installer:
mkdir -p ~/petalinux/2019.1 ~/Downloads/petalinux-v2019.1-final-installer.run ~/petalinux/2019.1
Note that I’m installing PetaLinux into the “home” directory. This is because the User Guide specifies that “PetaLinux tools need to be installed as a non-root user”.
- The first thing that the PetaLinux installer will do is ask you to read and accept
the license agreements (Xilinx End User License Agreement,
Webtalk Terms and Conditions, Third Party End User License Agreement).
For each agreement, use PgUp/PgDn to read through the agreement, then press
qto close the agreement, then press
yto accept the agreement.
Step 5: Change /bin/sh to bash
PetaLinux tools require that your host system
/bin/sh be bash, which in Ubuntu it is dash.
- In the terminal, run this command:
chsh -s /bin/bash.
- Reboot the VM.
- Open a terminal and run these commands to make
sudo rm /bin/sh sudo ln -s /bin/bash /bin/sh
Step 6: Install Vivado and SDK (optional)
If you also want Vivado and SDK on the VM, you can follow these instructions. For PetaLinux 2019.1, I recommend you use Vivado 2019.1 because you can run into weird issues by mixing and matching the tool versions.
- Open Firefox on the VM and download Vivado Installer 2019.1 (All OS installer Single-File Download) from the Xilinx website here.
Xilinx_Vivado_SDK_2019.1_0524_1430.tar.gzfile will end up in your
~/Downloadsdirectory. Extract the installer and then run it.
tar xvzf ~/Downloads/Xilinx_Vivado_SDK_2019.1_0524_1430.tar.gz -C ~/Downloads/. cd ~/Downloads/Xilinx_Vivado_SDK_2019.1_0524_1430/ ./xsetup
- During the installation, you will be told that there are newer versions available. Make sure that you refuse these upgrades unless you actually want those versions.
Now you have a virtual machine with a clean PetaLinux 2019.1 install. You can setup the PetaLinux
tools for use in a terminal with this command:
You can now free up some space by deleting the installers:
rm ~/Downloads/Xilinx_Vivado_SDK_2019.1_0524_1430.tar.gz rm -r ~/Downloads/Xilinx_Vivado_SDK_2019.1_0524_1430/ rm ~/Downloads/petalinux-v2019.1-final-installer.run