1

With all the raspberry pi hats popping on and off, dtoverlay and /boot/config.txt is a very nice method to quickly tell the kernel that you've got new device tree information.

But I've never seen this implemented on any other linux platforms, embedded or not.

Is this something any Linux OS can do (maybe if it's built with a special config enabled?) or was this something specially coded up for the RPi? I'd like to enable this feature on other platforms.

4

dtoverlay and /boot/config.txt is a very nice method to quickly tell the kernel that you've got new device tree information.

Worth making explicit that config.txt is not accessed by the kernel at all, it's used by the boot firmware, and presumably much of the information there is used directly to configure the hardware, the state of which the kernel receives when it is started.

The device tree overlays, however, are passed to it as data (based on what's in config.txt), since these are a linux thing -- .dtb and .dtbo files are compiled from .dts files, as you are likely aware -- but based on this, it looks to me like they are not unique to it and are part of the independent Open Firmware standard.

If you are curious about exactly how the bootloader shares this information with the kernel, I'd start with the "Entry point for arch/arm" section here.

Interestingly that wikipedia article mentions (under "Usage in Linux"):

that on ARM, device trees have been mandatory for all new SoCs since 2012

Which is about when the Pi started to get going. As far as I can recall though, the presence of compiled device tree files and the ability to select amongst them was not part of the original implementation and appeared a few years later (but I could be misremembering that).

3

Device Tree is a data structure for describing hardware.

Rather than hard coding every detail of a device into an operating system, many aspects of the hardware can be described in a data structure that is passed to the operating system at boot time.

In the past kernel modules were compiled into the kernel, but this is rather restrictive.

Initially (Wheezy) used the traditional approach, but hardware support has been progressively moved to Device Tree. It is certainly NOT Pi specific.

An OS can supply many Loadable Kernel Modules to provide support for a wide range of hardware which are loaded on demand.
This can be done explicitly (configured by user), but Device Tree provides a mechanism to load at boot time, and usually configures hardware to match (the Pi peripherals allow most GPIO pins to be configured in any of 8 different modes).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.