Sharing my device NAND (MMC) for ROMS between Emuelec and Android

Hi! I’m very pleased with the performance of my S905X4 device with EMUELEC, It does even run Sega Titan Video (ST-V) arcade games at a satisfying frame rate. Emulationstation has a very nice interface, and I’m enjoying it a lot.

My device has a whooping 64GB storage, and I would like to be able to share my ‘roms’ folder from the Android partition with EMUELEC, even if read only access.

This is pretty much my first interaction with any Linux based OS for smaller devices like my X96 X4, and my Linux knowledge is mostly lost because I haven’t used it actively for something like 18 years! So I’m kindly asking for help.

Using ssh with root access, I executed blkid command, to the following results:

EMUELEC:~/roms # blkid
/dev/mmcblk1p3: LABEL_FATBOOT=“EEROMS” LABEL=“EEROMS” UUID=“0C01-B62C” BLOCK_SIZE=“512” TYPE=“vfat” PARTUUID=“dc7449ba-03”
/dev/mmcblk1p1: LABEL_FATBOOT=“EMUELEC” LABEL=“EMUELEC” UUID=“3011-5301” BLOCK_SIZE=“512” TYPE=“vfat” PARTUUID=“dc7449ba-01”
/dev/mmcblk1p2: LABEL=“STORAGE” UUID=“4eb33e23-6c1c-4115-8849-7acce7546d8f” BLOCK_SIZE=“1024” TYPE=“ext4” PARTUUID=“dc7449ba-02”
/dev/userdata: UUID=“1f9e8676-2a5b-44bd-9b66-05cdaac0691c” BLOCK_SIZE=“4096” TYPE=“ext4”
/dev/param: UUID=“fafc9aa3-a4e9-43b5-ba37-e33695b17ffd” BLOCK_SIZE=“4096” TYPE=“ext4”
/dev/tee: UUID=“db3ff842-9702-4f2b-ab07-04fc262b0da7” BLOCK_SIZE=“4096” TYPE=“ext4”
/dev/oem_a: LABEL=“oem” UUID=“bd4cb416-b0e1-4df2-92d1-e86e764dbb21” BLOCK_SIZE=“4096” TYPE=“ext4”
/dev/metadata: UUID=“b421d3dc-00db-4a34-92e6-39a168f72192” BLOCK_SIZE=“4096” TYPE=“ext4”
/dev/oem_b: LABEL=“oem” UUID=“bd4cb416-b0e1-4df2-92d1-e86e764dbb21” BLOCK_SIZE=“4096” TYPE=“ext4”
/dev/odm_ext_a: UUID=“57f8f4bc-abf4-655f-bf67-946fc0f9f25b” BLOCK_SIZE=“4096” TYPE=“ext4”

Is there a way so I can determine which item from the list is my 64GB MMC and mount it as the rom folder? I am unable to mount anything, for example “mount: can’t find /dev/userdata in /etc/fstab”, and I can’t edit fstab (read only file system). Any help is appreciated.

You are not using the correct syntax.

To mount things not recorded in fstab the syntax is mount [source] [mountpoint], only for those recorded in fstab could you use mount [source] or mount [mountpoint]

Check man mount.8: mount(8) - Linux manual page for details

In all LibreELEC-derived distros the root fs is mounted from a read-only squashfs image SYSTEM stored under the first partition (itself then mounted to /flash), you can’t modify anything inside it. The purpose is to make the system “unbrickable” for its embedded distro nature.

Custom mounts therefore should be managed by systemd.mount units stored under /storage/.config/system.d, as /storage is mounted from a writable ext4 partition (second on your disk)

Check man systemd.mount.5: systemd.mount for details

BUT, with these corrected, you still won’t be able to mount Android’s data partition. This is due to Android 11’s requirement about the userdata partition being encryptable. You can’t mount it under EmuELEC or CoreELEC it derives from, both using Amlogic’s vendor kernel which does not support this Android-only feature.

(The dumped partition image is possibly mountable on another device with newer mainline kernel, e.g. a x86 machine with mainstream Linux distro, but that won’t help.)

You can create an ext4 fs on it in EmuELEC to use it, which will then make Android consider it corrupted and create its own encryptable ext4 fs, again. So you can not use Android any more.

You can also try to use my tool ampart to adjust Amlogic’s proprietary partition table on eMMC, to add a dedicated roms partition, but with Android data partition shrinked you’ll also need to reformat it and lose your data.

This is impossible, due to the reasons mentioned above. It is possible for things before s905x4, but not for s905x4.

Thank you for the links and the detailed explanation. I was using many different sintaxes trying to mount, most would return Invalid argument or the /etc/fstab message like: mount -ro /dev/userdata /tmp/test. Anyway I’ll check those links you provided.

In fact, the trial to edit fstab was a ‘desperate’ measure lol.

Yes, I should be aware of Android 11 encryption, even access to data folders is restricted to each app. IIRC, there’s a Android 9 rom for my device, maybe a Slimbox one. But the ampart option seems more attractive.

I’ll be sure to try ampart, I have no problem reflashing or formatting my device. This may be a good start. Will the new rom partition still be read by Android?

The Android kernel can identify the new rom partition but the userspace won’t parse it, the system just doesn’t expect there to be any partition not predefined (but it will be very unhappy if there’s missing predefined partitions). You could mount/modify it via adb and root but userspace apps won’t happily let you modify it.

I’m trying some basic commands with ampart, but It seems --mode is not an option, at least in the v1.3, am I missing something? The result is the usage screen. I’m trying the following:

ampart /dev/mmcblk0 --mode webreport

edit: changed command to what I really used.

If you’re using ampart in EmuELEC v4.6, you need to explicitly tell your shell to use the ampart binary you downloaded, by using ./ampart as the first argument. Otherwise the built-in older one will be used, which was added in the middle of last year, before the major rewrite which introduces safe editting of DTB and a lot of different modes.

Yes, I did generate the webreport, thanks… Now I’m reading the documentation so I don’t screw it all up :smiley:

It will take some time, it doesn’t look so simple (to me).