Build Petalinux for ZCU216 - asiaa/BURSTT GitHub Wiki

  1. Take the paid virtual class from Xilinx: "Embedded Design with PetaLinux Tools" or PetaLinux Tools Documentation

  2. Download the up-to-date BSP package from ZCU216 website. ZCU216 BSP

  3. Unzip that package and read "README" file, follow the procedure of Petalinux create, configuration and etc.

  4. My exercise is:


homin@homin-5820:~/petalinux/tools/common/petalinux/bin$  petalinux-create -t project --template zynqMP --force -n zcu216_v2022_1

INFO: Create project: zcu216_v2022_1

INFO: New project successfully created in /home/homin/petalinux/tools/common/petalinux/bin/zcu216_v2022_1


homin@homin-5820:~/petalinux/tools/common/petalinux/bin/zcu216_v2022_1$ petalinux-config --get-hw-description=/home/homin/petalinux/tools/common/petalinux/bin/xilinx-zcu216-2022_1_bsp/components/plnx_workspace/device-tree/device-tree/hardware_description.xsa --silentconfig

homin@homin-5820:~/petalinux/tools/common/petalinux/bin/zcu216_v2022_1$ petalinux-config -c rootfs

  Enable openamp and its examples in rootfs
		Select following "Filesystem packages" -> "misc"  and save it
			openamp-fw-echo-testd
			openamp-fw-mat-muld
			openamp-fw-rpc-demo
		Select following "Petalinux  package Group"   and save it		
			packagegroup-petalinux-openamp

homin@homin-5820:~/petalinux/tools/common/petalinux/bin/zcu216_v2022_1$  cat >> project-spec/meta-user/conf/user-rootfsconfig << EOF

CONFIG_peekpoke

CONFIG_gpio-demo

CONFIG_rfdc

CONFIG_rfdc-read-write

CONFIG_rfdc-selftest

CONFIG_rfclk

EOF


homin@homin-5820:~/petalinux/tools/common/petalinux/bin/zcu216_v2022_1$ petalinux-config -c rootfs

[INFO] Sourcing buildtools

[INFO] Silentconfig project

[INFO] Generating kconfig for rootfs

[INFO] Menuconfig rootfs

[INFO] Generating plnxtool conf file


$ petalinux-config -c rootfs

      Select following packages and save it
      rfdc
      rfdc-read-write
      rfdc-selftest
  rfclk

 $ petalinux-config

     Enter xilinx-zcu216 for YOCTO_MACHINE_NAME option  ( ZCU216 DTG board parameter)

 homin@homin-5820:~/petalinux/tools/common/petalinux/bin/zcu216_v2022_1$ petalinux-build

[INFO] Sourcing buildtools

[INFO] Building project

[INFO] Silentconfig project

[INFO] Silentconfig rootfs

[INFO] Generating workspace directory

INFO: bitbake petalinux-image-minimal

NOTE: Started PRServer with DBfile: /home/homin/petalinux/tools/common/petalinux/bin/zcu216_v2022_1/build/cache/prserv.sqlite3, Address: 127.0.0.1:35843, PID: 2019

Loading cache: 100% |
| ETA: --:--:-- Loaded 0 entries from dependency cache. Parsing recipes:

... Summary: There were 22 WARNING messages.

INFO: Failed to copy built images to tftp dir: /tftpboot

[INFO] Successfully built project

... took 20 mins ...


homin@homin-5820:~/petalinux/tools/common/petalinux/bin/zcu216_v2022_1$ petalinux-package --boot --u-boot --force
...
[INFO]   : Bootimage generated successfully

homin@homin-5820:~/petalinux/tools/common/petalinux/bin/zcu216_v2022_1$  mkdir -p pre-built/linux/images

