Creating the Software Component

A Vitis platform requires software components. For baremetal/standalone applications, the Vitis platform project flow generates the necessary boot components, such as the FSBL and PMU firmware, along with their board support packages (BSPs). For Linux, the PetaLinux tools are invoked outside of the Vitis tools by the developer to create the necessary Linux image,Executable and Linkable Format (ELF) files, and sysroot with XRT support. Yocto or third-party Linux development tools can also be used as long as they produce the same Linux output products as PetaLinux. Software components requirements are listed in Software Component Requirements.

Using PetaLinux for Generating Linux Output Products

For Linux projects, you can create a PetaLinux project, add support for the hardware defined in the XSA, and configure the project to include the software packages needed for the XRT. Follow the steps listed below to generate the Linux software objects and Linux image for the platform. For more information about the PetaLinux tools, refer to PetaLinux Tools Documentation: Reference Guide (UG1144).

To generate the Linux software objects and Linux image:

  1. Change to the working directory and create a sub-directory to hold the Vitis platform creation workspace and a boot directory to hold the outputs from running the PetaLinux tools.
    cd zcu102_min_pkg
    mkdir pfm; cd pfm
    mkdir wksp1
    mkdir boot
    cd ..
  2. Set up paths to the PetaLinux tools.
    source <PetaLinux_Tool_Install_Directory>/
  3. Create a PetaLinux project named petalinux in the zcu102_pkg directory.

    The project name is user-defined, but for this example, adopt the naming convention used here. A PetaLinux project can be based on a board support package (BSP) or a template. If a BSP is available and provides the necessary features, it can be used as the starting point. In this example, we begin with the Zynq® UltraScale+™ MPSoC template.

    petalinux-create -t project --template zynqMP -n petalinux
  4. Add the hardware customization into the PetaLinux project by providing a path to the directory containing the XSA.
    cd petalinux
    petalinux-config --get-hw-description=../vivado
  5. In the PetaLinux menu, set CONFIG_SUBSYSTEM_MACHINE_NAME to zcu102-rev1.0 if desired. The PetaLinux tools know about certain Xilinx boards as listed in PetaLinux Tools Documentation: Reference Guide (UG1144).
    Note: You can type petalinux-config to bring up a GUI interface where the arrow keys and the Tab key are used to navigate the menus and selection choices.

    To change the machine name:

    1. Select DTG Settings > (template) MACHINE_NAME and change the template to zcu102-rev1.0.
    2. Exit and save when prompted.
  6. Add user packages for XRT support by appending the CONFIG_x lines below to the PetaLinux/project-spec/meta-user/conf/user-rootfsconfig file. This step can be skipped if an XSA was created for the Vitis embedded software only flow and does not use the XRT and acceleration kernels.
    • CONFIG_xrt
    • CONFIG_xrt-dev
    • CONFIG_zocl
    • CONFIG_opencl-clhpp-dev
    • CONFIG_opencl-headers-dev
    • CONFIG_packagegroup-petalinux-opencv
  7. Update the Device tree to include the zocl driver by appending the text below to the petalinux/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi file.
    TIP: This step can be skipped if an XSA was created for the Vitis embedded software development flow and does not use the XRT and acceleration kernels.
    &amba {
     	zyxclmm_drm {
     		compatible = “xlnx,zocl”;
     		status = “okay”;
  8. Enable all the user packages that were added earlier. This step can be skipped if an XSA was created for the Vitis embedded software only flow and does not use the XRT and acceleration kernels.

    To enable the user packages:

    1. Type petalinux-config -c rootfs.
    2. Select user packages.
    3. Type "y" to enable the user packages for xrt, xrt-dev, zocl, opencl-hpp-dev, opencl-headers-dev, and packagegroup-petalinux-opencv.
    4. Save and exit when prompted.
  9. Increase the size allocation for CMA memory to 1024 MB (optional), as follows:
    1. Type petalinux-config -c kernel
    2. Select Device Drivers > Generic Driver Options > DMA Contiguous Memory Allocator > Size in Mega Bytes.
    3. Press the Enter key and change 256 to 1024.
    4. Save and exit when prompted.
  10. From within the PetaLinux project (petalinux), start the Linux build:
  11. Create a sysroot self-installer for the target Linux system;
    cd images/linux
    petalinux-build --sdk
  12. Use the self-installer to output and install the sysroot. Place the generated sysroot files into the pfm working directory that was created earlier by providing a full pathname to the output directory when prompted:
    1. Type ./
    2. Provide a full pathname to the output directory (<Full_Pathname_to_zcu102_min_pkg>/pfm) and confirm.
  13. After the PetaLinux build succeeds, the generated Linux software components are in the <PetaLinux_Project>/images/linux directory. For our example, the petalinux/images/linux directory contains the generated image and ELF files listed below. Copy these files to the zcu102_min_pkg/pfm/boot directory in preparation for running the Vitis platform creation flow:
    • image.ub
    • zynqmp_fsbl.elf
    • pmufw.elf
    • bl31.elf
    • u-boot.elf
  14. Add a BIF file (linux.bif) to the boot directory with the contents shown below. The file names should match the contents of the boot directory. The Vitis tool expands these pathnames relative to the sw directory of the platform at v++ link time or when generating an SD card. However, if the bootgen command is used directly to create a BOOT.BIN file from a BIF file, full pathnames in the BIF are necessary. Bootgen does not expand the names between the <> symbols.
    /* linux */
     	[fsbl_config] a53_x64
     	[bootloader] <zynqmp_fsbl.elf>
     	[pmufw_image] <pmufw.elf>
     	[destination_device=pl] <bitstream>
     	[destination_cpu=a53-0, exception_level=el-3, trustzone] <bl31.elf>
     	[destination_cpu=a53-0, exception_level=el-2] <u-boot.elf>