eMMC partition information, mmc-tools on a live system

(NekoBCN) #1

I have successfully installed the Kali image on my BSP-R2 on the emmc and so far it is working properly. However I am still not sure if the eMMC partitioning is correct. I believe the next two points to be correct, correct me if I am wrong.

  • The devices /dev/mmcblk0boot[01] are actually mapped to /dev/mmcblk0 before the first partition (204800 sector)
  • emmc pconf will affect the mapping of these devices

My questions is:

  • How can I know on a live system (not on the u-boot prompt) if the partition is correct? I mean, if the “emmc pconf 48” executed correctly.

I have installed mmc-tools and I can access the mmc command.



(Frank W.) #2

How do you get the information that boot0 and boot1 are mapped before first partition?

The main question is what exactly does “pconf 48” and how the 48 is used to create the partitions (there are boot0 and boot1).

edit i tried to use the mmc-tools, but i’ve found no command to read the partitiondata

but i also list partitions i have after set pconf 48:

root@bpi-r2:~/mmc-utils# cat /proc/partitions 
major minor  #blocks  name

 179        0    7974912 mmcblk0
 179        1     262144 mmcblk0p1
 179        2    7270400 mmcblk0p2
 179        8    7634944 mmcblk1
 179        9     262144 mmcblk1p1
 179       10    7270400 mmcblk1p2
 179       32        512 mmcblk1rpmb
 179       24       4096 mmcblk1boot1
 179       16       4096 mmcblk1boot0

maybe you can verify with this data your config…

fdisk information:

Disk /dev/mmcblk1boot0: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes

Disk /dev/mmcblk1boot1: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes

Disk /dev/mmcblk1: 7,3 GiB, 7818182656 bytes, 15269888 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000ed6cd

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk1p1      204800   729087   524288  256M  c W95 FAT32 (LBA)
/dev/mmcblk1p2      729088 15269887 14540800    7G 83 Linux

ok, found the right command in mmc

./mmc extcsd read /dev/mmcblk1
Boot configuration bytes [PARTITION_CONFIG: 0x48]

mmc.log (10,2 KB)

(Frank W.) #3

i have tested steps from here:

to write emmc-partition-config with mmc-utils

[18:02] root@bpi-r2:~# ./mmc extcsd read /dev/mmcblk1 | grep PARTITION_CONFIG
Boot configuration bytes [PARTITION_CONFIG: 0x00]
[18:02] root@bpi-r2:~# ./mmc bootpart enable 1 1 /dev/mmcblk1
[18:03] root@bpi-r2:~# ./mmc extcsd read /dev/mmcblk1 | grep PARTITION_CONFIG
Boot configuration bytes [PARTITION_CONFIG: 0x48]

@garywang this should be an easier way than using uboot because uboot-console needs debug-uart running…mmc-utils can be used in a running system. i have added code and binary to my 4.14-main-repo

added this also to my wiki: http://www.fw-web.de/dokuwiki/doku.php?id=en:bpi-r2:storage#mmc-utils

BPI-R2 New Image Release : Ubuntu 16.04 V1.3 2018-3-30
(gary) #4

Thanks for your information, Frank.

Yes, this is an easier way to change EMMC configuration, I will add the mmc utils image in next release.


@frank-w Wait, how is your emmc mmcblk1? I though it should be mmcblk0, mmcblk1 is the mmc sd card

Also second question that switch above sd card slot on the board, do you have to switch it from sd to emmc to boot from emmc?

(Frank W.) #6

In my kernels i swapped mmcblk 0 and 1 in mt7623.dtsi to make kernel compatible with official one and official images where sdcard is mmcblk0

I don’t have the switch…it is introduced in latest hw-revision


Ah ok thanks @frank-w, does anyone else know what the SD/mmc switch is for? @garywang, do you know?


Hi @frank-w, speaking of your wiki, the instructions on booting from EMMC lists a particular file to dd onto boot0, do you know what is the difference between the following files?


Is there a place where this is described? I don’t see any readme in the git directory

(Frank W.) #9

These are the preloader-images…these are closed-source and i think these are only different versions


Ah ok, thanks for the tip @frank-w.

Just posting here for future reference to others. A bit of binary analysis reveals that names corrolate to revisions and release dates in the following way:

1. 2017-Jan-14 v170026:  BPI-R2-EMMC-boot0-DDR1600-0k.img
2. 2017-Feb-10 v093340:  BPI-R2-EMMC-boot0-0k.img
3. 2017-Sep-05 v120917:  BPI-R2-EMMC-boot0-DDR1600-0k-0905.img

The change between 1 & 2 seems rather minor, number 3 on the other hand is quite different.