How to build Petalinux ROOTS for Ultra96 V2 based on Avnet BSP 2021.1

Build Steps
PetaLinux Tools Build Guide for Ultra96-V2 Avnet out of box BSP 2021.1
Build Platform Management Unit firmware PMUFW) for Ultra96 V2
# Setup PetaLinux Environment
cd ~petalinux-install-directory
source peta/settings.sh
source peta/settings.sh PetaLinux environment set to '/home/jimmy/petalinux/2021.1/peta' INFO: Checking free disk space INFO: Checking installed tools INFO: Checking installed development libraries INFO: Checking network and other services |
# go to BSP source code directory
cd u96v2_sbc_base_2021_1
# In order to clean up build temp files By running following command:
petalinux-build -c rootfs -x distclean
# You should see following debug messages:
petalinux-build -c rootfs -x distclean [INFO] Sourcing buildtools [INFO] Building rootfs [INFO] Sourcing build environment [INFO] Generating workspace directory INFO: bitbake petalinux-image-minimal -c cleansstate NOTE: Started PRServer with DBfile: /home/jimmy/petalinux/2021.1/u96v2_sbc_base_2021_1/build/cache/prserv.sqlite3, IP: 127.0.0.1, PORT: 36133, PID: 14695 Loading cache: 100% |########################################################################################################################################################################| Time: 0:00:06 Loaded 5139 entries from dependency cache. Parsing recipes: 100% |######################################################################################################################################################################| Time: 0:00:01 Parsing of 3514 .bb files complete (3504 cached, 10 parsed). 5149 targets, 227 skipped, 0 masked, 0 errors. NOTE: Resolving any missing task queue dependencies Initialising tasks: 100% |###################################################################################################################################################################| Time: 0:00:01 Sstate summary: Wanted 0 Found 0 Missed 0 Current 0 (0% match, 0% complete) NOTE: No setscene tasks NOTE: Executing Tasks NOTE: Tasks Summary: Attempted 2 tasks of which 0 didn't need to be rerun and all succeeded. [INFO] Successfully built rootfs |
# In order to fetch source ode, please run following command:
petalinux-build -c rootfs -x fetch
# You should see following debug messages:
petalinux-build -c rootfs -x fetch [INFO] Sourcing buildtools [INFO] Building rootfs [INFO] Sourcing build environment [INFO] Generating workspace directory INFO: bitbake petalinux-image-minimal -c fetch NOTE: Started PRServer with DBfile: /home/jimmy/petalinux/2021.1/u96v2_sbc_base_2021_1/build/cache/prserv.sqlite3, IP: 127.0.0.1, PORT: 38185, PID: 15591 Loading cache: 100% |########################################################################################################################################################################| Time: 0:00:01 Loaded 5139 entries from dependency cache. Parsing recipes: 100% |######################################################################################################################################################################| Time: 0:00:01 Parsing of 3514 .bb files complete (3504 cached, 10 parsed). 5149 targets, 227 skipped, 0 masked, 0 errors. NOTE: Resolving any missing task queue dependencies Initialising tasks: 100% |###################################################################################################################################################################| Time: 0:00:01 Sstate summary: Wanted 0 Found 0 Missed 0 Current 0 (0% match, 0% complete) NOTE: No setscene tasks NOTE: Executing Tasks NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn't need to be rerun and all succeeded. INFO: Successfully copied built images to tftp dir: /tftpboot [INFO] Successfully built rootfs |
# In order to unpack source ode, please run following command:
petalinux-build -c rootfs -x unpack
# You will see following debug messages:
petalinux-build -c rootfs -x unpack [INFO] Sourcing buildtools [INFO] Building rootfs [INFO] Sourcing build environment [INFO] Generating workspace directory INFO: bitbake petalinux-image-minimal -c unpack NOTE: Started PRServer with DBfile: /home/jimmy/petalinux/2021.1/u96v2_sbc_base_2021_1/build/cache/prserv.sqlite3, IP: 127.0.0.1, PORT: 34053, PID: 16828 Loading cache: 100% |########################################################################################################################################################################| Time: 0:00:06 Loaded 5139 entries from dependency cache. Parsing recipes: 100% |######################################################################################################################################################################| Time: 0:00:01 Parsing of 3514 .bb files complete (3504 cached, 10 parsed). 5149 targets, 227 skipped, 0 masked, 0 errors. NOTE: Resolving any missing task queue dependencies Initialising tasks: 100% |###################################################################################################################################################################| Time: 0:00:01 Sstate summary: Wanted 0 Found 0 Missed 0 Current 0 (0% match, 0% complete) NOTE: No setscene tasks NOTE: Executing Tasks NOTE: Tasks Summary: Attempted 2 tasks of which 1 didn't need to be rerun and all succeeded. INFO: Successfully copied built images to tftp dir: /tftpboot [INFO] Successfully built rootfs |
# In order to rebuild source ode, please run following command:
petalinux-build -c avnet-image-full
petalinux-build -c avnet-image-full [INFO] Sourcing buildtools [INFO] Building avnet-image-full [INFO] Sourcing build environment [INFO] Generating workspace directory INFO: bitbake avnet-image-full NOTE: Started PRServer with DBfile: /home/jimmy/petalinux/2021.1/u96v2_sbc_base_2021_1/build/cache/prserv.sqlite3, IP: 127.0.0.1, PORT: 43509, PID: 32340 Loading cache: 100% |########################################################################################################################################################################| Time: 0:00:01 Loaded 5139 entries from dependency cache. Parsing recipes: 100% |######################################################################################################################################################################| Time: 0:00:01 Parsing of 3514 .bb files complete (3504 cached, 10 parsed). 5149 targets, 227 skipped, 0 masked, 0 errors. NOTE: Resolving any missing task queue dependencies Initialising tasks: 100% |###################################################################################################################################################################| Time: 0:00:19 Checking sstate mirror object availability: 100% |###########################################################################################################################################| Time: 0:00:15 Sstate summary: Wanted 650 Found 147 Missed 503 Current 4033 (22% match, 89% complete) NOTE: Executing Tasks NOTE: Tasks Summary: Attempted 12776 tasks of which 12611 didn't need to be rerun and all succeeded. INFO: Successfully copied built images to tftp dir: /tftpboot [INFO] Successfully built avnet-image-full |
How to load and debug over JTAG
# We need set device board boot switch to 00, which is booting from JTAG
# start xilinx hardware server
/home/jimmy/petalinux/2021.1/peta/tools/xsct/bin/xsct
# you will see following debug message
/home/jimmy/petalinux/2021.1/peta/tools/xsct/bin/xsct rlwrap: warning: your $TERM is 'xterm-256color' but rlwrap couldn't find it in the terminfo database. Expect some problems.
****** Xilinx Software Commandline Tool (XSCT) v2021.1 **** SW Build 3240477 on 2021-06-05-19:57:09 ** Copyright 1986-2021 Xilinx, Inc. All Rights Reserved. xsct% |
# run connect command to start hardware server
xsct% connect attempting to launch hw_server
****** Xilinx hw_server v2021.1.0 **** Build date : Jun 5 2021 at 17:46:51 ** Copyright 1986-2021 Xilinx, Inc. All Rights Reserved. INFO: hw_server application started INFO: Use Ctrl-C to exit hw_server application INFO: To connect to this hw_server instance use url: TCP:127.0.0.1:3121 tcfchan#0 xsct% |
# Run targets command to get targets
# You will see following debug message from host
xsct% targets 1 PS TAP 2 PMU 3 PL 5 PSU 6 RPU (Reset) 7 Cortex-R5 #0 (RPU Reset) 8 Cortex-R5 #1 (RPU Reset) 9 APU (L2 Cache Reset) 10 Cortex-A53 #0 (APU Reset) 11 Cortex-A53 #1 (APU Reset) 12 Cortex-A53 #2 (APU Reset) 13 Cortex-A53 #3 (APU Reset) xsct% |
# You
# Power on the device, and then run following commands
petalinux-boot --jtag --kernel --rootfs images/linux/rootfs.cpio
# You will see following debug message from host
petalinux-boot --jtag --kernel --rootfs images/linux/rootfs.cpio [INFO] Sourcing buildtools INFO: Launching XSDB for file download and boot. INFO: This may take a few minutes, depending on the size of your image. rlwrap: warning: your $TERM is 'xterm-256color' but rlwrap couldn't find it in the terminfo database. Expect some problems.: Inappropriate ioctl for device INFO: Downloading ELF file: /home/jimmy/petalinux/2021.1/u96v2_sbc_base_2021_1/images/linux/pmufw.elf to the target. INFO: Downloading ELF file: /home/jimmy/petalinux/2021.1/u96v2_sbc_base_2021_1/images/linux/zynqmp_fsbl.elf to the target. INFO: Loading image: /home/jimmy/petalinux/2021.1/u96v2_sbc_base_2021_1/images/linux/system.dtb at 0x00100000 INFO: Downloading ELF file: /home/jimmy/petalinux/2021.1/u96v2_sbc_base_2021_1/images/linux/u-boot.elf to the target. INFO: Loading image: /home/jimmy/petalinux/2021.1/u96v2_sbc_base_2021_1/images/linux/Image at 0x00200000 INFO: Loading image: /home/jimmy/petalinux/2021.1/u96v2_sbc_base_2021_1/images/linux/boot.scr at 0x20000000 INFO: Downloading ELF file: /home/jimmy/petalinux/2021.1/u96v2_sbc_base_2021_1/images/linux/bl31.elf to the target. INFO: Enter booti 0x00200000 - 0x00100000 in uboot terminal if auto boot fails |
# You will see following debug message from minicom/hyperterminal
Xilinx Zynq MP First Stage Boot Loader Release 2021.1 Jun 6 2021 - 07:07:32 NOTICE: ATF running on XCZU3EG/silicon v4/RTL5.1 at 0xfffea000 NOTICE: BL31: v2.4(release):v1.1-7609-g851523ea2 NOTICE: BL31: Built : 08:27:07, Apr 28 2021
U-Boot 2021.01 (Jun 01 2021 - 11:54:06 +0000)
Board: Xilinx ZynqMP DRAM: 2 GiB PMUFW: v1.1 EL Level: EL2 Chip ID: zu3eg NAND: 0 MiB MMC: mmc@ff160000: 0, mmc@ff170000: 1 In: serial Out: serial Err: serial Bootmode: JTAG_MODE Reset reason: EXTERNAL Net: No ethernet found. Hit any key to stop autoboot: 0 JTAG: Trying to boot script at 20000000 ## Executing script at 20000000 Trying to load boot images from jtag Wrong Ramdisk Image Format Ramdisk image is corrupt or invalid Trying to load boot images from pxe Trying to load boot images from dhcp Trying to load boot images from jtag Wrong Ramdisk Image Format Ramdisk image is corrupt or invalid Trying to load boot images from mmc0 Importing environment(uEnv.txt) from mmc0... ## Info: input data size = 26 = 0x1A Wrong Image Format for bootm command ERROR: can't get kernel image! Wrong Ramdisk Image Format Ramdisk image is corrupt or invalid Wrong Ramdisk Image Format Ramdisk image is corrupt or invalid ## Flattened Device Tree blob at 00100000 Booting using the fdt blob at 0x100000 Loading Device Tree to 000000007dcfd000, end 000000007dd0f5db ... OK Starting kernel ... [ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034] [ 0.000000] Linux version 5.10.0-xilinx-v2021.1 (oe-user@oe-host) (aarch64-xilinx-linux-gcc (GCC) 10.2.0, GNU ld (GNU Binutils) 2.35.1) #1 SMP Fri Jun 4 15:57:16 UTC 2021 [ 0.000000] Machine model: xlnx,zynqmp [ 0.000000] earlycon: cdns0 at MMIO 0x00000000ff010000 (options '115200n8') [ 0.000000] printk: bootconsole [cdns0] enabled [ 0.000000] efi: UEFI not found. [ 0.000000] cma: Reserved 512 MiB at 0x000000005dc00000 [ 0.000000] Zone ranges: [ 0.000000] DMA32 [mem 0x0000000000000000-0x000000007fefffff] [ 0.000000] Normal empty [ 0.000000] Movable zone start for each node [ 0.000000] Early memory node ranges [ 0.000000] node 0: [mem 0x0000000000000000-0x000000003ecfffff] [ 0.000000] node 0: [mem 0x000000003ee48000-0x000000007fefffff] [ 0.000000] Zeroed struct page in unavailable ranges: 512 pages [ 0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000007fefffff] [ 0.000000] psci: probing for conduit method from DT. [ 0.000000] psci: PSCIv1.1 detected in firmware. [ 0.000000] psci: Using standard PSCI v0.2 function IDs [ 0.000000] psci: MIGRATE_INFO_TYPE not supported. [ 0.000000] psci: SMC Calling Convention v1.2 [ 0.000000] percpu: Embedded 22 pages/cpu s49624 r8192 d32296 u90112 [ 0.000000] Detected VIPT I-cache on CPU0 [ 0.000000] CPU features: detected: ARM erratum 845719 [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 515516 [ 0.000000] Kernel command line: earlycon console=ttyPS0,115200 clk_ignore_unused root=/dev/mmcblk0p2 rw rootwait cma=512M [ 0.000000] Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes, linear) [ 0.000000] Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes, linear) [ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off |