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.
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
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 .
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)
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.