User Tools

Site Tools


xilinx_running_petalinux

Overview

This page steps through building for a ZCU102 using an .hdf file downloaded from GitHub, and PetaLinux 2019.1.

Format of the ZCU102 HDF file

-rw-r--r--. 1 rpjday rpjday    46772 May  5 15:09 design_1_bd.tcl
-rw-r--r--. 1 rpjday rpjday   124564 May  5 15:09 design_1.hwh
-rw-r--r--. 1 rpjday rpjday 26510901 May  5 15:09 design_1_wrapper.bit
-rw-r--r--. 1 rpjday rpjday   922239 May  5 15:09 psu_init.c
-rw-r--r--. 1 rpjday rpjday   921403 May  5 15:09 psu_init_gpl.c
-rw-r--r--. 1 rpjday rpjday  1660902 May  5 15:09 psu_init_gpl.h
-rw-r--r--. 1 rpjday rpjday  1661516 May  5 15:09 psu_init.h
-rw-r--r--. 1 rpjday rpjday    52815 May  5 15:09 psu_init.html
-rw-r--r--. 1 rpjday rpjday   881371 May  5 15:09 psu_init.tcl
-rw-r--r--. 1 rpjday rpjday     1007 May  5 15:09 sysdef.xml

system.xml:

<?xml version="1.0"?>
<Project Version="1" Minor="3" DIGEST="">
        <TOOL_VERSION Version="2019.1"/>
        <MODE Name="Post-Synthesis"/>
        <SYSTEMINFO BOARD="xilinx.com:zcu102:3.3" PART="xczu9eg-ffvb1156-2-e" ARCH="zynquplus" PACKAGE="ffvb1156" DEVICE="xczu9eg" SPEED="-2" LUT="274080" FF="548160" BRAM="912" DSP="2520"/>
        <HIERARCHY Name="design_1_wrapper"/>
        <File Type="HW_HANDOFF" Name="design_1.hwh" DESIGN_HIERARCHY="design_1_i" BD_TYPE="DEFAULT_BD"/>
        <File Type="BD_TCL" Name="design_1_bd.tcl"/>
        <File Type="PS_FSBL_INIT" Name="psu_init.c"/>
        <File Type="PS_FSBL_INIT" Name="psu_init.h"/>
        <File Type="PS_FSBL_INIT_GPL" Name="psu_init_gpl.c"/>
        <File Type="PS_FSBL_INIT_GPL" Name="psu_init_gpl.h"/>
        <File Type="PS_INIT_HELP" Name="psu_init.html"/>
        <File Type="PS_XMD_INIT" Name="psu_init.tcl"/>
        <File Type="BIT" Name="design_1_wrapper.bit"/>
        <BOARD Type="NotIntegrated">
                <BASEBOARD Name="xilinx.com:zcu102:3.3">
                </BASEBOARD>
        </BOARD>
        <USEDRESOURCES LUT="300" FF="1" BRAM="0" DSP="0"/>
</Project>

PetaLinux build procedure

Preparing for the build

First, source the appropriate environment file for PetaLinux 2019.1; something like:

$ source .../2019.1/settings.sh
$ echo $PETALINUX
/home/rpjday/xilinx/2019.1
$

followed by creating a new (for this discussion, zynqMP-based) PetaLinux project and moving to that new project directory:

$ petalinux-create \
  --type project \
  --name zcu102 \
  --template zynqMP
$ cd zcu102

End result:

$ tree -d
.
└── project-spec
    ├── configs
    ├── hw-description
    └── meta-user
        ├── conf
        ├── recipes-apps
        │   ├── gpio-demo
        │   │   └── files
        │   └── peekpoke
        │       └── files
        ├── recipes-bsp
        │   ├── device-tree
        │   │   └── files
        │   │       └── multi-arch
        │   └── u-boot
        │       └── files
        └── recipes-core
            └── images

Incorporating the HDF file

Configure the new project by running petalinux-config and incorporating the aforementioned .hdf file by referring to its directory location:

$ petalinux-config --get-hw-description <dirname of ZCU102 HDF File>

at which time you will be placed in the PetaLinux “System Configuration” utility; if you have nothing to change, simply exit and save your configuration.

Major result is new content under project-spec/meta-plnx-generated.

Configuration options

$ petalinux-config
$ petalinux-config -c bootloader   [virtual/fsbl]
$ petalinux-config -c u-boot       [virtual/bootloader]
$ petalinux-config -c kernel
$ petalinux-config -c rootfs
$ petalinux-config -c busybox
$ petalinux-config -c pmufw
$ petalinux-config -c device-tree

The build process

Now that all of the project configuration is complete, kick off the PetaLinux build with:

$ petalinux-build

A successful build should generate numerous build artifacts under the project's images/linux/ directory, depending on how the project was configured:

$ ls images/linux/
bl31.bin     rootfs.cpio.bz2        rootfs.its            system.dtb
bl31.elf     rootfs.cpio.gz         rootfs.jffs2          System.map.linux
Image        rootfs.cpio.gz.u-boot  rootfs.manifest       u-boot.bin
image.ub     rootfs.ext3            rootfs.tar.bz2        u-boot.elf
pmufw.elf    rootfs.ext3.bz2        rootfs.tar.gz         vmlinux
rootfs.bin   rootfs.ext4            rootfs.testdata.json  zynqmp_fsbl.elf
rootfs.cpio  rootfs.ext4.gz         system.bit
$

The packaging step

The final step in the PetaLinux build is to “package” the appropriate generated artifacts to copy to a bootable SD card to boot the target system (in this case, a Fidus Sidewinder). The simplest SD card image will contain two files:

  • BOOT.BIN
  • image.ub

The FIT image file image.ub should already have been generated; to complete the process, build the BOOT.BIN file with:

$ petalinux-package \
  --boot \
  --force \
  --format BIN \
  --fsbl images/linux/zynqmp_fsbl.elf \
  --fpga images/linux/system.bit \
  --u-boot
$

whereupon you can see the target boot file BOOT.BIN being constructed, generating output something like:

INFO: File in BOOT BIN: ".../myproj/images/linux/zynqmp_fsbl.elf"
INFO: File in BOOT BIN: ".../myproj/images/linux/pmufw.elf"
INFO: File in BOOT BIN: ".../myproj/images/linux/system.bit"
INFO: File in BOOT BIN: ".../myproj/images/linux/bl31.elf"
INFO: File in BOOT BIN: ".../myproj/images/linux/u-boot.elf"
INFO: Generating ZynqMP binary package BOOT.BIN...

You can optionally create a .bsp file for import into a future PetaLinux project with:

$ petalinux-package \
  --bsp \
  --project . \
  --output myproj.bsp
xilinx_running_petalinux.txt · Last modified: 2019/10/20 12:01 by rpjday