Zynq Ultrascale+ Boot Linux From Source

Boot Linux from Sources Ubuntu 16.04

Steps for Booting Linux on a ZCU104 revC evaluation board without using Xilinx PetaLinux tools.

Image result for ZCU104 vivado design
Xilinx Zynq UltraScale+ MPSoC ZCU104 Evaluation Kit

Zynq Ultrascale+ TRM

https://www.xilinx.com/support/documentation/user_guides/ug1085-zynq-ultrascale-trm.pdf

Create Vivado Project

Every step should be done using the same Vivado version. From Project, SDK and sources.

Image result for ZCU104 vivado design
Vivado Project – Zynq Ultrascale+
Image result for Xilinx SDK hdf zynq ultrascale+
Vivado Design for Zynq Ultrascale+

Export Hardware from Vivado

The hardware definition file (.hdf) can be created from your Vivado project. This file is necessary to create a Xilinx SDK software project relevant to your hardware configuration.

Create First-Stage Boot Loader (FSBL)

In Xilinx SDK create FSBL Application and Board Support Package (BSP). You application should be based on you HDF file previously generated.

Fetch Sources

Repository NameContent
https://github.com/Xilinx/linux-xlnx.gitThe Linux kernel with Xilinx patches and drivers
https://github.com/Xilinx/u-boot-xlnx.gitThe u-boot bootloader with Xilinx patches and drivers
https://github.com/Xilinx/device-tree-xlnx.gitDevice Tree generator plugin for xsdk
https://git.kernel.org/pub/scm/utils/dtc/dtc.gitDevice Tree compiler (required to build U-Boot)
https://github.com/Xilinx/arm-trusted-firmware.gitARM Trusted Firmware (required for Zynq UltraScale+ MPSoC

Device Tree plugin for Xilinx SDK

Download the device tree plugin for SDK from github repository . Make sure Vivado version is the same as the project created.
Once file is downloaded extract it and include the folder as a repository in Xilinx SDK project.
Create a device tree from the Board Support Package creation.

The Platform Management Unit (PMU)

The PMU controls the power up and reset sequence of the hardware enabled.

Create an application project in Xilinx SDK targeting the PMU processor.

Initial Build Preparation

Source your vivado/settings64.sh from your Vivado instalation folder.
Set environment variables:

export CROSS_COMPILE=aarch64-linux-gnu-
export ARCH=aarch64

The U-boot

U-boot bootloader should be downloaded from github repository. Make sure Vivado version is the same as the project created.

Basic files used by u-boot building process:
DTC Compiler
scripts/dtc/dtc
Device Tree
arch/arm/dts/Makefile
arch/arm/dts/zynqmp-zcu104-revC.dts
arch/arm/dts/zynqmp*.dtsi
Configuration
configs/xilinx_zynqmp_zcu104_revC_defconfig

From u-boot folder:

make xilinx_zynqmp_zcu104_revC_defconfig
make

Built u-boot can be found in ./u-boot.elf

The Kernel

The Linux Kernel should be downloaded from github repository. Make sure Vivado version is the same as project created.

Basic files used by Kernel building process:
Configuration:
arch/arm64/configs/xilinx_zynqmp_defconfig

Build rom the folder where the kernel was extracted.

make ARCH=arm64 xilinx_zynqmp_defconfig
make

Kernel Image can be found in: arch/arm64/boot/Image

Download File system

Download  tarball file system from Ubuntu image repository.

Create a BOOT.bin

A BOOT.bin can be created in Xilinx SDK using bootgen. BOOT.bin contains the initial boot files your PS will look for when powered-on.

BOOT.bin contents:
FSBL
PMU Firmware
Bitstream file
ATF
U-boot

Create SD Card Image

SD Card image should contain 2 partions. They are BOOT and rootfs.
BOOT partition should be at lease 100 MB and formatted with FAT32 disk format. While rootfs should be at lease 2GB and formatted with EXT3 or EXT4 format.

From Linux gparted can be used to create the table of partitions.

BOOT partition contents:
BOOT.bin – Boot medium
system.dtb – Binary Device Tree
Image – Kernel Image

rootfs partition contents:
Extract filesystem tarball to rootfs.

mount /dev/sdX2 /mnt/rootfs
tar -xf ubuntu-*.tar.gz -C /mnt/rootfs

Leave a Reply

Your email address will not be published. Required fields are marked *