Hello and I’m not quite sure if I should post it here but I managed to pull off some tricks to dual-boot CoreELEC and EmuELEC side-by-side on internal storage.
Thanks to Xiaomi’s heavily modified u-boot, the device wasn’t even possible to side load CoreELEC/EmuELEC from external drive, so I had to make a USB Burning Tool flashable image for others to burn for ease.
The whole work was done on coreelec-9.2 branch and emuelec-4.3 branch, since the chip in this box is not supported by the newer mainline ng kernel.
I’ve basically rewritten the init logic of both CoreELEC and EmuELEC so they can use shared yet seperate data and system partitions, and also patched the kernel’s mmc driver so Xiaomi’s wierd partition table layout and dtb offset can be recognised. Heavy reverse-engineering for Xiaomi’s modifications here and there.
Every hack was done to save some space from MDZ-16-AA’s teeny tiny emmc chip: only logo(20K to show some disclaimer), boot (CoreELEC kernel), eboot (EmuELEC kernel), system (CoreELEC + EmuELEC system, both as a subfolder of the squashfs, this saves some space as some content are the same between them), data (CoreELEC + EmuELEC data, both as a subfolder of the ext4 fs) are allocated, and size of every partition is rounded up to the nearest multiplies of 4KiB from the actual data size.
The current way I achieve it relies heavily on modifying the device-tree to modify the partition layout of the internal storage, and is therefore device-specific, but I’m looking forward to port these tricks to Amlogic-ng devices in a more device-neutral way, by then it won’t be limited to just several devices I have on hand (but you won’t get internal dual-booting though)