Dynamic Device Tree Overlays



Recommended Posts

So, I've been doing some reading, and found this ...




Looks like a mechanism to dynamically load or unload device tree overlays live. Really the only change is that .dtbo files need to be compiled with symbols (-@) like this:


dtc -@ -o myoverlay.dtbo myoverlay.dts


And then you can load/unload those overlays after (or during) boot by doing something like this:


# Creates the dynamic overlay
mkdir /sys/kernel/config/device-tree/overlays/myoverlay

# Load the dynamic overlay
cat myoverlay.dtbo > /sys/kernel/config/device-tree/overlays/myoverlay/dtbo

# Unload the dynamic overlay
rmdir /sys/kernel/config/device-tree/overlays/fan/


Which got me thinking. Given that not all board support DTB overlays within u-boot, and u-boot support is generally all over the place, would it make more sense to do DTB overlay support in-kernel and not worry about what u-boot implementations support it or no?


Heck armbian-config could potentially load/unload DTB overlays then and there without a reboot.


Link to post
Share on other sites

Donate and support the project!

For experimentation, I loaded the DTS patch I posted HERE, basically adding a PWM fan object to the DTB and hooking it up as a thermal zone cooling device on my M4V2.


Not sure if there's any particular requirements. It's part of the configfs, so I suppose that needs to be in the kernel build? Not sure if there's any particular version requirements.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.