Boot sequence and skipping eMMC

Greetings,

Does anyone know where to find documentation about the boot sequence of the RockPi 4b?

I flashed the eMMC with a third party image, everything works just fine, but I’m not happy with the OS I installed and want to try something else. From what I read, the Rock Pi 4 gives priority to eMMC over microSD when booting. I also found info that suggests the u-boot stage (in eMMC) could be configured to resume boot from SD. However I found no concrete instructions how to skip boot from the eMMC.
I know that I could remove the eMMC and re-flash it with an SD to eMMC adapter.
But I have no such adapter and that method is unpractical if I want to try different OSes (the eMMC module is not easily accessible, it’s under the heatsink).
I’m reasonably familiar with boot process in PCs, but it seems that the boot process here is very different and my knowledge about PCs is useless :frowning: .

Thanks in advance.

Jorge

If you write another bootable image on SD card, the SD card OS will boot, ignoring the eMMC OS. The sequence is:

eMMC first stage loader -> SD card u-boot -> SD card kernel -> SD card OS

@jack: thanks for your quick reaction. I flashed the eMMC from within Rock PI itself, which I first booted from a sdcard. That same SD card is still there, It must be bootable, right? Or do you mean a specific type of bootable image?

Best regards,
Jorge

Hi Jorge,

Due to incompatibility of SD card image with eMMC first stage bootloader (this can happen with third party images), it may not be booting. Here are some things you could look at:

  • To disable boot from eMMC, one can clear out area where the bootloader resides. This can be done manually or using this script. Be careful and confirm that the right device is being cleared.
  • [for general debugging] I would recommend you to get a USB serial device. Helps a lot in case an image does not boot.
  • [for info] Rockchip boot flow

Welcome to the ARM world! It takes some patience and hit and try in the first few days/weeks. Post here if something is not clear in above links.

1 Like

Hello aaditya,

Thank you for the valuable information. I think I begin to connect the dots :+1:
I will take some time to digest the info from those links. If something is not clear, sure I will post a question here. :slight_smile:
Clearing the area where the boot loader resides was one of the ideas that occurred me, I just didn’t know how to do it.
Before trying that, though, I will flash the SD with the official Debian image from the Radxa website. If it still doesn’t work I will begin messing up with the boot area of the eMMC.

Best regards,
Jorge

1 Like

Hello Everybody,

I really appreciate the help from @jack nd @aaditya.
Especially useful was the information about the Rockchip boot flow http://opensource.rock-chips.com/wiki_Boot_option#Boot_flow. It provided me the confidence that what I was about to do would indeed work as intended. I highly recommend this reading for anyone interested in learning more about the boot flow.

To summarize, what I did to disable booting from the eMMC was writing zeros over the sectors of the eMMC starting at offset 64 up to 32768, by issuing the following command:

sudo dd if=/de/zero of=/dev/mmcblk2 seek=64 count=$((32768-64))

(in my case the eMMC was /dev/mmcblk2)
If you check the link of the boot flow you can understand what is actually being overwritten.

After that I booted with an microSD with Debian (from radxa website).
Interestingly, other 3rd party boot images (Manjaro) were still causing the system to boot from the eMMC. I suppose that these boot images are themselves checking whether the eMMC has an OS and try to boot from it. Note that the operation above didn’t clear the OS partition. So overall this process can still bring some surprises, however, I found a way to force boot from SD, as long as I use the right image. :+1:

1 Like

Manjaro’s bootloader setup uses extlinux, which could explain the boot from eMMC partition when it exists.

More details here: