[ath79] Suppose I want to bring my own .dtb file?

I have several TP-Link and other ar71xx devices which I have swapped to larger flash and RAM chips. These were working with release ar71xx builds due to its use of mktplinkparts.c which dynamically partitions the flash.

Going to ath79 breaks this though, since the flash size and partitioning is now hard-coded in the .dts file.

What I would like to have is some way for me to place the .dts data of my Frankenstein hardware somewhere permanently in flash and then have a release build of OpenWrt able to find it, so a simple sysupgrade to a released build will run properly.

In ARM devices the bootloader sends the kernel a pointer to the .dtb block. This of course requires the bootloader to have some support of the .dtb system. I could probably add that to the pepe2k custom bootloaders.

Another approach could be to place the .dtb in a known location in flash, like unused space of the ART partition. After bringing up the flash driver and establishing chip size (since the ART is always the last block in the chip), the kernel could find it directly.

I don't yet know my way around the OpenWrt source code to decide how practical either of these would be. It appears that all the ath79 builds use an appended dtb now, so they are model specific firmwares.

1 Like

I don't think diverging even more from the expected vanilla OEM devices would help here. Especially given that most devices we're talking about (in their OEM state) don't have any idea of device tree to begin with, being based on an ancient vendor fork of u-boot 1.1.4.

But there are two relatively easy approaches here:

  • keeping a local patch to change the DTB for your devices
  • keeping a local patch to add a private variant of your devices in addition to the unmodified ones
    both have advantages (patching the existing DTB is more likely to notice changes) and disadvantages (adding a second variant is more work and has some danger of missing generic changes in the DTB), but both are relatively easy to get working.
1 Like

For a "variant" device that I'm working with, I #include <original device>.dts then just override what I need to. There's more with making sure that the "new" device is present in the targets, has the proper first-boot and preinit initialization, and that the DTB is generated. At least the DTS part is straightforward, and will "adopt" any changes to the underlying target.