Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This article will discuss the steps needed to download and compile a Bootable (SD) Linux Image for the ZCU102 using the OSL flow.

...

Code Block
languagec#
titleparams
SHELL := /bin/bash
TOOLS ?= /proj/gsd/vivado/Vitis
VERSION ?= 2020.2
BOARD ?= ZCU102
REPO ?= 0

Note: Make sure that the tools patch point to your relevant install on your machine

...

Code Block
languagec#
titlefsbl
proc fsbl {args} {
	set board 0
	set repo 0
	for {set i 0} {$i < [llength $args]} {incr i} {
		if {[lindex $args $i] == "-board"} {
			set board [string toupper [lindex $args [expr {$i + 1}]]] 
		}
	}
	set xsa [glob -nocomplain -directory [pwd] -type f *.xsa *.hdf]
	hsi::open_hw_design $xsa
	if {[lindexfile $argsisdirectory $i] == "-repo"embeddedsw]} {
            set repo [lindex $args [expr {$i + 1}]]
        }
	}
	set xsa [glob -nocomplain -directory [pwd] -type f *.xsa *.hdf]
	hsi::open_hw_design $xsa
	if {$repo != 0} {
		puts "INFO: Adding embeddedsw repo"
		hsi::set_repo_path $repo./embeddedsw
	}
	set fsbl_design [hsi::create_sw_design fsbl_1 -proc psu_cortexa53_0 -app zynqmp_fsbl]
	if {$board != 0} {
		common::set_property -name APP_COMPILER_FLAGS -value "-DXPS_BOARD_${board}" -objects $fsbl_design
	}
	hsi::generate_app -dir zynqmp_fsbl -compile
	hsi::close_hw_design [hsi::current_hw_design]
}

...

Code Block
languagec#
titlebuild_fsbl
fsbl:
	$(RM) -r zynqmp_fsbl
	$(TOOLS)/$(VERSION)/bin/xsct -eval "source xsct_script.tcl; fsbl -board $(BOARD) -repo $(REPO)"

If users want to make modifications to the FSBL then they can do this in the embeddedsw/lib/sw_apps/zynqmp_fsbl/src. Or, if a valid patch then apply this to embeddedsw

...

Code Block
languagec#
titlepmufw
proc pmufw {} {
	set xsa [glob -nocomplain -directory [pwd] -type f *.xsa *.hdf]
hdf]
	hsi::open_hw_design $xsa
	if {[file isdirectory embeddedsw]} {
		puts "INFO: Adding embeddedsw repo"
		hsi::openset_hw_design $xsarepo_path ./embeddedsw
	}
	hsi::generate_app -app zynqmp_pmufw -proc psu_pmu_0 -dir zynqmp_pmufw -compile
	hsi::close_hw_design [hsi::current_hw_design]
}

...

Code Block
languagec#
titlebuild_pmufw
pmufw:
	$(RM) -r zynqmp_pmufw
	$(TOOLS)/$(VERSION)/bin/xsct -eval "source xsct_script.tcl; pmufw"

If users want to make modifications to the PMUFW then they can do this in the embeddedsw/lib/sw_apps/zynqmp_pmufw/src. Or, if a valid patch then apply this to embeddedsw

Build ATF


Code Block
languagec#
titleatf
atf:
	$(MAKE) -C arm-trusted-firmware clean
	source $(TOOLS)/$(VERSION)/settings64.sh; \
	export CROSS_COMPILE=aarch64-none-elf-; \
	cd arm-trusted-firmware; \
	$(MAKE) -f Makefile DEBUG=0 RESET_TO_BL31=1 PLAT=zynqmp bl31

Note: If users want to debug (ie use the symbols) the ATF in Vitis, then set the DEBUG=1. This will place the ATF in DDR at 0x1000. For more info see the ATF wiki here

Build u-boot


Code Block
languagec#
titleu-boot
uboot:
	$(MAKE) -C u-boot-xlnx clean
	source $(TOOLS)/$(VERSION)/settings64.sh; \
	export CROSS_COMPILE=aarch64-linux-gnu-; \
	export ARCH=aarch64; \
	export CC=aarch64-linux-gnu-gcc; \
	export PATH=$$PATH:$(shell pwd)/dtc; \
	cd u-boot-xlnx; \
	$(MAKE) xilinx_zynqmp_virt_defconfig; \
	$(MAKE) -f Makefile all -j 32

...

Code Block
languagec#
titlekernel
kernel:
	$(MAKE) -C linux-xlnx clean
	source $(TOOLS)/$(VERSION)/settings64.sh; \
	export CROSS_COMPILE=aarch64-linux-gnu-; \
	export ARCH=arm64; \
	export CC=aarch64-linux-gnu-gcc; \
	cd linux-xlnx; \
	$(MAKE) -f Makefile xilinx_zynqmp_defconfig; \
	$(MAKE) -f Makefile all -j 32; \
	$(MAKE) -f Makefile modules_install INSTALL_MOD_PATH=.


Build device-tree

  • Create a xsct_script.tcl file with the following contents:
Code Block
themeMidnight
proc build_dts {args} {
	set board 0
	set version 2020.2
	for {set i 0} {$i < [llength $args]} {incr i} {
		if {[lindex $args $i] == "-board"} {
			set board [string tolower [lindex $args [expr {$i + 1}]]] 
		}
		if {[lindex $args $i] == "-version"} {
			set version [string toupper [lindex $args [expr {$i + 1}]]] 
		}
	}
    	set xsa [glob -nocomplain -directory [pwd] -type f *.xsa]
    	hsi::open_hw_design $xsa
    	hsi::set_repo_path ./repo
    	hsi::create_sw_design device-tree -os device_tree -proc psu_cortexa53_0
    	hsi::generate_target -dir my_dts
    	hsi::close_hw_design [hsi::current_hw_design]
    	if {$board != 0} {
			foreach lib [glob -nocomplain -directory repo/my_dtg/device-tree-xlnx/device_tree/data/kernel_dtsi/${version}/include/dt-bindings -type d *] {
				if {![file exists my_dts/include/dt-bindings/[file tail $lib]]} {
					file copy -force $lib my_dts/include/dt-bindings
				}
			}
			set dtsi_files [glob -nocomplain -directory repo/my_dtg/device-tree-xlnx/device_tree/data/kernel_dtsi/${version}/BOARD -type f *${board}*]
			if {[llength $dtsi_files] != 0} {
				file copy -force [lindex $dtsi_files end] my_dts
				set fileId [open my_dts/system-user.dtsi "w"]
				puts $fileId "/include/ \"[file tail [lindex $dtsi_files end]]\""
				puts $fileId "/ {"
				puts $fileId "};"
				close $fileId
			} else {
				puts "Info: Board file: $board is not found and will not be added to the system-top.dts"
			}
		}
}

...