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?

Hi, did you get anywhere with this? I have also extracted the DTB from Android and want to convert it over to use with core elec

@giaur500 With the 4.9 kernel, the DTBs for generic devices are based on the source of the original android ones. We removed some unused sections, and changed some others (such as audio related ones) to make them work properly with CE. Certain boxes, with non-standard hardware have more modification to make said hardware work.
All DTS files are located in the amlogic-4.9 branch. Our changes are an overlay over the original sources.

@eka Why would you want to do that? It will most likely not work.

Basically I am looking for a fix to a problem regarding the DTB… I have been using standard T95 S2 boxes from Amazon for a long time ( - they seemed to have recently changed something with the box though as the DTB.img that has always worked for CE with these boxes, no longer does.I thought that a new DTB file for this new version of the box will be needed to be created - but am new to device trees and unsure where to start.

There has been a “v.2” of this box also out there for a while which I get occasionally (looks identical but obviously slightly different hardware) - and this is functional with CE by using the ‘gxl_p281_1g_a95xr2’ DTB (although the infra red remote wont function). This has worked for the last couple of years. However, now there appears to be a “v.3” suddenly - I’ve had a fair few of them during the last couple of weeks. I cant get any of the DTB files from the CE collection to work with it.

Maybe your v.3 box uses a different type of SoC, either not by Amlogic at all, which means CE will not work on it at all, or something newer that needs the Amlogic-ng build rather than the old Amlogic build.

I’ve opened up the Android DTB and it says its Amlogic and a p282. I’ll try going through all of the DTB’s again and check them all again.

In that case, the DTB you tried should work fine. You’ll need to configure the remote for it to work.

Hey, the DTB just doesnt work… I’m using the exact same as with the v.1. Goes to black screen. It’s weird. When comparing the v.1 (fully working) and the v.3…

On Android recovery screen, both are… Amlogic, both are p282.
Both are 7.1.2/NHG47L/20190220

Ive physically opened them both up both looking the same internally with the exception of one chip in the corner which differs.

Do you have any suggestions where I can go from here? Is there a way to get a diagnostic hardware list off the v.3 so that I can compare it to that in the DTB? Any suggestions really appreciated

Or, possibly, where could I get the firmware that is on the v.1 from (do you know any sources…?) - in case v.3 has a dodgy firmware?? So reflash it

Hello, I am new both in the forum and in the world of android tv. I have a stuuc s1 max 4gb of ram with soc s905x4. I have extracted the dtb from android and I would like someone to adapt it for corelect or a tutorial to adapt it myself. Thanks and great job.
dtb (256 KB)

Maybe start here.