Getting Linux working on Zynq is very simple, following steps are required
Vivado/SDK/PetaLinux 20xx.x installed (important do not mix versions!)
Create Vivado Project, configure PS, Export HDF (XSA for 19.2 and newer)
Ceate new PetaLinux project
Import HDF(XSA for 19.2 and newer) into project
petalinux-build
copy boot.bin and image.ub to SD Card (only 2 files no more)
This is generic how-to, everything is setup for your by the Vivado->PetaLinux flow. Note, the boot.bin generated by PetaLinux may not always work, in such case it is recommended to make the boot.bin with SDK-GUI or command line tools manually.
There is no need to install anything else, or to fetch anything from any github repos, etc.
PetaLinux 2023.2
Petalinux 2023.2 is under review documentation for 2023.2 can be changed permanently at the moment
<PROJECT_NAME>:The name of the project you are building
Import Hardware Configuration (see UG1144):
Export Hardware Definition File (*.xsa) from the Vivado Project into the PetaLinux root folder "<plnx-proj-root>":
change to PetaLinux root folder:
Run:$ petalinux-config --get-hw-description
(optional) Configure your PetaLinux:
While anywhere in the project folder tree:
Run:$ petalinux-config
Run:$ petalinux-config -c u-boot
Run:$ petalinux-config -c kernel
Run:$ petalinux-config -c rootfs
Build System Image (see UG1144):
While anywhere in the project folder tree:
Run:$ petalinux-build
Generate Boot.bin with Vitis tools (recommended)
Take u-boot.elf, image.ub, bl31.elf (ZynqMP only) from "<plnx-proj-root>/images/linux" for BOOT.BIN generation, also boot.scr is used (put separate on SD or include into Boot.bin for QSPI boot only). It is recommended to create the FSBL and PMU Firmware (ZynqMP only) with Vitis tools.
changes with "petalinux-config -c u-boot" will be add to meta-user as recipes
optional overwrite, add UBoot settings on platform-top.h
Important:: Separate Device tree is disabled on default project generation, it must be enabled on petalinux-config menue under u-boot configuration otherwhise linux device tree will be used
Device Tree
recipes-bsp/device-tree/files/system-user.dtsi
recipes-bsp/device-tree/files/pl-custom.dtsi
overwrite or add device tree attributes
Kernel
recipes-kernel/linux/linux-xlnx/
changes with "petalinux-config -c kernel" will be add to meta-user as recipes
Apps
project-spec/meta-user/recipes-apps
add simple new app with "petalinux-create -t apps -n myapp --enable"
enable/disable with "petalinux-config -c rootfs"
ROOTFS
project-spec/config/rootfs_config
project-spec/meta-user/conf/user-rootfsconfig
"petalinux-config -c rootfs" will save changes in the general config spec, only apps will be saved in user-rootfsconfig also
user-rootfsconfig must be changed manually and will read after rootfs_config is used
Xilinx generated configuration
project-spec/config/
Note: config and rootfs_config are shared at the moment, they include user and xilinx default changes from XSA import
Petalinux 2023.2 seems to have a Problem booting with UART1: It gets stuck on BL31 while trying to print a char to UART1 during booting.
This error happens on Versal and Zynq Ultrascale+ devices. The error is that BL31 built by petalinux does not correctly take into account that UART1 is used, and tries to output on UART0
Workaround
This can be fixed by e.g. overriding yourself with creatingarm-trusted-firmware_%.bbappendin meta-user/recipes-bsp/arm-trusted-firmware with content
For Versal: ATF_CONSOLE ="pl011_1"
For Zynq Ultrascale+: ATF_CONSOLE = "cadence1"
Modified FSBL is not containing patches
Issue
Trenz modified FSBL for petalinux is not taken into account from petalinux. This is only need on trenz project which has FSBL patch included inside the petalinux template. --><project folder>\os\petalinux\project-spec\meta-user\recipes-bsp\embeddedsw
AMD has changed patch priority and petalinux ignores provided FSBL patch in \os\petalinux\project-spec\meta-user\recipes-bsp\embeddedsw
Workaround
In order for the patches to be used, the existing line BBFILE_PRIORITY_meta-user = "[VALUE]" must be set to 9 instead of the original value 7 in the Petalinux config file project-spec/meta-user/conf/layer.conf
Error Verifying contents on S15FL127S QSPI flash memory chip
Issue
When writing an S15FL127S QSPI Chip from Linux via flashcp the verification fails. This is a driver issue of Linux as FL127 needs a page size of 256.
Workaround
To solve the programming problem in linux console via "flashcp" command:
Add the following patch file in linux kernel files: