Menu Close

Configuring and Setting up PetaLinux for Development

This article talks about how to set up PetaLinux to be able to successfully go on to develop apps and drivers for the development board.

For related subjects, please refer to the SOC Table of Contents.


*In order to follow along to this tutorial, you will be required to have Ubuntu 16.04.01 already installed on your Virtual Machine using Oracle’s VirtualBox. Because this tutorial is geared towards Ubuntu 16.04.01, using other versions may have differences between the execution of commands.

You will also need to have PetaLinux as well as TFTP already installed. In this tutorial, PetaLinux is installed in /home/ubuntu/PetaLinux. Make sure you change your path and directory in the commands accordingly.

First, we will need to configure the .bashrc file for PetaLinux. We can do this by executing the following command to append a pathway shortcut.

echo “alias sptl=‘source /home/ubuntu/PetaLinux/’”

We can then verify that this is the case by executing the following command:

gedit .bashrc

You should see the following at the end of the file that shows up. If it isn’t there, please write it in.

After confirming that it is there, we can go ahead and close the file. Restart the system for the changes to be applied.

We will now execute the sptl command from the Terminal, like so:

Next, we will proceed to create a new workspace for the project. We can do this by using the following command. We will call our project testproject.

petalinux-create -t project --template zynq -n testproject

We will copy the existing FPGA project file to a folder called work in our home directory and delete the compressed file after extraction. We can verify that the file is there by executing the following command:

ls work

Next, we will navigate to the project directory by using the cd command on the project directory we just specified.

cd testproject

We will then open the FPGA file by using the following command, you may need to change the name of you FPGA file, as mine is FII_7030.sdk.

petalinux-config --get-hw-description ~/work/FII_7030.sdk/

The system configuration page would then be displayed after loading.

Because we will be booting from an SD card, please go to Image Packaging Configuration and Root filesystem type, and change it to SD Card. Exit by pressing [esc] twice or selecting the on-screen <Exit> prompt. When asked if you wish to save changes, please select Yes. You will be returned to the Terminal, where the project will be setup. This will take time.

Next, we will go on to configure the kernel. We will execute the following commands:

petalinux-config -c kernel

When the ARM configuration page comes up, you may choose to make corresponding changes. We will select <Exit>.

Next, we will execute the following command for Rootfs configuration:

petalinux-config -c rootfs

We will select <Exit>

We will execute the following command to build the system:


Note that this may take a while.

Finally, we will use the following command to create the boot file.

petalinux-package --boot --fsbl --fpga --u-boot --force 


Posted in Textbook and Training Project

Related Articles

Leave a Reply

Your email address will not be published.

Leave the field below empty!