Creating a PetaLinux Image - 2024.2 English - UG1209

Zynq UltraScale+ MPSoC Embedded Design Tutorial (UG1209)

Document ID
UG1209
Release Date
2025-03-20
Version
2024.2 English
  1. Create a PetaLinux project using the following command:

    petalinux-create -t project -s <path to the xilinx-zcu102-v2024.2-final.bsp>
    

    Note

    xilinx-zcu102-v2024.2-final.bsp is the PetaLinux BSP for the ZCU102 Production Silicon Rev 1.0 Board.

    This creates a PetaLinux project directory, xilinx-zcu102-2024.2.

  2. Reconfigure the project with edt_zcu102_wrapper.xsa:

    • The created PetaLinux project uses the default hardware setup in the ZCU102 Linux BSP. In this example, you will reconfigure the PetaLinux project based on the Zynq UltraScale+ hardware platform that you configured using the Vivado® Design Suite in Zynq UltraScale+ MPSoC Processing System Configuration.

    Note

    There are petalinux flows for both XSA and SDT. BSPs built using the System Device Tree (SDT) flow are recommended for new designs. BSPs listed with ‘XSCT’ are for the legacy XSA flow for users who are upgrading existing projects and do not wish to change generation methods. In this tutorial we will follow the XSA flow.

    • Copy the hardware platform edt_zcu102_wrapper.xsa to the Linux host machine.

    • Reconfigure the project using the following command:

      cd xilinx-zcu102-2024.2
      petalinux-config --get-hw-description=<path containing edt_zcu102_wrapper.xsa>
      

    This command opens the PetaLinux Configuration window. You can review these settings. If required, make changes in the configuration. For this example, the default settings from the BSP are sufficient to generate the required boot images.

    If you would prefer to skip the configuration window and keep the default settings, run the following command:

    petalinux-config --get-hw-description=<path containing edt_zcu102_wrapper.xsa> --silentconfig
    

    Note

    The above command will not work with the petalinux SDT flow. For the SDT flow please point the ‘–get-hw-description’ to your SDT directory.

    cd xilinx-zcu102-2024.2
    petalinux-config --get-hw-description=<path to SDT directory>
    

    Generate the SDT with the SDT Generator Tool. The System Device Tree Generator (SDTGen) Tool is a package containing TCL scripts and Hardware HSI API’s to extract hardware information from the XSA file into a System Device Tree (SDT) format.

  3. Build the PetaLinux project:

    1. In the <PetaLinux-project> directory, for example, xilinx-zcu102-2024.2, build the Linux images using the following command:

      petalinux-build
      
    2. After the above statement executes successfully, verify the images and the timestamp in the images directory in the PetaLinux project folder using the following commands:

      cd images/linux
      ls -al
      
  4. Generate the boot image using the following command:

    petalinux-package --boot --fsbl zynqmp_fsbl.elf --u-boot
    

    This creates a BOOT.BIN image file in the <petalinux-project>/images/linux/ directory.

    The logs indicate that the above command includes PMU_FW and Trusted Firmware-A (TF-A) in BOOT.BIN. You can also add --pmufw <PMUFW_ELF> and --atf <ATF_ELF> in the above command if you would prefer to use custom firmware images. Refer to petalinux-package --boot --help for more details about the boot image package command.

    Note

    The option to add bitstream, --fpga, is missing from the above command intentionally because so far the hardware configuration is based only on a PS with no design in the PL. If a bitstream is present in the design, --fpga can be added in the petalinux-package command as shown below:

    petalinux-package --boot --fsbl zynqmp_fsbl.elf --fpga system.bit --pmufw pmufw.elf --atf bl31.elf --u-boot u-boot.elf