HK1 RBOX X4 (s905x4)'s changes that made ceemmc impossible to work

So after some digging I found the box has several important changes that made ceemmc impossible to work on it, and partition-layout modifying as a whole is impossible on it. Since most of these cheap S905X4 boxes are made in similiar specs, this would mean ceemmc would not work on most of them

  1. partitions node in dtb can’t be removed
    The u-boot on this box checks partitions node in dtb to find partitions vender_boot_(a|b) odm_ext_(a|b) vbmeta (Vendor Boot Metadata) to apply certain boot arguments before kernel is loaded. And it will only look for them in dtb instead of looking for them in the partition table. If partitions node is deleted, CE/Android kernel can’t be loaded and the box will boot-loop. This was the way for ceemmc to avoid partition layout being reverted by u-boot.

    This means that the dual-boot mode can’t be ever achived since you can’t just add more partition nodes to the partitions node, as each of them should have unique phandle (and you would need at least 2 empty phandles to be used on CE_STORAGE and CE_SYSTEM), but the new partitions can’t have these phandles. Single-boot mode should in theory work since the phandles needed are less than those already existing.
    This means more work and time invested to re-write the corresponding code to modify dtb, and that’s kinda not worth it.

  2. userdata partition can’t be mounted by the current CE kernel
    The userdata partition is created on a newer Linux kernel and has different feature sets:

    1. Feature sets of /dev/userdata on HK1 RBOX X4 (notice it lacks resize_inode, 64bit and metadata_csum):
      has_journal ext_attr dir_index filetype extent casefold sparse_super large_file huge_file uninit_bg dir_nlink extra_isize verity
    2. Feature sets of a CE’s storage partition:
      has_journal ext_attr resize_inode dir_index filetype extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum

    The ext4 fs on /dev/userdata does not have checksum, and it has a unsigned_directory_hash flag instead of normal signed_directory_hash flag, it can’t be mounted on CE, although it could be e2fscked and fs-resized. And since it can’t be mounted the installation to internal is impossible. ceemmc would break when it tries to mount /dev/CE_STORAGE.

We know, it’s because you device mapper is now used with Android 12. The partitions can’t be just mounted like before and it is necessary to create /dev/block/dm-%d partitions. These can than be mounted. But this do have low priority for now as we fight with 4k in general on SC2 and T7.

2 Likes

The dumped userdata partition can still be mouted on my Arch machine without device mapper, and sysfs and mount in Android does not report any device mapper related with it. Since the box is actually using Android 11 so I guess it’s not that device-mapper-central

/sys/block/dm-0/slaves/:
super

/sys/block/dm-1/slaves/:
super

/sys/block/dm-2/slaves/:
super

/sys/block/dm-3/slaves/:
super

/sys/block/dm-4/slaves/:
super

/sys/block/dm-5/slaves/:
dm-0

/sys/block/dm-6/slaves/:
dm-4

/sys/block/dm-7/slaves/:
dm-1

/sys/block/dm-8/slaves/:
dm-2

