How to convert Android DTB to a working CoreELEC DTB?

Hello. I’ve been looking all over the forum for information around converting an Android DTB to work with CoreELEC but I couldn’t find much about it.

I have a GTMEDIA GT COMBO box, with built-in DVB-S2X/T/C tuner. S905X3, 2GB RAM. The stock firmware is Android 9.

What I’ve done so far:

  • unpacked aml_upgrade_package.img
  • decompiled the DTBs from the image

The DTB that I think matches the closest to this box would be sm1_ac213_2g. What would the next steps be to translate this Android device tree into a working CoreELEC device tree image?

Thanks!

LE: The bit that I’m most interested in is getting the built-in tuners to work in CoreELEC.

I really don’t know if this information will help to answer your question. It uses a DTS file to compile into a DTB file.

Thanks @Habibie. From what I’ve read in other topics on the forum, the CoreELEC DTBs made available in releases are derived from Android DTBs but had some modifications made in order to make it work.

What I’m looking for is some pointers on what to spend my time on next to get closer to a working CoreELEC DTB for my box, with the built-in tuners in particular.

At the moment, I don’t know which is a better idea: try to add the dvb and dvbfe sections to a working CoreELEC dtb or… “convert” the Android DTB from scratch.

You can start looking here where all dtbs comes from.

1 Like

So, I made a new DTB for a different box (GTMEDIA GTC - S905D) that looks like this:

#include "gxl_p231_2g.dts"

/{
	coreelec-dt-id = "gxl_p231_2g_dvb";

	dvb {
		compatible = "amlogic,dvb";
		dev_name = "dvb";
		ts0 = "parallel";
		ts0_control = <0x0>;
		ts0_invert = <0x0>;
		dtv_demod0_i2c_adap_id = <1>;
		fec_reset_gpio-gpios = <&gpio GPIODV_13 GPIO_ACTIVE_HIGH>;
		power_ctrl_gpio-gpios = <&gpio GPIODV_11 GPIO_ACTIVE_LOW>;
		pinctrl-names = "p_ts0", "s_ts0";
		pinctrl-0 = <&dvb_p_ts0_pins>;
		pinctrl-1 = <&dvb_s_ts0_pins>;
		clocks = <&clkc CLKID_DEMUX
                  &clkc CLKID_ASYNC_FIFO
                  &clkc CLKID_AHB_ARB0
                  &clkc CLKID_HIU_IFACE>;
		clock-names = "demux", "asyncfifo", "ahbarb0", "uparsertop";

		interrupts = <GIC_SPI 23 IRQ_TYPE_EDGE_RISING>,
                     <GIC_SPI  5 IRQ_TYPE_EDGE_RISING>,
                     <GIC_SPI 19 IRQ_TYPE_EDGE_RISING>,
                     <GIC_SPI 25 IRQ_TYPE_EDGE_RISING>;
		interrupt-names = "demux0", "demux1", "asyncfifo0", "asyncfifo1";
	};

    dvbfe {
		compatible = "amlogic,dvbfe";
		dev_name = "dvbfe";
		dtv_demod0 = "cxd28xx";
		dtv_demod0_i2c_adap_id = <2>;
		dtv_demod0_i2c_addr = <0x6e>;
		dtv_demod0_reset_value = <0x0>;
		dtv_demod0_reset_gpio = <&gpio GPIODV_0 GPIO_ACTIVE_HIGH>;
		fe0_dtv_demod = <0x0>;
		fe0_ts = <0x0>;
		fe0_dev = <0x0>;
	};

};

&pinctrl_periphs {
	dvb_p_ts0_pins: dvb_p_ts0_pins {
			tsin_a {
				groups = "tsin_d0_a_dv0",
                         "tsin_d1_7_a_dv1_7",
                         "tsin_clk_a_dv8",
                         "tsin_sop_a_dv9",
                         "tsin_d_valid_a_dv10";
				function = "tsin_a";
			};
		};
	dvb_s_ts0_pins: dvb_s_ts0_pins {
		tsin_a {
			groups ="tsin_d0_a_dv0",
                    "tsin_clk_a_dv8",
                    "tsin_sop_a_dv9",
                    "tsin_d_valid_a_dv10";
			function = "tsin_a";
		};
	};
};

&i2c0 {
	status = "okay";
};

&i2c1 {
	status = "okay";
};

