====== Erase eMMC ======
===== Introduction =====
This document mainly introduces the method of clearing eMMC. You will learn about 3 methods to clear eMMC.
The operation of VIM1, VIM2 and VIM3 is almost the same, so this document will take VIM3L as an example.
===== Erase Method =====
* Refer to this [[products:sbc:common:development:setup-serial-tool|guide]] to setup the Serial Tool for your VIM.
* Once again, ensure you’ve done the correct connections and setup.
* Hit any keys at the moment of bootup to stop autoboot. This step will make your VIM enter into u-boot mode.
* Type ''store erase boot'' on the terminal of u-boot, and wait for the erasure process to complete.
* Type reboot or press the ''Reset'' button.
* Use the following as a reference:
```shell
kvim3#store init 3
XXXXXXX======enter EMMC boot======XXXXXX
co-phase 0x1, tx-dly 0, clock 40000000
co-phase 0x1, tx-dly 0, clock 40000000
co-phase 0x3, tx-dly 0, clock 400000
emmc/sd response timeout, cmd8, cmd->cmdarg=0x1aa, status=0x3ff2800
emmc/sd response timeout, cmd55, cmd->cmdarg=0x0, status=0x3ff2800
co-phase 0x3, tx-dly 0, clock 400000
co-phase 0x1, tx-dly 0, clock 40000000
[set_emmc_calc_fixed_adj][860]find fixed adj_delay=20
init_part() 297: PART_TYPE_AML
[mmc_init] mmc init success
switch to partitions #0, OK
mmc1(part 0) is current device
Device: SDIO Port C
Manufacturer ID: 15
OEM: 100
Name: AJTD4
Tran Speed: 52000000
Rd Block Len: 512
MMC version 5.1
High Capacity: Yes
Capacity: (0x3a3e00000 Bytes) 14.6 GiB
mmc clock: 40000000
Bus Width: 8-bit
[store]amlmmc erase 1emmckey_is_protected(): protect
bootloader partition is erased: start = 0x0,end = 0x1fff
reserved partition is protected
env partition is erased: start = 0x36000,end = 0x39fff
rootfs partition is erased: start = 0x3e000,end = 0x1d1efff
Erasing blocks 0 to 8192 @ boot0
start = 0x0,end = 0x1fff
Erasing blocks 0 to 8192 @ boot1
start = 0x0,end = 0x1fff
```
This approach is suitable for all products that use the Amlogic SoC:
* Carry out normal upgrading via [[start|USB-C Cable]] or [[/products/sbc/common/install-os/install-os-into-external-storage|TF Card]].
* Manually interrupt the upgrading process (forcefully disconnect after 15% is recommended). For example, unplug the USB-C cable or the TF card.
* Power on your VIM again, and you’ll find that all the data on the eMMC has been erased.
This approach is suitable for a VIM that has Linux installed:
Power on and boot up.
Open a terminal, and run ''dd'' to fill your bootloader partition with zeros:
```shell
root@Khadas:~# dd if=/dev/zero of=/dev/bootloader
dd: writing to '/dev/bootloader': No space left on device
8193+0 records in
8192+0 records out
4194304 bytes (4.2 MB, 4.0 MiB) copied, 1.1226 s, 3.7 MB/s
root@Khadas:~# reboot
```