Extracting device tree from compiled kernel

Hi, I'm trying to build a firmware for a Netgear device, I have the compiled kernel, I want to build the .dts file, How can I extract the device tree from the compiled kernel?
I tried this code https://github.com/dianlujitao/split-appended-dtb but it didn't find it.

Thanks.

Tricky bit with appended DTB.. Maybe this one works out better https://github.com/PabloCastellano/extract-dtb

I tried it also, Doesn't openwrt developers do that all the time? Its like routine process before adding a new firmware

Not sure how common appended DTB is amongst router manufacturers' (often proprietary) firmware/bootloader. I would have thought it being a thing of the past for a transitional period when bootloader did not feature the necessary support.

Do you know what sort of bootloader the device is utilising? Are you sure that the DTB has been appended to the kernel image?

Could the manufacturer's firmware instead utilise Device Tree Overlay? In such case, to my understanding, an FDT overlay would be stored in the root filesystem https://lkml.org/lkml/2012/11/5/615

binwalk and;

2012... probably has no dtb/dts

I'm not sure that the dtb is in the kernel, the device is an old device released in 2012, CFE bootloader, cpu bcm6328

Why so? In this case what is the way to get the device tree information?

Commonly it would easy to extract the DT from a booted node with dtc -s -I fs /proc/device-tree -O dts but reckon that the dtc binary is not available from the manufacturer distro and cannot be provisioned otherwise it might be manually extractable from /proc/device-tree .


Else, wondering whether none of the DT available https://github.com/openwrt/openwrt/tree/master/target/linux/bcm63xx/dts for

suits your use case?

Thanks for your reply, do you know where the device tree is supposed to be saved statically? Without running the device?
(I'm already using openwrt bcm6328 DTS but I want to add key/led specific for the profile)

Afraid, I am not familiar with the workings of the

(likely though same partition/directory as the kernel image)

Different though with

As mentioned, it's very unlikely the manufacturer firmware used Device Tree, so you won't be able to directly steal DTS/DTB info from it.

But it's also possible there is some sort of open source release of the original kernel/drivers sources, due to GPL, so if you're only looking for a few pin or register definitions to augment the existing bcm6328 support in OpenWRT, for your specific board, you might be able to leverage these sources.

It might help if you note which exact model you're talking about.