How to Install PetaLinux 2019.1

Clean install on a virtual machine

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

  1. Get VirtualBox from here, then install and launch it.
  2. 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)
Don’t see 64-bit? You can’t use PetaLinux tools without it. If VirtualBox doesn’t give you the option for a 64-bit Ubuntu, you may need to enable Hardware Virtualization in your BIOS.

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.

  1. Download Ubuntu 18.04.4 install ISO here
  2. Once the download completes, open up an explorer window at the ISO file location and then double click the .iso file. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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

  1. 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

  1. 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 ~/Downloads directory and the following commands will assume that it is there.
  2. In the terminal, make the installer executable:
chmod +x ~/Downloads/petalinux-v2019.1-final-installer.run
  1. 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”.

  1. 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 q to close the agreement, then press y to 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.

  1. In the terminal, run this command: chsh -s /bin/bash.
  2. Reboot the VM.
  3. Open a terminal and run these commands to make /bin/sh link to /bin/bash:
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.

  1. Open Firefox on the VM and download Vivado Installer 2019.1 (All OS installer Single-File Download) from the Xilinx website here.
  2. The Xilinx_Vivado_SDK_2019.1_0524_1430.tar.gz file will end up in your ~/Downloads directory. 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
  1. 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.

All done!

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: source ~/petalinux/2019.1/settings.sh.

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