adding fdt-overlay function - help needed

Hi,
i try to get overlay-merging working in uboot (for OF_UPSTREAM conversion), but failing on missing Makefile knowledge
i have the state now, that upstream dtso get compiled to dtbo files (that needed further changes).
now i added this from linux-tree:
#merge CONFIG_DEFAULT_DEVICE_TREE + OF_OVERLAY_LIST_BASEDT to target DTB #manual: # dtc -I dtb -O dts dts/upstream/src/arm64/mediatek/mt7986a-bananapi-bpi-r3-sd.dtbo # fdtoverlay -i dts/upstream/src/arm64/mediatek/mt7986a-bananapi-bpi-r3.dtb -o dts/upstream/src/arm64/mediatek/mt7986a-bananapi-bpi-r3-sd.dtb dts/upstream/src/arm64/mediatek/mt7986a-bananapi-bpi-r3-sd.dtbo # dtc -I dtb -O dts dts/upstream/src/arm64/mediatek/mt7986a-bananapi-bpi-r3-sd.dtb | less
#currently linux-version quiet_cmd_fdtoverlay = DTOVL $@ cmd_fdtoverlay = $(objtree)/scripts/dtc/fdtoverlay -o $@ -i $(real-prereqs)
$(multi-dtb-y): FORCE $(call if_changed,fdtoverlay) $(call multi_depend, $(multi-dtb-y), .dtb, -dtbs)
and created an config-option CONFIG_OF_OVERLAY_LIST_BASEDT which holds a space separated list of the dtbo-files without path, in my test
CONFIG_DEFAULT_DEVICE_TREE="mediatek/mt7986a-bananapi-bpi-r3" CONFIG_OF_OVERLAY_LIST_BASEDT="mt7986a-bananapi-bpi-r3-nand.dtbo mt7986a-bananapi-bpi-r3-nor.dtbo mt7986a-bananapi-bpi-r3-sd.dtbo"
i now want the list passed to the quiet_cmd_fdtoverlay which should handle each item and add the dtbo to a base-devicetree (like in comments above)....
maybe anyone here can help getting this to work?
if my source is needed: https://github.com/frank-w/u-boot/commits/2024-07-bpi-ofupstream-all/
regards Frank

Hi,
i got a bit further and noticed, that required command is not available in uboot...this is normally part of the dtc package [1], so why is it missing in u-boot? I guess later added or dropped to reduce compile time/make porting easier...
regards Frank
https://github.com/qemu/dtc/blob/master/fdtoverlay.c
Gesendet: Mittwoch, 10. Juli 2024 um 17:35 Uhr Von: "Frank Wunderlich" frank-w@public-files.de An: u-boot@lists.denx.de, "Tom Rini" trini@konsulko.com Betreff: adding fdt-overlay function - help needed
Hi,
i try to get overlay-merging working in uboot (for OF_UPSTREAM conversion), but failing on missing Makefile knowledge
i have the state now, that upstream dtso get compiled to dtbo files (that needed further changes).
now i added this from linux-tree:
#merge CONFIG_DEFAULT_DEVICE_TREE + OF_OVERLAY_LIST_BASEDT to target DTB #manual: # dtc -I dtb -O dts dts/upstream/src/arm64/mediatek/mt7986a-bananapi-bpi-r3-sd.dtbo # fdtoverlay -i dts/upstream/src/arm64/mediatek/mt7986a-bananapi-bpi-r3.dtb -o dts/upstream/src/arm64/mediatek/mt7986a-bananapi-bpi-r3-sd.dtb dts/upstream/src/arm64/mediatek/mt7986a-bananapi-bpi-r3-sd.dtbo # dtc -I dtb -O dts dts/upstream/src/arm64/mediatek/mt7986a-bananapi-bpi-r3-sd.dtb | less
#currently linux-version quiet_cmd_fdtoverlay = DTOVL $@ cmd_fdtoverlay = $(objtree)/scripts/dtc/fdtoverlay -o $@ -i $(real-prereqs)
$(multi-dtb-y): FORCE $(call if_changed,fdtoverlay) $(call multi_depend, $(multi-dtb-y), .dtb, -dtbs)
and created an config-option CONFIG_OF_OVERLAY_LIST_BASEDT which holds a space separated list of the dtbo-files without path, in my test
CONFIG_DEFAULT_DEVICE_TREE="mediatek/mt7986a-bananapi-bpi-r3" CONFIG_OF_OVERLAY_LIST_BASEDT="mt7986a-bananapi-bpi-r3-nand.dtbo mt7986a-bananapi-bpi-r3-nor.dtbo mt7986a-bananapi-bpi-r3-sd.dtbo"
i now want the list passed to the quiet_cmd_fdtoverlay which should handle each item and add the dtbo to a base-devicetree (like in comments above)....
maybe anyone here can help getting this to work?
if my source is needed: https://github.com/frank-w/u-boot/commits/2024-07-bpi-ofupstream-all/
regards Frank

On Thu, Jul 11, 2024 at 01:23:32PM +0200, Frank Wunderlich wrote:
Hi,
i got a bit further and noticed, that required command is not available in uboot...this is normally part of the dtc package [1], so why is it missing in u-boot? I guess later added or dropped to reduce compile time/make porting easier...
regards Frank
We're behind on re-syncing with the kernel's version of dtc, yes. It might be easiest to just cherry-pick what you need for now?

Am 12. Juli 2024 18:49:02 MESZ schrieb Tom Rini trini@konsulko.com:
On Thu, Jul 11, 2024 at 01:23:32PM +0200, Frank Wunderlich wrote:
Hi,
i got a bit further and noticed, that required command is not available in uboot...this is normally part of the dtc package [1], so why is it missing in u-boot? I guess later added or dropped to reduce compile time/make porting easier...
regards Frank
We're behind on re-syncing with the kernel's version of dtc, yes. It might be easiest to just cherry-pick what you need for now?
I tried multiple things but the only thing worked so far was copying all c/h from linux and modifying makefile to build fdtoverlay binary
https://github.com/frank-w/u-boot/commit/d01e15acecd4dcf1584e4601c543231d5dbb6379
But i have the buildchain not so far that the merging itself works (seems to need targets for dtbo we have not in linux),but fdtoverlay itself is built without errors.
The repo i linked before seems to be completely incompatible with the dtc/fdtutils from uboot/linux (missing constants and some more).
If i have it running completely i can replace my testcommit with the cherry-pick from linux to preserve author-information,but first the merging needs to work. regards Frank
participants (2)
-
Frank Wunderlich
-
Tom Rini