eMMC Flash Storage

The Nagami module features a 4GB onboard eMMC used for booting and persistent storage. This storage includes a dedicated hardware boot partition and a unified user data partition for the operating system and user files.

Storage Layout

eMMC devices provide separate boot hardware partitions and a user-accessible data area. The Nagami's layout is as follows:

  • eMMC Boot Partition 0 (/dev/mmcblk1boot0):
  • Contains the U-Boot bootloader.
  • Stores U-Boot environment variables.
  • Not mounted in the Linux filesystem.

  • eMMC User Area (/dev/mmcblk1):

  • Contains a single partition used as both the boot and root filesystem.
  • No separate /boot partition by default. Kernel, DTBs, and rootfs coexist on one partition.

You can check the layout with:

lsblk

Example output:

NAME             MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
mmcblk1          179:0    0  3.7G  0 disk 
└─mmcblk1p1      179:1    0  3.7G  0 part /
mmcblk1boot0     179:8    0    2M  1 disk 
mmcblk1boot1     179:16   0    2M  1 disk 

Accessing the Boot Partition

To inspect or update mmcblk1boot0, which holds U-Boot and its environment, it must first be made writable:

echo 0 > /sys/block/mmcblk1boot0/force_ro

You can then read or write raw data:

dd if=u-boot-sunxi-with-spl.bin of=/dev/mmcblk1boot0 bs=512 seek=2

⚠️ Caution: Writing incorrectly to mmcblk1boot0 can prevent the board from booting.

Managing the User Partition

The user partition (/dev/mmcblk1p1) is used for both kernel and root filesystem data.

To back up the entire user area:

dd if=/dev/mmcblk1p1 of=backup.img bs=1M

To restore:

dd if=backup.img of=/dev/mmcblk1p1 bs=1M

You can also mount it on another system to inspect:

mount -o loop backup.img /mnt

Summary of eMMC Layout

Device Size Purpose
mmcblk1boot0 2MB U-Boot and environment
mmcblk1boot1 2MB (Unused or reserved)
mmcblk1p1 ~3.7GB Combined boot and rootfs

The Nagami's use of a single unified partition simplifies system design while still leveraging the reliability of the hardware boot partition for critical bootloader components.