Skip to main content

How to Erase the eMMC Flash Memory (Linux)

From Toradex Easy Installer

See the Erase Flash section from the Toradex Easy Installer Detailed Manual.

From U-Boot

These are the steps to erase the eMMC flash memory on Apalis or Colibri modules from the U-Boot bootloader.

Erase the User Data Area Partition:

Select the partition:

Apalis TK1 # mmc dev 0 0
switch to partitions #0, OK
mmc0(part 0) is current device

Find out how many blocks that one actualy has by trying to read a block from an exceptionaly big address:

Apalis TK1 # mmc read ${loadaddr} 0x7fffffff 1

MMC read: dev # 0, block # 2147483647, count 1 ... MMC: block number 0x80000000 exceeds max(0xe90000)
0 blocks read: ERROR

Erase all blocks thereof:

Apalis TK1 # mmc read ${loadaddr} 0x7fffffff 1

MMC read: dev # 0, block # 2147483647, count 1 ... MMC: block number 0x80000000 exceeds max(0xe90000)
0 blocks read: ERROR
Apalis TK1 # mmc erase 0 0xe90000

MMC erase: dev # 0, block # 0, count 15269888 ... 15269888 blocks erased: OK
info

Depending on the eMMC's size this command may take a very long time to complete.

Erase the Primary Boot Area Partition:

Select the partition:

Apalis TK1 # mmc dev 0 1
switch to partitions #1, OK
mmc0(part 1) is current device

Find out how many blocks that one actualy has:

Apalis TK1 # mmc read ${loadaddr} 0x7fffffff 1

MMC read: dev # 0, block # 2147483647, count 1 ... MMC: block number 0x80000000 exceeds max(0x4000)
0 blocks read: ERROR

Erase all blocks thereof:

Apalis TK1 # mmc erase 0 0x4000

MMC erase: dev # 0, block # 0, count 16384 ... 16384 blocks erased: OK

Erase the Secondary Boot Area Partition:

Select the partition:

Apalis TK1 # mmc dev 0 2
switch to partitions #2, OK
mmc0(part 2) is current device

Erase all blocks thereof (assuming it has the same amount of blocks as the primary one):

Apalis TK1 # mmc erase 0 0x4000

MMC erase: dev # 0, block # 0, count 16384 ... 16384 blocks erased: OK

Notes

  • Most eMMCs also contain at least one hardware replay-protected memory-block partition (RPMB) which may require further special handling to make sure all data is wiped as well. Unfortunately, our U-Boot version does not currently support this.
  • If you are looking for more general information about flash memory on Toradex SoMs, refer to Flash Memory Overview on Toradex Products.


Send Feedback!