See the Erase Flash section from the Toradex Easy Installer Detailed Manual.
These are the steps to erase the eMMC flash memory on Apalis or Colibri modules from the U-Boot bootloader.
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
Note: Depending on the eMMC's size this command may take a very long time to complete.
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
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