Booting Linux on Xilinx Zynq MPSoC

Tags: xilinx linux mpsoc

The Xilinx MPSoC boot process requires the following components:

The Linux kernel image Image is the easiest part: simply clone the Linux kernel repository and build it (setting the ARCH and CROSS_COMPILE environment variables appropriately). The Image kernel image file can be found under arch/arm64/boot/.

If you are not using any custom designs in the FPGA fabric, generating the device tree blob is also done in the Linux kernel sources and can be found under arch/arm64/boot/dts/xilinx/ (simply rename the appropriate board .dtb file to system.dtb).

The BOOT.bin file is the output of Xilinx's bootgen tool. bootgen packages the First Stage Boot Loader (FSBL), the PMU firmware, the (optional) FPGA bitstream, the ARM Trusted Firmware (ATF), and U-Boot together into a single binary file. Each of these sub-components makes up a "partition". On boot, the MPSoC's Configuration and Security Unit (CSU) reads the header from the BOOT.bin file to determine some basic information about the FSBL. It then copies the FSBL and the PMU firmware into the OCM and PMU RAM respectively and begins to execute the FSBL (the processor on which it executes the FSBL is determined by the header in BOOT.bin).

The FSBL now reads the rest of the partitions from the BOOT.bin file and handles each appropriately. If it encounters a bitstream, it programs the FPGA fabric with that bitstream through the processor's PCAP interface. It also loads the ARM Trusted Firmware (ATF) and U-Boot into RAM and then hands off execution to the ATF which in turn hands off execution to U-Boot.^[The boot process is explained in detail in Chapter 7, "System Boot and Configuration" of the Zynq UltraScale+ MPSoC: Software Developers Guide.] U-Boot is then responsible for actually booting the Linux kernel image alongside the device tree blob (note that by default U-Boot looks for a device tree blob called system.dtb, which is why we renamed it earlier).

Creating the BOOT.bin file can be done either through the Xilinx SDK GUI or from the command line using xsct and the bootgen utility (see an example here).

Place the BOOT.bin, Image, and system.dtb files together on a FAT32 partition on an SD card. On the same SD card, create an ext3/ext4 partition with a Linux rootfs.