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.

1

1 Answer

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.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like