Installation of Petalinux and running the first Petalinux based linux system on QEMU

Summary: This short tutorial, first, defines the petalinux, board support packages (BSP) and quick emulator (QEMU) used in zynq 7000 linux programming. It, secondly, describes the steps necessary to install petalinux on Ubuntu PC. Finally, an example on how to run and test the petalinux based linux system in QEMU is demonstrated.

1.  Definitions of Petalinux, BSP and QEMU: Petalinux, which is based on the yocto project, is a  Xilinx development toolchain which provides us everything necessary to build, test, customize and deploy an embedded linux system. Furthermore, it is an embedded linux distro maintained by Xilinx and targets Xilinx System on Chip (SoC) designs. It also has an integrated full system quick emulator (QEMU).  Developers can test and verify the customized linux solution on QEMU before deploying it on the actual hardware. Additionally, Xilnix also provides Board Support packages (BSP) for various Xilinx evaluation boards. A BSP describes the various hardware features supported by the corresponding evaluation board. Petalinux uses these BSPs to configure the kernel as per specification defined in them.  

2. Installation of Petalinux: The steps used to install the petalinux on Ubuntu 18.04.4 LTS are summarized as follow:

  • Download the petalinux version of your choice from the link (click here for the link). For example, I am using petalinux v2017.4.
  • Change the access permission of the download files by executing the following command. sudo chmod +x <download path>/petalinux-v2017.4-final-installer.run
  • Petalinux tool requires a number of standard development tools and libraries. For your convenience, I have listed all these dependencies here. sudo apt install tofrodo,  iproute, gawk, gcc, git-core, make, net-tools, ncurses-dev, libncurses5-dev, zlib1g-dev, flex, bison, lib32z1, lib32ncurses5, lib32bz2-1.0, ia32gcc1, lib32stdc++6, libselinux1,  libssl-dev,  libssl1.0-dev.
  •  Change the access permission of the location where you want to install the petalinux with this command. sudo chmod 755 <installing location for petalinux>
  • Run sudo chmod 755 /tmp command to change the access permission of tmp folder.
  • Install the petalinux with the command. <download path>/petalinux-v2017.4-final-installer.run <installing location for petalinux>
  • Run the command source <installing location for petalinux>/settings.sh
  • If you get the WARNING: /bin/sh is not bash! After running this command, please run the following subset of commands.
    • chsh -s /bin/bash.
    • Log out and then run these commands.
    • sudo rm /bin/sh.
    • sudo ln -s /bin/bash /bin/sh.
  • Lastly, upon running echo $PETALINUX command, it will give you the installed path of the petalinux.3. Running the first Petalinux based linux system on Qemu: In this tutorial, Zedboard is chosen as a Xilinx evaluation board. The steps involved in testing first petalinux based linux system on QEMU are listed below:
  • Download the corresponding BSP for Zedboard from Xilinx official website (click here for the link).
  • create a basic project template by using petalinux-create command.  petalinux-create -t project -s <location of BSP>/Avnet-Digilent-ZedBoard-v2016.2-final.bsp
  • The project can be customized by using The petalinux-config command. For our special case, we don’t need to do any customization. Run petalinux-config and select exit.
  • Builds either the entire embedded Linux system or a specified component of the Linux system by using petalinux-build command. for our example, please run petalinux-build.

After petalinux-build command, the linux solution is ready to deploy into hardware. We however first run the solution on QEMU to verify the functionality of the newly built linux system. petalinux-boot –qemu command is used to run the linux system on QEMU. after running the petalinux-boot –qemu –kernel, you need to login with following credential: username: root, password: root. The video given below explains all the steps needed to install and run first Petalinux based linux solution on QEMU.

One thought on “Installation of Petalinux and running the first Petalinux based linux system on QEMU

  1. Pingback: FPGA work

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s