Device Trees: Hardware Description Language

Linux From Scratch · 3:43

Listen on 93

Lyrics

[Verse 1]
When the kernel boots up on your ARM machine
It needs to know what hardware it can see
No more hardcoded addresses in the code
Device trees show the way, the proper road
A text file describes your system's parts
Memory maps and interrupts, where everything starts

[Chorus]
Device tree source, D-T-S file
Describes the hardware with structured style
Nodes and properties, parent and child
Compatible strings make drivers bind
Device tree source, hardware's guide
Kernel discovery simplified

[Verse 2]
Start with the root node, slash is the name
Memory and chosen nodes stake their claim
CPU information, cores and cache
Clock frequencies, timing in place
Each device gets a node with address
Properties define how drivers access

[Chorus]
Device tree source, D-T-S file
Describes the hardware with structured style
Nodes and properties, parent and child
Compatible strings make drivers bind
Device tree source, hardware's guide
Kernel discovery simplified

[Bridge]
Compile with D-T-C, device tree compiler
Binary blob for bootloader supplier
U-Boot passes it to the kernel space
Platform device creation takes place
No more board files, configuration clean
Generic kernels, hardware unseen

[Verse 3]
GPIO controllers, SPI and I-two-C
UART and timers, all defined precisely
Interrupt numbers, register ranges
When hardware changes, just the tree changes
Pinmux settings, power domains too
Device tree tells the kernel what to do

[Chorus]
Device tree source, D-T-S file
Describes the hardware with structured style
Nodes and properties, parent and child
Compatible strings make drivers bind
Device tree source, hardware's guide
Kernel discovery simplified

[Outro]
From source to binary, hardware described
Driver binding automated, perfectly timed
Device tree magic, ARM's modern way
Full-stack engineers use it every day

← Init Systems and Boot Process | Writing Your First Kernel Module →