Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux kernel dtb vs dtbo

I am developing a device driver for a device.I wanted to know besides writing the device driver what and when it is necessary for it - a device tree blob (dtb) or a device tree overlay (dtbo).

Is it possible to dynamically insert the dtb (after compiling it using dtc compiler) and test the driver(dynamically loadable) .

For statically building dtb is there any Kconfig for the dtb files which I have to take care of apart from the device driver's Kconfig.

like image 724
Raulp Avatar asked Mar 17 '26 08:03

Raulp


1 Answers

You don't mention what platform this is, but I'm assuming it is one of the architectures that extensively uses devicetrees for HW description e.g. ARM, PPC and that you actually need devicetree.

Device tree overlays require support from userspace, in the form of a overlay manager that knows what overlays to load at runtime. Unless your device is in a very dynamic environment where it might go away, for most cases, you want a simple hardcoded device tree.

After writing your driver, you need to define the compatible property to tell the kernel when to load this driver and then add a node to the devicetree (.dts/.dtsi) file under arch/<foo>/boot/dts/*/* that best describes your board.

e.g. See this compatible registration and the corresponding HW description in a bunch of devicetrees 1,2,3 that are SoC-specific. This one driver works on all those SoC by quirking SoC-specific fucntionality behind compatible flags.

like image 129
idlethread Avatar answered Mar 20 '26 09:03

idlethread



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!