Trying to replace eMMC OS

Here is the sequence:

  1. Connect all as you wish (HDMI,Keyboard,microSD 2GB)

  2. Locate the middle SMD push button on the board (positioned between the first near the USB-C connector and directly to the left of the HDMI port where two of those are located).

    Press and hold(!) maskrom button and connect USB-C to power on to see eventually the OS from SD card (dietPi rel. Trixie in my case) booting up. Then let go.

    1. Hardware Context: This forces the RK3399 BootROM to skip loading the bootloader from the internal eMMC and fall back to booting from the MicroSD card (mmcblk1), while keeping the eMMC bus hardware available for Linux.

  3. Once booted cancel the setup dialogue. I did it later after booting succesfully from eMMC

  4. enter root:dietpi to log on

  5. Follow this steps
    Force eMMC Initialization in Linux (Driver Re-bind)
    I released the maskrom button a little bit to late and dmesg showed eMMC drivers didn’t bind

    * Kernel Error: The system startup log displayed:
    mmc0: Failed to initialize a non-removable card
    *(The bootloader bypass left the eMMC controller uninitialized).
    * Failed Rescan: Running echo 1 > /sys/class/mmc_host/mmc0/device/rescan failed with Permission denied because the /device sysfs directory did not exist yet.

    Re-bind the sdhci-arasan controller driver using its exact hardware address taken from the dmesg lines (fe330000.mmc in my case, might differ on your board!) to force a full hardware re-scan:

    bash
    echo “fe330000.mmc” | tee /sys/bus/platform/drivers/sdhci-arasan/unbind
    echo “fe330000.mmc” | tee /sys/bus/platform/drivers/sdhci-arasan/bind

    I checked with lsblk for the change “et voilá”:
    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
    mmcblk1 179:0 0 1.8G 0 disk
    └─mmcblk1p1 179:1 0 1.8G 0 part /
    mmcblk0 179:32 0 28.9G 0 disk
    ├─mmcblk0p1 179:33 0 3.9M 0 part
    ├─mmcblk0p2 179:34 0 4M 0 part
    ├─mmcblk0p8 179:40 0 27.4G 0 part
    mmcblk0boot0 179:64 0 4M 1 disk
    mmcblk0boot1 179:96 0 4M 1 disk

    The eMMC became visible as mmcblk0*

    To copy the dietPi image of the 2GB microSD (128GB didn’t work and would take forever to copy anyways)

    dd if=/dev/mmcblk1 of=/dev/mmcblk0 bs=4M status=progress
    sync

    1977614336 bytes (2.0 GB, 1.8 GiB) copied, 166.949 s, 11.8 MB/s
    ​471+1 records in / 471+1 records out
    (471 full 4MB blocks + 1 partial tail block successfully written).

    poweroff

  6. I removed the microSD, did a powercycle by unplug/plug USB-C and the OS booted nicely from eMMC