Orange Pi 3: moving the system to eMMC

July 28, 2022

My Orange Pi 3 has 8GB of eMMC flash installed so microSD is unnecessary. Well, it's necessary for the first boot and then the system can be moved to eMMC. Armbian installer can do that but I prefer to do everything myself.

Orange PI 3

eMMC is accessible via /dev/mmcblk2. Also, there are /dev/mmcblk2boot0 and /dev/mmcblk2boot1. I don't know what the latter twos are for. They aren't writeable.

Armbian microSD has MBR and system partition starting from sector 8192. The 4MB gap is reserved for uboot.

The move begins from creating system partition on the eMMC:

fdisk /dev/mmcblk2

Everyone knows how to use fdisk so I have nothing more to say.

Format created partition and copy the system on it:

mkfs -t ext4 /dev/mmcblk2p1
mkdir /mnt/emmc
mount /dev/mmcblk2p1 /mnt/emmc
mkdir /mnt/root
mount /dev/mmcblk0p1 /mnt/root
rsync -rltvWpog --specials --devices /mnt/root/ /mnt/emmc/

Write UUID of the new partition to /mnt/emmc/boot/armbianEnv.txt and /mnt/emmc/etc/fstab.

Copy uboot (the second command copies MBR bootloader):

dd if=/dev/mmcblk0 of=/dev/mmcblk2 bs=512 seek=1 skip=1 count=8191
dd if=/dev/mmcblk0 of=/dev/mmcblk2 bs=432 count=1

That's all. Power it down shutdown now, pull microSD out and turn on again. Is it working? No? Game over then.