Question about how to compile and decompile DTB files for Coreelec?

Recently, I am trying to make a Coreelec firmware for a TV box (ARM architecture SOC), but there is no suitable DTB file of this TV box for Coreelec. I have only one DTB file extracted from the firmware (maybe Android 7.0) of the TV box itself.
I want to ask:
Q1: Can I decompile the DTB file into DTS file with dtc command on any Linux system (such as Ubuntu 18.04) without the environment of Coreelec or system that the DTB file was originally compiled. I tried on Ubuntu, and I got a decompiled dts file , but I can’t confirm whether it’s the correct orginal dts file?
Q2:After editing the DTS file,if I want to compile it into the DTB file for coreelec, how to compile it? Need coreelec source code ? Is it possible to compile it with just dtc command on Ubuntu 18.04?

device tree decompile

dtc -I dtb -O dts file.dtb -o file.dts

device tree compile

dtc -I dts -O dtb file.dts -o file_new.dtb

Editing such decompiled dts file is not easy - depends what you are changing.

1 Like

Thank U。
That means,a dts or dtb file has no association the linux kernel version and running environment?
If I compile a dtb file on pure Ubuntu 18.04 system (no coreelec soure code), then it can be uesd by Coreelec directly?

Yes, the DTB file is a self-contained list of definitions/configuration values.

@TheCoolest (or any other devs) - can you tell more about dtb structure, etc or is that explained anywhere else (some wiki, etc, where to start). I guess dtb used by CoreElec is not the same as /dev/dtb extracted (with dd command), from original Android firmware so far I noticed CE dtb is smaller.

Is there any way to make Android’s dtb possible to use with CE? I guess no automatic way, but where to start?