Linus Torvalds was sad and mad. ARM was making Linus sad and mad. There were too many cooks, too many ingredients, too many new hardware variations in the world of ARM devices. The architecture had become so popular in the embedded computing world that a thicket of third-party devices were being cooked up to work with ARM. Custom hardware drivers and custom kernels were everywhere. This was making the Linux kernel playground increasingly chaotic.
So, Linus roared: go back to the kitchen, cooks, and make a better recipe! So, they did. Or, so the story goes. Thus was born Device Tree....
For beginners, Device Tree can be a bit difficult to wrap one's head around. However, in order to use BeagleBone Black in more interesting projects, an understanding is often critical. Basically, Device Tree is a data structure to describe the hardware that you add on to your board. With Device Tree, the details of a device are available to the board without needing to be hardcoded into the kernel. Prior to its existence, the kernel image—the single binary (vmlinuz
) that we looked at earlier in the chapter—contained any description needed for the hardware. Beginning with version 3.8 of the Linux kernel for ARM, however, another binary was loaded at boot along with the kernel, Device Tree Blob (DTB).
BeagleBone Black—with its 3.8 kernel (the shipping version, at least)—is one of the first ARM devices to incorporate the new order of things with Device Tree (DT). Its benefits for the BBB are many:
To reiterate, Device Tree is a binary that describes the system hardware and loads at boot time. Its "tree" nomenclature refers to the fact that it is written in a hierarchical node or tree data structure. The nodes describe the physical device in the system.
The Device Tree overlay
Device Tree is what is used by the kernel during bootup and is common to all modern ARM devices. On BeagleBone Black and its earlier cousins, Device Tree also comes accompanied with a kind of "patch" or overlay. Applied at runtime, Device Tree overlay helps reconfigure hardware resources on the board, such as capes, GPIO pins, LCDs, and so on, and is handled by bone-capemgr (the cape manager).
Although we will do a recipe on the Device Tree overlay (dtbo
) in a later section, it might be helpful to browse the following directory to take a look at many of the dtbo
files that come with the firmware:
# cd /lib/firmware # ls -l
The sample output looks like this:
-rw-r--r-- 1 root root 1056 Apr 23 16:57 BB-ADC-00A0.dtbo -rw-r--r-- 1 root root 2885 Apr 23 16:57 BB-BONE-AUDI-01-00A0.dtbo -rw-r--r-- 1 root root 2288 May 18 2014 BB-BONE-AUDI-02-00A0.dtbo -rw-r--r-- 1 root root 2583 May 18 2014 BB-BONE-AUDI-02-00A0.dts -rw-r--r-- 1 root root 4273 Apr 23 16:57 BB-BONE-BACON-00A0.dtbo -rw-r--r-- 1 root root 3259 Apr 23 16:57 BB-BONE-BACONE-00A0.dtbo -rw-r--r-- 1 root root 4536 Apr 23 16:57 BB-BONE-BACONE2-00A0.dtbo -rw-r--r-- 1 root root 3592 Apr 23 16:57 BB-BONE-CAM-VVDN-00A0.dtbo
Here are a few other key things to keep in mind about Device Tree and the BBB:
18.116.36.192