tparys Posted April 25, 2021 Posted April 25, 2021 So, I've been doing some reading, and found this ... https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/overlay-notes.rst 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.
jeanrhum Posted April 26, 2021 Posted April 26, 2021 Nice possibilities, have you tried something? What are the requirements to do that (kernel version, patchset...)? ps: a more readable version of your link (even if rst is not too bad): https://www.kernel.org/doc/html/latest/devicetree/overlay-notes.html
tparys Posted April 27, 2021 Author Posted April 27, 2021 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.
Recommended Posts