Create a PetaLinux project using the following command:
There are two ways to generate a petalinux project. Either using the BSP for a development board such as the ZC702, or if users have a custom board, users can use the template.
# Using the BSP petalinux-create -t project -s <path to the xilinx-zc702-v2023.2-final.bsp> # Using the template for custom boards petalinux-create -t project --template zynq -n xilinx-zc702-2023.2
Note
xilinx-zc702-v2023.2-final.bsp is the PetaLinux BSP for the ZC702 Production Silicon Rev 1.0 board.
This creates a PetaLinux project directory, xilinx-zc702-2023.2.
Reconfigure the project with system_wrapper.xsa:
The created PetaLinux project uses the default hardware setup in the ZC702 Linux BSP. In this example, you will reconfigure the PetaLinux project based on the Zynq design that you configured using the Vivado™ Design Suite in Example 1: Creating a New Embedded Project with Zynq SoC.
Copy the hardware platform
system_wrapper.xsa
to the Linux host machine.Reconfigure the project using the following command:
cd xilinx-zc702-2023.2 petalinux-config --get-hw-description=<path that contains system_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. Select Exit and press Enter to exit the configuration window.
If you would prefer to skip the configuration window and keep the default settings, run the following command instead:
petalinux-config --get-hw-description=<path containing system_wrapper.xsa> --silentconfig
Build the PetaLinux project:
In the
<PetaLinux-project>
directory (for example,xilinx-zc702-2023.2
), build the Linux images using the following command:petalinux-build
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
boot.scr
is the script that U-Boot reads during boot time to load the kernel and rootfs.image.ub
contains kernel image, device tree, and rootfs.
Generate the boot image using the following command:
petalinux-package --boot --fsbl zynq_fsbl.elf --u-boot
This creates a
BOOT.BIN
image file in the<petalinux-project>/images/linux/
directory.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 thepetalinux-package
command as shown below:petalinux-package --boot --fsbl zynq_fsbl.elf --fpga system.bit --u-boot u-boot.elf
Refer to
petalinux-package --boot --help
for more details about the boot image package command.Generate the sysroot required for generating a linux application using the following command:
petalinux-build --sdk petalinux-package --sysroot