Nanopi R5C seems to ignore SD Card in boot order

I have managed to complete the following 2 tasks:

  1. Get the R5C to boot from the sd card
  2. Copy the R5C DietPi installation from the sd card to the emmc

(1) How to get the NanoPi R5C to boot from the sd card.

In order to do this I executed the following command:

dd if=/dev/zero of=/dev/mmcblk1 bs=8M count=1

Or it was this (or very similar, I can’t quite recall):

dd if=/dev/zero of=/dev/mmcblk1p1 bs=8M count=1

This approach was obtained from Can't boot DietPi on the NanoPi R4SE - #2 by Jappe

Basically the objective is to break the default installed FriendlyElec OS, because the firmware will ignore the sdcard if it finds a working OS on the emmc.

Therefore, break the OS on the emmc so the firmware looks for a working OS on the sd card :slightly_smiling_face:

(2) How to get DietPi booting from the eMMC on the Nano Pi R5C.

After getting DietPi to boot I could run it on the sd card, but I wanted to run DietPi on the emmc. In order to achieve this I approximately followed this: Moving a running DietPi system to a USB stick/disk or an onboard eMMC – DietPi Blog

Noting that initially I spent a day trying to get that article work with an sd card that was larger than the emmc (the emmc is 32gb and the sd card i first tried was 64 gb). No matter what I tried I couldn’t get it to work.

So I just went out and purchased a 16GB sd card and then the following worked:

Step 1: Mark the / as readonly and reboot

mount -o remount,ro /
sed -i '\|[[:blank:]]/[[:blank:]]|s|,rw|,ro|' /etc/fstab
shutdown -r now

Step 2: Copy the sd card (mmcblk0) to the emmc (mmcblk1)

dietpi-services stop
swapoff -a
dd if=/dev/mmcblk0 of=/dev/mmcblk1 bs=1M status=progress
shutdown -h now

Then remove the sd card, and pull out the power and back in again to boot, and it should boot from the emmc.

Step 3: Return the / to read-write, and reboot and you are finished.

mount -o remount,rw /
sed -i '\|[[:blank:]]/[[:blank:]]|s|,ro|,rw|' /etc/fstab
shutdown -r now

(3) Further notes

During this work I found that Armbian works out of the box to install directly and automatically onto the sd card. It has a script build/packages/bsp/common/usr/sbin/armbian-install at 0a18ec690e423ffb25f66d39c09c0618f768e82d · armbian/build · GitHub

The script was useful to help me understand why Armbian worked and DietPi didn’t.