Skip to content
This repository was archived by the owner on Jan 16, 2023. It is now read-only.

Device Tree

johFeldmann edited this page Oct 10, 2017 · 1 revision

Prerequisites

  • Git repository cloned with --recursive

Configuration

Setup the Device Tree Compiler on the cross-compile platform

To create a link to the device tree compiler, execute the following commands inside 'kernel/linux_xlnx/':

make ARCH=arm scripts
sudo ln -s scripts/dtc/dtc /usr/bin/dtc

Setup the Device Tree Compiler on the zynqberry

This is very helpful if you want to play with device tree overlays. To create a link to the device tree compiler, execute the following commands inside '/usr/src/linux/':

make scripts
ln -s /usr/src/linux/scripts/dtc/dtc /usr/bin/dtc

Compile the device tree

Execute the following command inside 'device-tree':

dtc -@ -I dts -O dtb -o zynq-zynqberry.dtb zynq-zynqberry.dts

The flag '-@' is needed, that all symbols (e.g. intc) are also exported. The device tree blob will be about 30% larger but you can use these symbols inside your device tree overlays. That makes your life much easier.

Using device tree overlays

Compile an overlay

Device tree overlays get a slightly different extension, but that's it:

dtc -@ -I dts -O dtb -o <dto>.dtbo <dto>.dts

Create a folder for the device tree overlay

To be able to apply the device tree overlay, you need to create a folder in the device tree configuration:

mkdir /config/device-tree/overlays/<name>

Apply the overlay

Copy your overlay inside the new created folder

cp <dto>.dts /config/device-tree/overlays/<name>/dtbo

After that check its status

cat /config/device-tree/overlays/<name>/status

It should return 'applied'. Otherwise you can check the kernel log file for more information:

tail -n 20 /var/log/kern.log

Remove an applied overlay

Attention: Overlays work like a stack! Remove them in the reverse order. To remove an overlay delete the folder:

rmdir /config/device-tree/overlays/<name>

Useful hints

Print current device tree in human readable form:

dtc -I fs /proc/device-tree
Clone this wiki locally