homin@homin-5820:~/petalinux/tools/common/petalinux/bin/zcu216_v2022_1$  cp -r images/linux/* pre-built/linux/images/

homin@homin-5820:~/petalinux/tools/common/petalinux/bin/zcu216_v2022_1$  petalinux-package --wic --extra-bootfiles "rootfs.cpio.gz.u-boot" --images-dir pre-built/linux/images --outdir pre-built/linux/images

...

The following build artifacts were used to create the image(s):
ROOTFS_DIR:                   /home/homin/petalinux/tools/common/petalinux/bin/zcu216_v2022_1/build/wic/rootfs
BOOTIMG_DIR:                  /home/homin/petalinux/tools/common/petalinux/bin/zcu216_v2022_1/pre-built/linux/images
KERNEL_DIR:                   /home/homin/petalinux/tools/common/petalinux/bin/zcu216_v2022_1/pre-built/linux/images
NATIVE_SYSROOT:               /home/homin/petalinux/tools/common/petalinux/bin/zcu216_v2022_1/build/tmp/work/cortexa72-cortexa53-xilinx-linux/wic-tools/1.0-r0/recipe-sysroot-native

homin@homin-5820:~/petalinux/tools/common/petalinux/bin/zcu216_v2022_1$ echo '/include/ "xen.dtsi"' >> project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi

homin@homin-5820:~/petalinux/tools/common/petalinux/bin/zcu216_v2022_1$ echo 'SRC_URI += "file://xen.dtsi"' >> project-spec/meta-user/recipes-bsp/device-tree/device-tree.bbappend

homin@homin-5820:~/petalinux/tools/common/petalinux/bin/zcu216_v2022_1$ petalinux-config

Select following config and save it. Image Packaging Configuration Root filesystem type (INITRD) INITRAMFS/INITRD Image name (petalinux-image-minimal)


homin@homin-5820:~/petalinux/tools/common/petalinux/bin/zcu216_v2022_1$ petalinux-config -c rootfs

Select following package and save it packagegroup-petalinux-xen


homin@homin-5820:~/petalinux/tools/common/petalinux/bin/zcu216_v2022_1$ cp -L images/linux/Image pre-built/linux/images/xen-Image


  1. There is something wrong if follows the README procedure.
  2. Create a sub-directory "xen" under pre-built/linux/
  3. Copy all the "xen*.*" files from ~/petalinux/tools/common/petalinux/bin/zcu216_v2022_1/images/linux/Image pre-built/linux/xen.
  4. Petalinux-build doesn't create the subdirectory "xen" under ~/image/linux.

$cp -L <project root>/images/linux/rootfs.cpio.gz <project root>/pre-built/linux/images/xen-rootfs.cpio.gz

homin@homin-5820:~/petalinux/tools/common/petalinux/bin/zcu216_v2022_1/pre-built/linux/xen/$ cat > xen.cfg << EOL
MEMORY_START="0x0"
MEMORY_END="0x80000000"
XEN="xen"
DOM0_KERNEL="xen-Image"
DEVICE_TREE="xen.dtb"
DOM0_RAMDISK="xen-rootfs.cpio.gz"
NUM_DOMUS="0"
UBOOT_SOURCE="xen_boot.source"
UBOOT_SCRIPT="xen_boot.scr"
EOL

homin@homin-5820:~/petalinux/tools/common/petalinux/bin/zcu216_v2022_1$ export XEN_CONFIG="~/petalinux/tools/common/petalinux/bin/zcu216_v2022_1/pre-built/linux/xen/xen.cfg"

homin@homin-5820:~/petalinux/tools/common/petalinux/bin/zcu216_v2022_1$		$ export XEN_CONFIG_SKIP="1"

$ petalinux-build -c kernel -x do_deploy

homin@homin-5820:~/petalinux/tools/common/petalinux/bin/zcu216_v2022_1$ rsync -arz --progress --delete images/linux/xen_boot_* pre-built/linux/xen

homin@homin-5820:~/petalinux/tools/common/petalinux/bin/zcu216_v2022_1$ petalinux-package --bsp -p .  --output plnx_zcu216_bsp_2024feb22

 INFO: Target BSP "/home/homin/petalinux/tools/common/petalinux/bin/zcu216_v2022_1 /plnx_zcu216_bsp_2024feb22.bsp" will contain the following projects
 INFO: PetaLinux project: /home/homin/petalinux/tools/common/petalinux/bin/zcu216_v2022_1
  INFO: Sourcing build environment
 INFO: 	Copying /home/homin/petalinux/tools/common/petalinux/bin/zcu216_v2022_1/.petalinux
 INFO: 	Copying /home/homin/petalinux/tools/common/petalinux/bin/zcu216_v2022_1/.gitignore
 INFO: 	Copying /home/homin/petalinux/tools/common/petalinux/bin/zcu216_v2022_1/pre-built
 INFO: 	Copying /home/homin/petalinux/tools/common/petalinux/bin/zcu216_v2022_1/project-spec
 INFO: 	Copying /home/homin/petalinux/tools/common/petalinux/bin/zcu216_v2022_1/components
 INFO: Creating BSP
 INFO: Generating package plnx_zcu216_bsp_2024feb22.bsp...
 INFO: BSP is ready

Pack the Boot files:

homin@homin-5820:~/petalinux/tools/common/petalinux/bin/zcu216_v2022_1$ petalinux-package --boot --force --fpga pre-built/linux/images/system.bit    --fsbl pre-built/linux/images/zynqmp_fsbl.elf    --u-boot pre-built/linux/images/u-boot.elf   --pmufw pre-built/linux/images/pmufw.elf   --atf pre-built/linux/images/bl31.elf
[INFO] Sourcing buildtools
INFO: File in BOOT BIN: "/home/homin/petalinux/tools/common/petalinux/bin/zcu216_v2022_1/pre-built/linux/images/zynqmp_fsbl.elf"
INFO: File in BOOT BIN: "/home/homin/petalinux/tools/common/petalinux/bin/zcu216_v2022_1/pre-built/linux/images/pmufw.elf"
INFO: File in BOOT BIN: "/home/homin/petalinux/tools/common/petalinux/bin/zcu216_v2022_1/pre-built/linux/images/system.bit"
INFO: File in BOOT BIN: "/home/homin/petalinux/tools/common/petalinux/bin/zcu216_v2022_1/pre-built/linux/images/bl31.elf"
INFO: File in BOOT BIN: "/home/homin/petalinux/tools/common/petalinux/bin/zcu216_v2022_1/images/linux/system.dtb"
INFO: File in BOOT BIN: "/home/homin/petalinux/tools/common/petalinux/bin/zcu216_v2022_1/pre-built/linux/images/u-boot.elf"
INFO: Generating zynqmp binary package BOOT.BIN...
  1. the new BOOT.BIN was saved in ~/images/linux.
  2. Copies that BOOT.BIN file to SD card with "boot.scr","rootfs.cpio.gz.u-boot","system.dtb" and "Image".
  3. Be careful about the partition of SD card, there are 2 of them, copied files to the one with BOOT.BIN.