6

Opdenacker: Using Device Tree Overlays, example on BeagleBone boards

 2 years ago
source link: https://lwn.net/Articles/884864/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Opdenacker: Using Device Tree Overlays, example on BeagleBone boards

[Posted February 15, 2022 by jake]

Over on the Bootlin blog, Michael Opdenacker has an introduction to using device tree overlays to support changes to the standard device tree definition for a particular system-on-chip (SoC). This allows users to add new hardware or modify the hardware configuration for their system relatively easily—and without recompiling the kernel or the full device tree source files.

For a given CPU architecture (ARM, PowerPC, etc), such a description allows to have a unique kernel supporting many different systems with distinct Systems on a Chip. The compiled Device Tree (DTB: Device Tree Binary), passed to the kernel by the bootloader at boot time, lets the kernel know which SoC and devices to initialize. Therefore, when you create a new board, and want to use a standard GNU/Linux distribution on it, all you have to do is create a new Device Tree describing your new hardware, compile it, and boot the distribution’s kernel with it. You don’t need to recompile that kernel, at least when it supports your SoC and the devices on your board.

[...] However, this is still an inconvenient solution. Any time you plug in a new device or an expansion board, or want to tweak other settings, you have to rebuild and update the full Device Tree for your board. What if you could prepare Device Tree fragments for each change to make, compile them once for all, and then, when you boot your device, load the main Device Tree and only the fragments you need, without having anything else to recompile?


(Log in to post comments)

Opdenacker: Using Device Tree Overlays, example on BeagleBone boards

Posted Feb 15, 2022 20:31 UTC (Tue) by martin.langhoff (subscriber, #61417) [Link]

We had a very nice way of playing with the DT on OLPC laptops from OpenFirmware – https://wiki.laptop.org/go/Device_Tree_Hacking

And I am pretty sure we had something wired up in the initramfs so we could load a DT overlay from a file in Linux. You'd put in in your /boot partition. But can't find the docs right now.

Opdenacker: Using Device Tree Overlays, example on BeagleBone boards

Posted Feb 16, 2022 9:12 UTC (Wed) by michaelo (subscriber, #23907) [Link]

The article is available on BeagleBoard.org's blog too:
https://beagleboard.org/blog/2022-02-15-using-device-tree...

Your comments are welcome there too.

Opdenacker: Using Device Tree Overlays, example on BeagleBone boards

Posted Feb 16, 2022 10:17 UTC (Wed) by pbonzini (✭ supporter ✭, #60935) [Link]

Isn't this what you do in Raspberry Pi's config.txt with just (for example) "dtoverlay=i2c-rtc,pcf85063"? It would be nice to have support for something similarly easy in the distros' U-Boot scripts.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK