PetaLinux

ZedBoard

Connor Sanchez

2021-11-19

Download

Get the requirements:

  1. petalinux-v2021.1-final-installer.run
  2. avnet-digilent-zedboard-v2021.1-final.bsp

Install

./petalinux-v2021.1-final-installer.run --dir 2021.1 --platform arm

Setup

. 2021.1/settings.sh
petalinux-util --webtalk off

Create

petalinux-create -t project -s avnet-digilent-zedboard-v2021.1-final.bsp

Menuconfig Corruption for Kernel and U-Boot

Uncomment the #OE_TERMINAL = "tmux" line in project-spec/meta-user/conf/petalinuxbsp.conf

Config

petalinux-config --get-hw-description ${XSA_DIR}/system.xsa
# Imports the custom hardware configuration
#
#    Image Packaging Configuration  --->
#          Root filesystem type (EXT4 (SD/eMMC/SATA/USB))  --->
#             (X) EXT4 (SD/eMMC/SATA/USB)
#       [ ] Copy final images to tftpboot

petalinux-config -c kernel
#   Device Drivers
#      <*> Industrial I/O support  --->
#            Inertial measurement units  --->
#               <M> InvenSense ICM-426xx I2C driver
#               <M> InvenSense ICM-426xx SPI driver
#      <*> I3C support  --->
#            <M>   Cadence I3C master driver
#      [*] SPI support  --->
#            <M>   User mode SPI device driver support

petalinux-config -c rootfs
# https://github.com/Xilinx/meta-petalinux/tree/master/recipes-core/packagegroups
# Add self-hosted for gcc, make, and vim
#
# Petalinux Package Groups
#    packagegroup-petalinux
#       packagegroup-petalinux
#       packagegroup-petalinux-dev
#    packagegroup-petalinux-networking-stack
#       packagegroup-petalinux-networking-stack
#       packagegroup-petalinux-networking-stack-dev
#    packagegroup-petalinux-opencv
#       packagegroup-petalinux-opencv
#       packagegroup-petalinux-opencv-dev
#    packagegroup-petalinux-python-modules
#       packagegroup-petalinux-python-modules
#       packagegroup-petalinux-python-modules-dev
#    packagegroup-petalinux-self-hosted
#       packagegroup-petalinux-self-hosted
#       packagegroup-petalinux-self-hosted-dev
#    packagegroup-petalinux-utils
#       packagegroup-petalinux-utils
#       packagegroup-petalinux-utils-dev
# Image Features
#    [*] package-management

Build

petalinux-build
# Build petalinux-image-minimal

Package

petalinux-package --boot --fsbl --fpga --u-boot
# Generates BOOT.BIN containing:
#  1. FSBL (images/linux/zynq_fsbl.elf)
#  2. FPGA bitstream (images/linux/system.bit)
#  3. U-Boot (images/linux/u-boot.elf)
#  4. DTB (images/linux/system.dtb)

SD Card

Split SD card into two partitions:

  1. bootable flagged (a) vfat (+1G)
  2. ext4

More info at the wiki page How to format SD card for SD boot

sudo fdisk /dev/sdb

sudo mkfs.vfat -F 32 -n BOOT /dev/sdb1
sudo mkfs.ext4 -L rootfs /dev/sdb2

# Mount boot partition (/dev/sdb1 on /media/connure/BOOT)
# Copy over BOOT.BIN, boot.scr, and image.ub

sudo dd if=rootfs.ext4 of=/dev/sdb2 bs=1M status=progress
# Or, mount rootfs partition (/dev/sdb2 on /media/connure/rootfs) and
sudo tar -zxvpf rootfs.tar.gz -C /media/connure/rootfs

sync

Jumper Settings

Make sure jumpers are set correctly on ZedBoard

Look at the Hardware User's Guide

Simple checklist:

Serial Terminal

python3 -m serial.tools.list_ports
# List all serial ports

python3 -m serial.tools.miniterm --eol LF --raw COM3 115200
# Connect over serial to the UART port on ZedBoard

Avahi

Already installed by one of the Petalinux Package Groups from the rootfs config step

Provided by the github.com/lathiat/nss-mdns package in the sswreleases repository

# /media/connure/rootfs/etc/avahi/avahi-daemon.conf

[server]
host-name=zedboard
domain-name=local
allow-interfaces=eth0

[publish]
publish-addresses=yes
publish-hinfo=yes
publish-workstation=yes
publish-domain=yes
publish-aaaa-on-ipv4=yes
publish-a-on-ipv6=no

SSH

# /media/connure/rootfs/home/petalinux/.ssh/authorized_keys

cat id_ed25519.pub >> authorized_keys
# Permanent pub-key auth

ssh petalinux@zedboard.local
# SSH into device

Dynamically Loading a DT Overlay

More info in the Xilinx Linux kernel DeviceTree doc's configfs-overlays.txt

sudo su
mkdir /sys/kernel/config/device-tree/overlays/icm42605
cat /sys/kernel/config/device-tree/overlays/icm42605/status
cat icm42605.dtbo > /sys/kernel/config/device-tree/overlays/icm42605/dtbo
cat /sys/kernel/config/device-tree/overlays/icm42605/status