OpenWrt Forum Archive

Topic: Modify device tree blob on the fly

The content of this topic has been archived on 19 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I would like to be able to modify my .dtb file on a running OpenWrt system.
In buildroot, I could access my .dtb file in /boot. So, I could replace it and reboot. There is no such directory in Openwrt.

Where does OpenWrt store the kernel image and device tree blob?
How can I modify it?

The kernel is a compressed blob in flash as the first part of the firmware partition.  It is not part of a filesystem.  The bootloader uncompresses the whole kernel out of flash into RAM then jumps into it.
It is not practical to modify at run time.

(Last edited by mk24 on 14 Jun 2017, 18:07)

zaxter wrote:

I would like to be able to modify my .dtb file on a running OpenWrt system.
In buildroot, I could access my .dtb file in /boot. So, I could replace it and reboot. There is no such directory in Openwrt.

Please read
Documentation/devicetree/overlay-notes.txt

zaxter wrote:

Where does OpenWrt store the kernel image and device tree blob?
How can I modify it?

IIRC
it depends on ARCH
On ARM the dtb can be added (*) after bzImage which can also include initramfs. After this you can use mkimage can create an u-Image-
So the bzImage (with initramfs) on all subtargets are the same.

On MIPS there some some similar logic with a magic number, because the scheme as on ARM is not upstream (last time I read this code)

(*)
ARM_APPENDED_DTB
hmm for MIPS  so there is append dtb ??
MIPS_NO_APPENDED_DTB

The discussion might have continued from here.