Page MenuHomeFreeBSD

Allow Raspberry Pi platform code and drivers to be configured with upstream DTBs

Authored by on Sep 13 2017, 4:10 PM.


  • Added more compatibility strings to drivers not yet ported
  • Added new RPI platform code compatibility string to match the ones used upstream
  • Adapted RPI and RPI2 DTS to match the new platform code compatibility string

The goal of these changes are to be able to use the upstream DTBs as a replacement for our custom one. This is now possible with these changes.

Additionally, as the RPI firmware automatically chooses the right DTB for us, this would allow to have one common armv6 kernel for RPI0 and RPI1 (BCM2835-based), and one common armv7 kernel for RPI2 v1.1 (BCM2836-based), and RPI2 v1.2 / RPI3 (BCM2837-based).

Test Plan

Do something like this to get the latest firmware and DTBs:

files="bootcode.bin fixup.dat start.elf fixup_cd.dat start_cd.elf bcm2708-rpi-b.dtb bcm2708-rpi-b-plus.dtb bcm2709-rpi-2-b.dtb bcm2710-rpi-3-b.dtb overlays/pi3-disable-bt.dtbo overlays/mmc.dtbo"
mkdir fat/overlays
for f in $files
   fetch -o "fat/$f" "$firmware_commit/boot/$f"

Copy kernel.bin to kernel7.img on the fat partition for RPI2/3, or kernel.img for a RPI0/1.

Write this in config.txt:


Boot your PI.

Diff Detail

rS FreeBSD src repository - subversion
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

When uploading a diff through the website can you include context. There are commands you can use at

136 ↗(On Diff #33027)

You should keep the old compat string here to allow for people to use an old DTB with a new kernel. For this you can use FDT_PLATFORM_DEF2. You can see imx6_machdep.c for an example on using it.

152 ↗(On Diff #33027)

And here.

Use two FDT_PLATFORM_DEF2 directives instead of changing the FDT_PLATFORM_DEF one to allow compatibility with previous compatibility strings.

136 ↗(On Diff #33029)

There is an extra argument in FDT_PLATFORM_DEF2 to add the variable name to use. marked 2 inline comments as done.

Fixed previous patch which misused the FDT_PLATFORM_DEF2 macro. retitled this revision from Allow our Raspberry Pi platform code and drivers to be configured with upstream DTBs to Allow Raspberry Pi platform code and drivers to be configured with upstream DTBs. edited the summary of this revision. (Show Details)

Fix indentation of compat_data in RNG driver. marked an inline comment as done.

Fix indentation (use tabs instead of spaces) of compat_data per style(9)

This revision is now accepted and ready to land.Oct 2 2017, 12:25 AM
This revision was automatically updated to reflect the committed changes.