MPSoC Petalinux Software Development

MPSoC Petalinux Software Development

The purpose of this page is to describe how to use PetaLinux to build Linux system and boot on the ZynqMPSoC platform.

SOFTWARE TOOLS AND SYSTEM REQUIREMENTS

  • Linux host RHEL 6 64bit
  • Set up BASH as default shell
  • Install 32bit libs on the Linux host
  • Install the libs/tools documented in the "PetaLinux Tools Installation Requirements" section in "Reference Guide" of PetaLinux tools 2014.4.
  • Download petalinux-v2015.2_ZUB2-dev-installer.run installer

Install PetaLinux Tools and Reference BSP


Download the PetaLinux installer and Install PetaLinux Tools by running the installer
$./petalinux-v2015.3-dev-installer.run

Source PetaLinux tools settings
$ source petalinux-v2015.3-dev/settings.sh
Turn off webtalk since it is not working for ZynqMPSoC early access
$ petalinux-util --webtalk off
Install the PetaLinux reference BSP
To extract the reference design project within the BSP to your working directory.
$ petalinux-create -t project -s Xilinx-ZynqMP-QEMU-2015.3.bsp
If you want to rename the extracted reference design project, you can run
$ petalinux-create -t project -s Xilinx-ZynqMP-QEMU-2015.3.bsp -n <MYPROJ>

Go inside the PetaLinux project directory
$ cd Xilinx-ZynqMP-QEMU-2015.3

Boot prebuilt Linux image with QEMU
$ petalinux-boot --qemu --prebuilt 3

To Rebuild the Whole PetaLinux Project
$ petalinux-build
Rebuild Specific Component Only
To build only kernel
$ petalinux-build -c kernel

To build other components
$ petalinux-build -c device-tree
$ petalinux-build -c bootloader
$ petalinux-build -c arm-trusted-firmware
$ petalinux-build -c u-boot
$ petalinux-build -c rootfs
To regenerate the image.ub, Image and rootfs.cpio.gz
$ petalinux-build -x package
If you want to cleanup the built component before rebuilding
$ petalinux-build -c device-tree -x mrproper
To generate BOOT.BIN with fsbl and u-boot
$ petalinux-package --boot --u-boot

To generate BOOT.BIN with fsbl
$ petalinux-package --boot

Reconfigure Linux Components

To reconfigure kernel
$ petalinux-config -c kernel
It will show you the kernel configuration menu

To reconfigure rootfs
$ petalinux-config -c rootfs
It will show you the rootfs configuration menu
To add linux application
First create the application
$ petalinux-create -t apps -n myapp --enable
The above command will create a Linux application "myapp" in "components/apps/myapp" from "C" template, and it will be enabled to the rootfs.
If you want to create different type of Linux application, such as C++, autoconf, install-only binary, you can run "petalinux-create -t apps --help", it will shows you all the available options.
hello is the application

Rebuild PetaLinux project for the Linux application
You can rebuild the whole project,rootfs or just the application
$ petalinux-build
$ petalinux-build -c rootfs
$ petalinux-build -c rootfs/myapp
hello is myapp

To add Linux user libraries to your rootfs.
$ petalinux-create -t libs -n mylib --enable
The above command will create a Linux user library "mylib" in "components/libs/mylib"
hello_lib is the mylib

Again rebuild the whole project,rootfs or just the library
$ petalinux-build -c rootfs/mylib

PetaLinux uses library priorities to decide the compilation sequence of the user libraries.
To specify the priority of you library
$ petalinux-create -t libs -n mylib --enable --priority X
X is the priority of your library."1" has the highest priority which will be built first.
Please find the available priorities from with the "--help" of "petalinux-create -t libs".

Test Your Rebuilt Images on QEMU
Boot u-boot on QEMU
$ petalinux-boot --qemu --u-boot

Boot kernel with QEMU
$ petalinux-boot --qemu --kernel

Related Links

  • Title 1 & Link 1
  • Title 1 & Link 1