Skip to content

Xilinx Petalinux scripts for building, deploying, debugging etc..

License

Notifications You must be signed in to change notification settings

bspguy/petalinux-scripts

Repository files navigation

PetaLinux Scripts

Xilinx Petalinux scripts for building, deploying, debugging etc..

PetaLinux Cheat-Sheet

This following cheat-sheet includes common commands used in PetaLinux based projects.

Installation

chmod 755 ./petalinux-v2022.2-final-installer.run
sudo chmod 755 ./petalinux-v2022.2-final-installer.run 
./petalinux-v2022.2-final-installer.run --dir ~/../petalinux/2022.2/
source ../../../../petalinux/2022.2/settings.sh

Packaging

petalinux-package --boot --u-boot ./images/linux/u-boot.elf
petalinux-package --boot --fsbl zynqmp_fsbl.elf  --pmufw pmufw.elf --atf bl31.elf --u-boot u-boot.elf

Configuration

petalinux-config --get-hw-description=/../zc102_demo_wrapper.xsa

Building

petalinux-build -x package
petalinux-build -c kernel

Cleaning

petalinux-build -x mrproper

Root File System Configuration

petalinux-config -c rootfs
petalinux-config -c uboot

Project Creation

petalinux-create -t project  -s ../xilinx-zcu102-v2022.2-10141622.bsp 

Writing Root File System to SD Card

dd bs=8192 status=progress  if=~/../rootfs.ext4  of=/dev/sdc2

Fix umount Errors

fsck /dev/sde2

Minicom Example

minicom  -D /dev/ttyUSBX -b 115200

Device Tree Decompilation into DTS

dtc -I dtb -O dts system.dtb -o /tmp/tmp.dts

Bootgen.bif Example

the_ROM_image:
{
	[bootloader, destination_cpu=a53-0] zynqmp_fsbl.elf
	[pmufw_image] pmufw.elf
	[destination_device=pl] pre-built/linux/implementation/download.bit
	[destination_cpu=a53-0, exception_level=el-3, trustzone] bl31.elf
	[destination_cpu=a53-0, load=0x00100000] system.dtb
	[destination_cpu=a53-0, exception_level=el-2] u-boot.elf
}

Debugging Kernel

petalinux-boot --jtag --u-boot --fpga --bitstream system.bit

Boot Kernel in U-Boot

> pxe get
> pxe boot

QSPI Flash Boot

Make sure the TFTP server is up and the images are located in /srv/tfpboot directory.

# Initialize SPI flash
sf probe 0 0 0

# Erase SPI flash (for a 128MiB flash size)
sf erase 0 0x8000000

# Write BOOT.BIN into Flash
tfpboot 0x80000 BOOT.BIN
sf write 0x80000 0x0 <0xfile_size>

# Write image.ub into Flash
tfpboot 0x80000 image.ub
sf write 0x80000 <0ximage_flash_address> <0xfile_size>

# Write boot.scr into Flash
tfpboot 0x80000 boot.scr
sf write 0x80000 <0xboot_scr_flash_address> <0xfile_size>

# Reset board in QSPI mode

Example for u-boot.txt

# Set environment variables
setenv bootargs console=ttyPS0,115200 earlyprintk root=/dev/mmcblk0p2 rw rootwait

# Load the image from QSPI flash into memory
sf probe 0; sf read ${loadaddr} 0x100000 0x800000

# Boot the image
bootm ${loadaddr}

How to Create a boot.scr File from the boot.txt

mkimage -C none -A arm -T script -d boot.txt boot.scr

About

Xilinx Petalinux scripts for building, deploying, debugging etc..

Resources

License

Stars

Watchers

Forks

Languages