Search code examples
linux-kernelraspberry-piu-bootdevice-tree

How does the raspbery pi know which device tree blob (dtb) to load?


A raspberry pi card images includes several different dtb files in the boot partition. For example:

bcm2708-rpi-0-w.dtb
bcm2708-rpi-b.dtb
bcm2708-rpi-b-plus.dtb
bcm2708-rpi-cm.dtb
bcm2709-rpi-2-b.dtb
bcm2710-rpi-3-b.dtb
bcm2710-rpi-3-b-plus.dtb
bcm2710-rpi-cm3.dtb

When the pi boots, how does it know when dtb to select?


Solution

  • In U-Boot file board/raspberrypi/rpi/rpi.c, function get_board_rev() the board revision is read and the dtb name is determined from the revision. The dtb file name is set in the environment variable ftdfile which can be used in a boot script to load the appropriate file which then is passed on to the operating system.