&i2c2 {
	status = "okay";
};

&i2c3 {
	status = "okay";
};

But the frontend fails to load:

CoreELEC:~ # dmesg | grep -E 'i2c|dvb|cxd'
[    0.000000@0]d CoreELEC dt-id: gxl_p231_2g_dvb
[    0.813584@3]- i2c /dev entries driver
[    3.222401@1]- kernel-overlays-setup: processing conf /storage/.cache/kernel-overlays/50-driver.dvb.crazycat.conf
[    3.268729@0]- kernel-overlays-setup: added modules from /storage/.kodi/addons/driver.dvb.crazycat//kernel-overlay/lib/modules/4.9.269
[    9.442835@1]- dvb_meson dvb: Found i2c-1 adapter: Meson I2C adapter
[    9.442846@1]- dvb_meson dvb: ts0: parallel
[    9.443172@1]- dvb_meson dvb: ts0_control: 0x0
[    9.443322@1]- dvb_meson dvb: dev_name=dvb
[   10.666361@3]- dvb_meson dvb: DVB demod detection for i2c-1 (Meson I2C adapter)...
[   11.882331@3]- dvb_meson dvb: Checking for Availink AVL6862 DVB-S2/T2/C demod ...
[   11.882420@0]- i2c i2c-1: dvb_meson: i2c wr failed=-6 len=3
[   11.882477@0]- i2c i2c-1: dvb_meson: i2c rd failed=-6 len=4
[   11.882532@0]- i2c i2c-1: dvb_meson: i2c wr failed=-6 len=3
[   11.882587@0]- i2c i2c-1: dvb_meson: i2c rd failed=-6 len=4
[   11.882592@0]- i2c i2c-1: dvb_meson: attach failed reading id
[   11.882596@0]- dvb_meson dvb: Failed to find AVL6862 demod!
[   13.098372@3]- dvb_meson dvb: Checking for AVL6211 DVB-S/S2 demod ...
[   13.098469@3]- i2c i2c-1: i2c wr failed=-6
[   13.098475@3]- dvb_meson dvb: Failed to find AVL6211 demod!
[   14.314382@1]- dvb_meson dvb: Checking for Sony CXD2841ER DVB-C/T/T2 demod ...
[   14.314396@1]- i2c i2c-1: cxd2841er_attach(): I2C adapter 0000000065bf6974 SLVX addr 6e SLVT addr 6c
[   14.314403@1]- cxd2841er: I2C data: 00000000: 00                                               .
[   14.314487@0]- i2c i2c-1: dvb_meson: i2c wr failed=-6 addr=6c reg=00 len=1
[   14.314491@0]- cxd2841er: I2C data: 00000000: 00                                               .
[   14.314775@0]- cxd2841er: I2C data: 00000000: 90                                               .
[   14.314780@0]- i2c i2c-1: cxd2841er_attach(): invalid chip ID 0x90
[   14.314785@0]- dvb_meson dvb: Failed to find Sony CXD2841ER demod!
[   14.314789@0]- dvb_meson dvb: Total DVB modules found: 0
[   14.319251@0]- dvbdev: DVB: registering new adapter (dvb_meson)

You use gxl_p231_2g for SM1 device? This will never work, wonder if it boots at all.
Please also remember that the dvb dts node id changed in last kernel:

1 Like

Thanks @Portisch. It was late and I forgot to mention I did this on a different but very similar box first - the GTMEDIA GTC (S905D based). :sweat_smile:

If dvb became demux, do you happen to know if dvbfe change as well? I haven’t seen the frontend section in any of the DTBs in CoreELEC/linux-amlogic.

dvbfe is removed I think.

I think it’s now like this, maybe:

With demux instead of dvb, the adapter is not detected at all. No /dev/dvb, no activity in dmesg.

Tried with the latest stable build:

Linux CoreELEC 4.9.269 #1 SMP PREEMPT Thu Jan 20 10:26:48 CET 2022 aarch64 GNU/Linux

Sorry, i can’t help much more. DVB, especially internal is EOL. Nobody is able to maintain and handle it.

But if you get it working please feel free to make a PR!

Will do. I’ll continue to tinker and see if I can get it working. It’s a shame we can’t use the internal tuners on these boxes with CoreELEC. They perform a lot better than USB alternatives.

To anyone else stumbling onto this post: any information around aml/meson dvb stuff is helpful.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.