You are here : Home  > PIXELA Technical Expertise  > PetalinuxSetting up the Petalinux development environment

Running Petalinux
Setting up the Petalinux development environment

Release date: Feb 22, 2023

First, we aim to get Petalinux running on Digilent's ZYBO Z7-20 development board, and this article will introduce the procedure for installing the Petalinux tools, which are Petalinux development tools, on Ubuntu.

The following operations are basically assumed to be performed on Ubuntu20.04.

Download the Petalinux tools installer

Download the PetaLinux 2022.1 installer from the Xilinx website.

License free, but account registration is required to download.

Download Page

Install the various packages required to install the Petalinux tools

When installing the Petalinux tools, you will know which packages need to be installed, but it is recommended that you install the necessary packages beforehand, as it takes some time to extract the archive and check package dependencies.

The following is an example of a required package.

// Required to install zlib1g:i386
$ sudo dpkg --add-architecture i386
  
// Installation of various packages (example)
$ sudo apt install gawk build-essential net-tools xterm autoconf libtool libtinfo5 texinfo zlib1g-dev gcc-multilib libncurses5-dev libncursesw5-dev zlib1g:i386

Change from dash to bash

Petalinux tools expect /bin/sh to be bash, so dash must be changed to bash.

// Check if /bin/sh is dash or bash
$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Sep 11  2020 /bin/sh -> dash
  
// dash, execute the following command and select "no" in the dialog that appears
$ sudo dpkg-reconfigure dash

// Make sure /bin/sh is bash
$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Oct 13  2022 /bin/sh -> bash

Install the Petalinux tools

Install the Petalinux tools at the desired location.

// Grant execute permission if you don't have them.
$ chmod +x ./petalinux-v2022.1-04191534-installer.run

// install (--dir xxx specifies the directory to install in)
$ ./petalinux-v2022.1-04191534-installer.run --dir ~/Petalinux
INFO: Checking installation environment requirements...
INFO: Checking free disk space
INFO: Checking installed tools
INFO: Checking installed development libraries
INFO: Checking network and other services
WARNING: No tftp server found - please refer to "UG1144  PetaLinux Tools Documentation Reference Guide" for its impact and solution
INFO: Checking installer checksum...
INFO: Extracting PetaLinux installer...

LICENSE AGREEMENTS

PetaLinux SDK contains software from a number of sources.  Please review
the following licenses and indicate your acceptance of each to continue.

You do not have to accept the licenses, however if you do not then you may
not use PetaLinux SDK.

Use PgUp/PgDn to navigate the license viewer, and press 'q' to close

Press Enter to display the license agreements
Do you accept Xilinx End User License Agreement? [y/N] > y
Do you accept Third Party End User License Agreement? [y/N] > y
INFO: Installing PetaLinux...
INFO: Checking PetaLinux installer integrity...
INFO: Installing PetaLinux SDK to "/home/username/Petalinux/."
INFO: Installing buildtools in /home/username/Petalinux/./components/yocto/buildtools
INFO: Installing buildtools-extended in /home/username/Petalinux/./components/yocto/buildtools_extended
INFO: PetaLinux SDK has been installed to /home/username/Petalinux/.

Tips

Installation cannot be done as root

Install as a local user. If you try to install as root, it will fail, but a log file will be generated with root privileges. In this case, delete the log file, as this will harm the installation as a local user.

// Install as root → Failed
$ sudo ./petalinux-v2022.1-04191534-installer.run --dir ~/Petalinux
ERROR: Exiting Installer: Cannot install as root user !
 
// Log file is generated with root privileges
$ ls -l petalinux_installation_log 
-rw-r--r-- 1 root root 4 Oct 13  2022 petalinux_installation_log
 
// Installation fails as local user if log file is left unattended
$ ./petalinux-v2022.1-04191534-installer.run --dir ~/Petalinux
./petalinux-v2022.1-04191534-installer.run: line 91: /home/username/petalinux_installation_log: Permission denied
 
// Delete log file generated with root privileges
$ sudo rm petalinux_installation_log

For the following warning

WARNING: No tftp server found - please refer to "UG1144  PetaLinux Tools Documentation Reference Guide" for its impact and solution

The lack of a TFTP server prevents the use of the built Petalinux Image over a LAN.

This article deals with the use via SD card, so you can ignore this warning. For more information on how to use a TFTP server, please click here.

Immediately after installation starts, you will be asked to accept the license (twice).

If all is well, enter 'y' and proceed.

After agreeing to the license, if the directory you specified as the installation directory is not empty, you will be asked the following

If all is well, enter 'y' and proceed.

INFO: Installing PetaLinux...
*********************************************
WARNING: PetaLinux installation directory: /home/username/Petalinux/. is not empty!
*********************************************
Please input "y" to continue to install PetaLinux in that directory?[n]

Set the path

Finally, the following command will set the path and make the Petalinux tool available.

$ source ~/Petalinux/settings.sh
PetaLinux environment set to '/home/username/Petalinux'
INFO: Checking free disk space
INFO: Checking installed tools
INFO: Checking installed development libraries
INFO: Checking network and other services
WARNING: No tftp server found - please refer to "UG1144 2022.1 PetaLinux Tools Documentation Reference Guide" for its impact and solution

* The same warning will appear as when installing the software, but please ignore it as well.

To avoid running the command every time Ubuntu is booted, it is recommended to append the same contents to the .bashrc.

// Open .bashrc
$ vi ~/.bashrc

// Add the following to the end of the .bashrc
source ~/Petalinux/settings.sh

This completes the setup of the Petalinux development environment.

* All names, company names, product names, etc. mentioned herein are trademarks or registered trademarks of their respective companies.

PIXELA Technical Expertise

Systematically organized information for our company to learn technology. We are publishing this information in the hope that it will be of help to many engineers.

Petalinux Article List