...
In a general Yocto development, the ASSP on a target board is fixed and the kernel tree provides the device tree blob (dtb
). The device tree can be customized by simply patching the dts
in the kernel tree if needed. In fabric-based devices such as Zynq and Zynq Ultrascale+, the IP targeting the fabric is customized during the design. Because the IP in the PL changes per design, the developer needs a way to generate the device tree for the PL at design time. The Xilinx Device Tree Generator (DTG), can parse a hardware description (HDF) and automatically generate dts
for your design. Because this dts
is regenerated every time you make changes to your PL design, it's difficult to just patch the dts
. This wiki shows how to append the device-tree recipe to add a custom dtsi
that can override device properties or add new nodes that are board specific. The examples shown are for a the ZCU102 -based designplatform.
Device Tree Recipe
The meta-xilinx
layer includes the device-tree.bb
recipe which provides baseline support for machines that are not included in the kernel tree, such as MicroBlaze and Zed boards. The meta-xilinx-tools
layer extends this recipe , with a device-tree.bbappend
, to to support the DTG. With the The DTG, Yocto can generate a custom device tree for your design. However, however, it is still missing board specific device nodes for your target. By further extending the device-tree, you can include a user dtsi
which can customize the device tree by overriding properties, adding new properties or adding new device nodes. The device-tree.bbappend
listing below provides a simple method for customizing your device tree. You are responsible for writing the system-user.dtsi
and placing it in the files
directory.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
FILESEXTRAPATHS_prepend := "${THISDIR}/files:" SYSTEM_USER_DTSI ?= "system-user.dtsi" SRC_URI_append = " \ file://${SYSTEM_USER_DTSI} \ " do_configure_append() { cp ${WORKDIR}/${SYSTEM_USER_DTSI} ${B}/device-tree echo "/include/ \"${SYSTEM_USER_DTSI}\"" >> ${B}/device-tree/system-top.dts } |
Inside the files
directory you You can place your actual system-user.dtsi
or you can just place a dummy system-user.dtsi
and in the files
directory. You may also control the actual system-user.dtsi
from your machine configuration as shown in the example-zcu102-zynqmp
listing below. This way if you don't need a system-user.dtsi
, the build will still succeed thanks to the dummy dtsi
,.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
/* system-user.dtsi */ |
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
SYSTEM_USER_DTSI = "/<path-to-actual>to>/system-user.dtsi" |
Add Existing BSP
...
The deploy listings below shows the dtb
from a zcu102-based build. You may notice multiple deployed dtb
from your build. In the first listing, there are three dtb
files, but note two of them are simply links to the actual dtb
. These The dtb
are is generated from the kernel-devicetree
class. This is the same dtb
that would be generated from the kernel tree. So this is a fully functional dtb
, but it does not include any device tree nodes from your PL design, This is often a good place to fallback if your kernel hangs when you load a custom device tree supporting your PL design. If your kernel boots with this dtb
, then you can assume you have a device tree issue in the PL.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
example-zcu102-zynqmp-system-<timestamp>.dtb
example-zcu102-zynqmp-system.dtb -> example-zcu102-zynqmp-system-<timestamp>.dtb |
uEnv.txt
If you are booting from an SD card and using uEnv.txt
to set your u-boot environment variables, you need to be aware that the default FDT is the kernel FDT. If you want to boot with the FDT from the DTG, then you can replace the kernel FDT with the DTG FDT in your <machine>.conf
or local.conf
.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
IMAGE_BOOT_FILES_remove = "${KERNEL_IMAGETYPE}-zynqmp-zcu102-rev1.0.dtb" IMAGE_BOOT_FILES_append = " ${MACHINE}-system.dtb" |
Device Tree Source
If you want to view the dts
that generated the dtb
, you can either look at the working directory for the device-tree
for your machine or you can reverse the dtb
with the device tree compiler (dtc
). The listing below shows the structure of the build directory for the device-tree. In the build directory you will see the system-top
device tree blob (dtb
), device tree source (dts
) and the output of the C preprocessor (pp
). Inside of the device-tree
directory you will see the individual files that makeup the final device tree.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
$ dtc -I dtb -O dts -o system.dts example-zcu102-zynqmp-system.dtb |
Related Links
Creating a Custom Xilinx Xilinx Yocto Layer
Adding an HDF to a XilinxXilinx Yocto Layer
Xilinx Yocto Builds without an Internet Connection
...