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#
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 xsaboard [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]
}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
		}
	}
}

If there is a valid board found, then it will added to dtsi files. Then we can call this from our Makefile:

Code Block
languagec#
titledts
build_dts:
	$(RM) -r my_dts
	$(TOOLS)/$(VERSION)/bin/xsct -eval "source xsct_script.tcl; build_dts -version $(VERSION) -board $(BOARD)"


Users can make changes to their DeviceTree in my_dts/system-top.dts. For example, since I am using the ZCU102. I will add the PHY.
Do do this, open my_dts/system-top.dts and update the gem3 node, by appending the content below:
Code Block
themeMidnight
&gem3 {
             status = "okay";
             local-mac-address = [00 0a 35 00 02 90];
             phy-mode = "rgmii-id";
             phy-handle = <&phy0>;
             phy0: phy@c {
                         reg = <0xc>;
                         ti,rx-internal-delay = <0x8>;
                         ti,tx-internal-delay = <0xa>;
                         ti,fifo-depth = <0x1>;
             };
};

Users can also add the dtsi here to my_dts directory, and include this into the DT structure. For a quick guide on Devicetree debugging, see the wiki here

Compile the devicetree (DTB)


Code Block
languagec#
titledtb
build_dtb:
	$(RM) -r system.dtb
	export PATH=$$PATH:$(shell pwd)/dtc; \
	gcc -I my_dts -E -nostdinc -undef -D__DTS__ -x assembler-with-cpp -o my_dts/system-top.dts.tmp my_dts/system-top.dts; \
	dtc -I dts -O dtb -o system.dtb my_dts/system-top.dts.tmp


Create SD image


Create the BIF file with the contents below:
Code Block
themeMidnight
the_ROM_image:
{
	[fsbl_config] a53_x64
	[bootloader, destination_cpu=a53-0] zynqmp_fsbl/executable.elf
	[pmufw_image] zynqmp_pmufw/executable.elf
	[destination_device=pl] design_1_wrapper.bit
	[destination_cpu=a53-0, load=0x00100000] system.dtb
	[destination_cpu=a53-0,exception_level=el-3,trustzone] arm-trusted-firmware/build/zynqmp/release/bl31/bl31.elf
	[destination_cpu=a53-0,exception_level=el-2] u-boot-xlnx/u-boot.elf
}


Then in bootgen command from your Makefile

...