/sys/block/dm-9/slaves/:
dm-3
tmpfs /dev tmpfs rw,seclabel,nosuid,relatime,mode=755 0 0
devpts /dev/pts devpts rw,seclabel,relatime,mode=600,ptmxmode=000 0 0
proc /proc proc rw,relatime,gid=3009,hidepid=2 0 0
sysfs /sys sysfs rw,seclabel,relatime 0 0
selinuxfs /sys/fs/selinux selinuxfs rw,relatime 0 0
tmpfs /mnt tmpfs rw,seclabel,nosuid,nodev,noexec,relatime,mode=755,gid=1000 0 0
/dev/block/by-name/metadata /metadata ext4 rw,seclabel,nosuid,nodev,noatime,nodelalloc,errors=panic 0 0
/dev/block/dm-5 / ext4 ro,seclabel,nodev,relatime 0 0
/dev/block/dm-6 /system_ext ext4 ro,seclabel,relatime 0 0
/dev/block/dm-7 /vendor ext4 ro,seclabel,relatime 0 0
/dev/block/dm-8 /product ext4 ro,seclabel,relatime 0 0
/dev/block/dm-9 /odm ext4 ro,seclabel,relatime 0 0
/dev/block/by-name/odm_ext_a /mnt/vendor/odm_ext ext4 ro,seclabel,nosuid,nodev,noatime,nodelalloc,errors=panic 0 0
tmpfs /apex tmpfs rw,seclabel,nosuid,nodev,noexec,relatime,mode=755 0 0
tmpfs /linkerconfig tmpfs rw,seclabel,nosuid,nodev,noexec,relatime,mode=755 0 0
tmpfs /mnt/installer tmpfs rw,seclabel,nosuid,nodev,noexec,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/androidwritable tmpfs rw,seclabel,nosuid,nodev,noexec,relatime,mode=755,gid=1000 0 0
/dev/block/dm-5 /apex/com.android.art ext4 ro,seclabel,relatime 0 0
/dev/block/dm-5 /apex/com.android.media ext4 ro,seclabel,relatime 0 0
/dev/block/dm-5 /apex/com.android.permission ext4 ro,seclabel,relatime 0 0
/dev/block/dm-5 /apex/com.android.media.swcodec ext4 ro,seclabel,relatime 0 0
/dev/block/dm-5 /apex/com.android.runtime ext4 ro,seclabel,relatime 0 0
/dev/block/dm-5 /apex/com.android.neuralnetworks ext4 ro,seclabel,relatime 0 0
/dev/block/dm-5 /apex/com.android.sdkext ext4 ro,seclabel,relatime 0 0
/dev/block/dm-5 /apex/com.android.extservices ext4 ro,seclabel,relatime 0 0
/dev/block/dm-5 /apex/com.android.tethering ext4 ro,seclabel,relatime 0 0
/dev/block/dm-5 /apex/com.android.mediaprovider ext4 ro,seclabel,relatime 0 0
/dev/block/dm-5 /apex/com.android.ipsec ext4 ro,seclabel,relatime 0 0
/dev/block/dm-5 /apex/com.android.tzdata ext4 ro,seclabel,relatime 0 0
/dev/block/dm-5 /apex/com.android.os.statsd ext4 ro,seclabel,relatime 0 0
/dev/block/dm-5 /apex/com.android.adbd ext4 ro,seclabel,relatime 0 0
/dev/block/dm-5 /apex/com.android.resolv ext4 ro,seclabel,relatime 0 0
/dev/block/dm-5 /apex/com.android.conscrypt ext4 ro,seclabel,relatime 0 0
/dev/block/dm-5 /apex/com.android.vndk.v30 ext4 ro,seclabel,relatime 0 0
/dev/block/dm-5 /apex/com.android.i18n ext4 ro,seclabel,relatime 0 0
/dev/block/dm-5 /apex/com.android.wifi ext4 ro,seclabel,relatime 0 0
none /sys/fs/cgroup cgroup2 rw,nosuid,nodev,noexec,relatime 0 0
none /dev/cpuctl cgroup rw,nosuid,nodev,noexec,relatime,cpu 0 0
none /acct cgroup rw,nosuid,nodev,noexec,relatime,cpuacct 0 0
none /dev/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset,noprefix,release_agent=/sbin/cpuset_release_agent 0 0
none /dev/memcg cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0
tmpfs /linkerconfig tmpfs rw,seclabel,nosuid,nodev,noexec,relatime,mode=755 0 0
tracefs /sys/kernel/tracing tracefs rw,seclabel,relatime 0 0
none /config configfs rw,nosuid,nodev,noexec,relatime 0 0
binder /dev/binderfs binder rw,relatime,max=1048576,stats=global 0 0
none /sys/fs/fuse/connections fusectl rw,relatime 0 0
none /sys/fs/bpf bpf rw,nosuid,nodev,noexec,relatime 0 0
pstore /sys/fs/pstore pstore rw,seclabel,nosuid,nodev,noexec,relatime 0 0
tmpfs /odm/lib/ms12 tmpfs ro,seclabel,relatime 0 0
/dev/block/param /mnt/vendor/param ext4 rw,seclabel,nosuid,nodev,noatime,nodelalloc,errors=panic 0 0
/dev/block/tee /mnt/vendor/tee ext4 rw,seclabel,nosuid,nodev,noatime,nodelalloc,errors=panic 0 0
/dev/block/factory /mnt/vendor/factory vfat rw,nosuid,noexec,noatime,nodiratime,fmask=0000,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0
/dev/block/userdata /data ext4 rw,seclabel,nosuid,nodev,noatime,nodiratime,discard,nodelalloc,resgid=1065 0 0
/dev/block/userdata /data/user/0 ext4 rw,seclabel,nosuid,nodev,noatime,nodiratime,discard,nodelalloc,resgid=1065 0 0
tmpfs /data_mirror tmpfs rw,seclabel,nosuid,nodev,noexec,relatime,mode=700,gid=1000 0 0
/dev/block/userdata /data_mirror/data_ce/null ext4 rw,seclabel,nosuid,nodev,noatime,nodiratime,discard,nodelalloc,resgid=1065 0 0
/dev/block/userdata /data_mirror/data_ce/null/0 ext4 rw,seclabel,nosuid,nodev,noatime,nodiratime,discard,nodelalloc,resgid=1065 0 0
/dev/block/userdata /data_mirror/data_de/null ext4 rw,seclabel,nosuid,nodev,noatime,nodiratime,discard,nodelalloc,resgid=1065 0 0
/dev/block/userdata /data_mirror/cur_profiles ext4 rw,seclabel,nosuid,nodev,noatime,nodiratime,discard,nodelalloc,resgid=1065 0 0
tmpfs /storage tmpfs rw,seclabel,nosuid,nodev,noexec,relatime,mode=755,gid=1000 0 0
adb /dev/usb-ffs/adb functionfs rw,relatime 0 0
mtp /dev/usb-ffs/mtp functionfs rw,relatime 0 0
ptp /dev/usb-ffs/ptp functionfs rw,relatime 0 0
/dev/fuse /mnt/user/0/emulated fuse rw,lazytime,nosuid,nodev,noexec,noatime,user_id=0,group_id=0,allow_other 0 0
/dev/fuse /mnt/installer/0/emulated fuse rw,lazytime,nosuid,nodev,noexec,noatime,user_id=0,group_id=0,allow_other 0 0
/dev/fuse /mnt/androidwritable/0/emulated fuse rw,lazytime,nosuid,nodev,noexec,noatime,user_id=0,group_id=0,allow_other 0 0
/dev/fuse /storage/emulated fuse rw,lazytime,nosuid,nodev,noexec,noatime,user_id=0,group_id=0,allow_other 0 0
/dev/block/userdata /mnt/pass_through/0/emulated ext4 rw,seclabel,nosuid,nodev,noatime,nodiratime,discard,nodelalloc,resgid=1065 0 0
/dev/block/userdata /mnt/user/0/emulated/0/Android/data ext4 rw,seclabel,nosuid,nodev,noatime,nodiratime,discard,nodelalloc,resgid=1065 0 0
/dev/block/userdata /storage/emulated/0/Android/data ext4 rw,seclabel,nosuid,nodev,noatime,nodiratime,discard,nodelalloc,resgid=1065 0 0
/dev/block/userdata /mnt/androidwritable/0/emulated/0/Android/data ext4 rw,seclabel,nosuid,nodev,noatime,nodiratime,discard,nodelalloc,resgid=1065 0 0
/dev/block/userdata /mnt/installer/0/emulated/0/Android/data ext4 rw,seclabel,nosuid,nodev,noatime,nodiratime,discard,nodelalloc,resgid=1065 0 0
/dev/block/userdata /mnt/user/0/emulated/0/Android/obb ext4 rw,seclabel,nosuid,nodev,noatime,nodiratime,discard,nodelalloc,resgid=1065 0 0
/dev/block/userdata /storage/emulated/0/Android/obb ext4 rw,seclabel,nosuid,nodev,noatime,nodiratime,discard,nodelalloc,resgid=1065 0 0
/dev/block/userdata /mnt/androidwritable/0/emulated/0/Android/obb ext4 rw,seclabel,nosuid,nodev,noatime,nodiratime,discard,nodelalloc,resgid=1065 0 0
/dev/block/userdata /mnt/installer/0/emulated/0/Android/obb ext4 rw,seclabel,nosuid,nodev,noatime,nodiratime,discard,nodelalloc,resgid=1065 0 0

Considering the complexity of all these it surely would have low priority. I would suggest against putting much time into these devices for you even I have one of them.

Cool, I would be really be excited to see these new features :grinning:, although all my monitors/TVs are <= 1080P :rofl:, and I’m already very happy with CE’s current performance on my SC2 box

Doesn’t dm indicate this? DM as device mapper. But maybe I’m wrong.

Android 11 maybe not, but in Android 12 it’s forced dm:
/dev/block/dm-5 on /data type ext4

On this box the userdata partition has nothing to do with dm, as it is not enforced in Android 11. (By it I meant userdata partition :smile_cat: )

But as Portisch suggested, it’s forced in Android 12 (But I guess the box won’t get updated to that)