Khadas VIM3, M2X, CoreELEC 9.2.7 (Krescue image on eMMC)
Hello!
I’m trying to enable second ethernet port on M2X extension. For linux it requires additional device tree overlay at /boot/env.txt
, but obviously, it`s not available in CoreELEC.
I’ve dumped and decompiled separate m2x-eth.dtbo
available in my porevious Ubuntu setup at /boot/dtb/overlays/kvim3
, with dtc -I dtb -O dts m2x-eth.dtbo -o m2x-eth.dts
and got device tree souce:
/dts-v1/;
/ {
fragment@0 {
target = <0xffffffff>;
__overlay__ {
status = "okay";
mc_val = <0x4be04>;
internal_phy = <0x01>;
};
};
__fixups__ {
ethmac = "/fragment@0:target:0";
};
};
After that I was trying to merge it with CoreELEC Device Tree Blob from /dev/dtb
. After dumping with dd if=/dev/dtb of=~/default.dtb bs=256k
and decompiling it with dtc -I dts -O dtb default_m2x.dts -o default_m2x.dtb
I’ve found this part of config:
...
ethernet@ff3f0000 {
compatible = "amlogic, g12a-eth-dwmac\0snps,dwmac";
reg = <0x00 0xff3f0000 0x00 0x10000 0x00 0xff634540 0x00 0x08 0x00 0xff64c000 0x00 0xa0>;
reg-names = "eth_base\0eth_cfg\0eth_pll";
interrupts = <0x00 0x08 0x01>;
interrupt-names = "macirq";
status = "okay";
clocks = <0x02 0x38>;
clock-names = "ethclk81";
pll_val = <0x9c0040a 0x927e0000 0xac5f49e5>;
analog_val = <0x20200000 0xc000 0x23>;
pinctrl-names = "external_eth_pins";
pinctrl-0 = <0x18>;
mc_val = <0x1621>;
internal_phy = <0x00>;
phandle = <0x92>;
};
...
I’ve checked DTS syntax, added new label, edited overlay fragment and added it after __symbols__
section:
...
eth: ethernet@ff3f0000 { ... };
...
__symbols__ { ... };
...
fragment@0 {
target = <ð>;
__overlay__ {
status = "okay";
mc_val = <0x4be04>;
internal_phy = <0x01>;
};
};
__fixups__ {
ethmac = "/fragment@0:target:0";
};
...
Then I’ve compiled everything it with dtc -I dts -O dtb default_m2x.dts -o default_m2x.dtb
, uploaded to CoreELEC /storage
and written back to /dev/dtb
with dd.
After reboot, nothing happened, first Ethernet port was still working second port was still not. Ive checked
/dev/dtb` dupm source again and found that overlay fix was still present.
Later I’ve found a script at /flash/boot.ini
which was loading /flash/dtb.img
and other device tree blobs with fatload
one by one on every boot. I’ve looked it up, and found that fatload could also load Device Tree Blob Overlays. I’m not that good at bash, so I do not know hot to edit boot.ini
correctly.
@hyphop suggested to build CoreELEC from source, but I do not now hot to build it with overlay. My goal for now is to use M2X eternet port for network (even if without main port) and Im lookig for a way to enable it on installed CoreELEC.
Questions:
- Am I doing it correctly or what am I doing wrong?
- Is it possible to add this overlay into already installed CoreELEC setup?
- Is it better for me to merge
m2x-eth.dtbo
sorce with generalg12b_a311d_khadas_vim3.dtb
source and reinstall? If so, how do I put correct target label or path in overlay fragment? - Do I have to build ny own version of CoreELEC from source and how to do it with needed device tree overlay?
- Is it possible for CoreELEC team to add support of M2X extension Ethernet port to main repo? I could help to test and debug it.
Thanks in advance.