Luciano Brunette's Blog

Cycling, Hardware Engineering, Quant Finance and anything I want to write about.

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

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 Linux kernel with Xilinx patches and drivers u-boot bootloader with Xilinx patches and drivers Tree generator plugin for xsdk Tree compiler (required to build U-Boot) 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/ 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
Device Tree

From u-boot folder:

make xilinx_zynqmp_zcu104_revC_defconfig

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:

Build rom the folder where the kernel was extracted.

make ARCH=arm64 xilinx_zynqmp_defconfig

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:
PMU Firmware
Bitstream file

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 *