Device Tree Overview
Device Tree Overview
Board File
Single Kernel
Single Defconfig used
Must contain conditional code if
single image supports multiple
boards
Device Tree Approach
U-boot remains unchanged.
U-BOOT U-boot can contain conditional code to
determine which dtb file to pass
Single Kernel
Single Defconfig used
KERNEL
Board specific code removed from
kernel code
Three Ways to build DTB Files
• Using device tree compiler built from sources (git)
• Using device tree compiler built from sources
(kernel)
• Using the kernel’s makefile (ARM only)
Using device tree compiler built from
sources (git)
• Compile dtc
For Ubuntu Install: bison and flex
git clone git://jdl.com/software/dtc.git
cd dtc
make dtc
• Generate dtb
– dtc -I dts -O dtb -o <devicetree name>.dtb <devicetree
name>.dts
Using device tree compiler built from
sources (kernel)
• Compile dtc:
cd <3.8+ kernel sources>
make ARCH=arm omap2plus_defconfig
make ARCH=arm scripts
• Generate dtb
– scripts/dtc/dtc -I dts -O dtb -o <devicetree name>.dtb
<devicetree name>.dts
Using device tree compiler built from
sources
• Building manually can be tricky.
• DTC version used will need to be upgraded to
match latest version used in the kernel (git
method)
• 3.11 kernel introduced C code in the DTS file for
am335x.
• AM335x DTS therefore must be ran through the C
preprocessor first along with various include files
from the kernel.
Using the kernel’s makefile (ARM only)
• Two Options:
– make ARCH=ARM dtbs
• Builds all dtbs
• Generated dtbs can be found at arch/arm/boot/dts
– make ARCH=ARM <devicetree name>.dtb
• Builds <devicetree name>.dtb
• Generate dtb can be found at arch/arm/boot/dts
• Can list multiple dtbs to build more than one dtb
• Ex: make ARCH=ARM am335x-bone.dtb am335x-evm.dtb
Comments
Pin configuration
C defines used to improve readability
DT child node name <kernel sources>/include/dt-bindings/pinctrl/am33xx.h
DT node name
Configure pinmux defined
by i2c0_pins node
PMIC driver
This driver communicates to the PMIC
via i2c bus 0 which is why this driver
is a child of the i2c0 instance.