Linux deployment for Vitis AI enviroment
This section is part of a series focused on utilizing the DPUCZDX8G Deep Learning Processor Unit (DPU), a programmable engine optimized for convolutional neural networks (CNNs), within the Vitis AI environment. In this section, I will describe the process of deployment Linux for the Zynq UltraScale+ 2CG device with Vitis AI library. The setup used includes the Trenz Module TE0820-03-2AI21FA (ZU+ 2CG) and the TE0703-06 carrier board.
This series covers key steps for enabling efficient AI acceleration on embedded platforms, including:
By following this guide, can be gained practical insights into designing, deploying, and running AI workloads on Zynq UltraScale+ MPSoCs using Vitis AI.
All sources are available for free into my repository. The repository consists of example for to ZU+ devices (2CG and 4EV, Trenz modules TE0820-03-2AI21FA and TE0820-05-4DE21MA) and allows to create Vivado Hardware Design and deploy Linux by using Petalinux for Vitis AI enviroment.
The structure of the repository:
board/ - Vivado block design and project configuration tcl
petalinux/ - Petalinux project configuration
ip/ - DPU IP core sources
scripts/ - some helper scripts
My host enviroment:
1. Ubuntu 20.04 on WSL2
2. Vitis 2022.2 installed in Ubuntu 20.04
3. Petalinux 2022.2
4. Vitis AI 3.0 repository
5. DPU DPUCZDX8G IP core
How to start. Since Vivado project is completed and sys_wrapper.xsa file is available in directory build/, Petalinux project can be started.
[host]:~/edu-vitis-ai$ make te0820-2cg-lin
Petalinux configuration. Project configuration window will be opened. For project configuration should be the following settings specified:
for accelerating petalinux build (optional: this step can be missed if local copies of the software package downloads is present)
Yocto Settings ---> Add pre-mirror url --->file:///home/user-name/petalinux/2022.2/downloads
where file:///home/user-name/petalinux/2022.2/downloads is the path to software package downloads
for accelerating petalinux build (optional: this step can be missed if local copies of the software package sstate cache is present)
Yocto Settings ---> Local sstate feeds settings ---> /home/user-name/petalinux/2022.2/aarch64
where /home/user-name/petalinux/2022.2/aarch64 is the path to software package sstate cache
package configuration for Image (microSD card is mmbclk1p2 in Trenz module TE0820-03)
Image Packaging Configuration ---> Root filesystem type ---> EXT4 (SD/eMMC/SATA/USB)
Image Packaging Configuration ---> Device node of SD device (NEW) ---> /dev/mmcblk1p2
Image Packaging Configuration ---> Copy final images to tftpboot ---> uncheck
devicetree default kernel arguments
DTG Settings--->Kernel Bootargs ---> generate boot args automatically ---> uncheck
DTG Settings--->Kernel Bootargs ---> user kernel bootargs ---> earlycon console=ttyPS0,115200 clk_ignore_unused root=/dev/mmcblk1p2 rw rootwait cma=512M
static IP address for Ethernet
Subsystem AUTO Hardware Settings ---> Ethernet Settings ---> Obtain IP address automatically (uncheck)
Subsystem AUTO Hardware Settings ---> Ethernet Settings ---> Static IP address (192.168.1.123)
Subsystem AUTO Hardware Settings ---> Ethernet Settings ---> Static IP gateway (192.168.1.1)
Rootfs configuration. Change directory to petalinux project and call rootfs configuration menu.
[host]:~/edu-vitis-ai$ cd build/te0820-2cg-lin
[host]:~/edu-vitis-ai/build/te0820-2cg-lin$ petalinux-config -c rootfs
Following settings should be set:
user packages enabling
user packages ---> checking out all packages excluding vitis-ai-library-dbg and vitis-ai-library-dev
enabling resnet50 vitis-ai example
apps ---> resnet50
enabling ssh-server instead of dropbear
Image Features ---> ssh-server-dropbear ---> uncheck
Image Features ---> ssh-server-openssh ---> check
Image Features ---> package-management ---> check
Filesystem Packages ---> console ---> network ---> openssh ---> check (openssh, openssh-sftp-server, openssh-sshd, openssh-scp)
Filesystem Packages ---> misc ---> packagegroup-core-ssh-dropbear ---> packagegroup-core-ssh-dropbear ---> uncheck
Vitis AI packages for Petalinux project were added from DPUCZDX8G_VAI_v3.0.tar.gz archive.
After unziping the archive, all folders from DPUCZDX8G_VAI_v3.0/prj/Vivado/sw/meta-vitis were copied into project-spec/meta-user/.
The file project-spec/meta-user/conf/user-rootfsconfig was edited as follows:
Petalinux build. Start building petalinux project
[host]:~/edu-vitis-ai/build/te0820-2cg-lin$ petalinux-build
Generate BOOT.BIN file
[host]:~/edu-vitis-ai/build/te0820-2cg-lin$ cd images/linux
petalinux-package --boot --fsbl zynqmp_fsbl.elf --u-boot u-boot.elf --pmufw pmufw.elf --fpga system.bit --force
Generate partitioned images for microSD card (also zipped image can be created with appending --wic-extra-args "-c gzip" )
[host]:~/edu-vitis-ai/build/te0820-2cg-lin$ cp ../../scripts/mmcblk1.wks images/linux
petalinux-package --wic --wks images/linux/mmcblk1.wks --rootfs-file images/linux/rootfs.tar.gz --bootfiles "BOOT.BIN image.ub boot.scr"
Partitioned image petalinux-sdimage.wic or petalinux-sdimage.wic.gz will be created. The image can be flashed into a microSD card by using for example balenaEtcher software. After booting Linux from SD on TE0820-03-2AI21FA + TE0703-06 console output should look like:
Conclusion. Here was outlined the step-by-step process of deploying Linux for the Vitis AI environment on a Zynq UltraScale+ 2CG device, using the Trenz TE0820-03-2AI21FA module and TE0703-06 carrier board. By leveraging PetaLinux as part of the Vivado flow for Vitis AI, this setup enables the efficient deployment of AI workloads on embedded systems. The provided information can be easily adapted for other custom Zynq UltraScale+ devices by using packages from DPUCZDX8G_VAI_v3.0.tar.gz.
Sources:
1. Vitis AI Library User Guide (UG1354)
2. DPUCZDX8G for Zynq UltraScale+ MPSoCs Product Guide (PG338)