Reputation: 577
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?
Upvotes: 0
Views: 5185
Reputation:
I'm not sure the currently accepted answer is correct for Raspberry Pi OS - at least the "official documentation" explains it quite differently. It's further unclear why u-boot
was part of the answer as Raspberry Pi OS doesn't use u-boot
; and the OP didn't mention u-boot
.
I'm not "quality police", and claim no expertise in this area - this Q&A was listed in a search result, and it seemed a bit off... thus, this answer.
And finally - to an answer: These various .dtb
files contain the "hardware definitions" of the various hardware models of Raspberry Pi; you can see the model designation in the filename; e.g. bcm2710-rpi-3-b-plus.dtb
designates an RPi 3B+. The .dtb
extension is shorthand for "device tree blob/binary" - compiled from a .dts
"device tree source" file. The hardware model is detected during the boot process, and is used to select which .dtb
file to use, which in turn is used to set up the kernel. The Rpi hardware model designation may be found on any RPi as follows:
cat /proc/cpuinfo | grep Model
The "official" documentation has a much more detailed answer. The documentation also has more details on device trees in general if you're interested.
Upvotes: 3
Reputation: 2483
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.
Upvotes: 2