How to completely erase Android from eMMC - TheMediocritist/RadxaZero_Experiments GitHub Wiki

1] Hold the USB Boot button and connect Zero to Linux PC.

2] Release the USB Boot button.

lsusb should show the followling VID/PID:

Bus 002 Device 030: ID 1b8e:c003 Amlogic, Inc. GX-CHIP

This means the Zero is in USB Boot mode

We use pyamlboot to load the fastboot loader on the Radxa Zero over USB cable. pyamlboot is a tool by @superna9999 for Amlogic USB Boot.

3] Install pyamlboot tool

pip3 install pyamlboot

4] Download the prebuilt fastboot loader:

wget https://dl.radxa.com/zero/images/loader/rz-fastboot-loader.bin

5] Load fastboot:

boot-g12.py rz-fastboot-loader.bin

It should output

Firmware Version :
ROM: 3.2 Stage: 0.0
Need Password: 0 Password OK: 1
Writing rz-fastboot-loader.bin at 0xfffa0000...
[DONE]
Running at 0xfffa0000...
[DONE]
AMLC dataSize=16384, offset=65536, seq=0...
[DONE]
AMLC dataSize=49152, offset=393216, seq=1...
[DONE]
AMLC dataSize=16384, offset=229376, seq=2...
[DONE]
AMLC dataSize=49152, offset=245760, seq=3...
[DONE]
AMLC dataSize=49152, offset=294912, seq=4...
[DONE]
AMLC dataSize=16384, offset=65536, seq=5...
[DONE]
AMLC dataSize=1406320, offset=81920, seq=6...
[DONE]
[BL2 END]

Now the Zero is in fastboot mode. You can check this using lsusb. If the Zero is in fastboot mode it will appear as 'Google Inc. USB download gadget.

lsusb
Bus 002 Device 032: ID 18d1:fada Google Inc. USB download gadget  Serial: AMLG12A-RADXA-ZERO

6] Use fastboot to erase the eMMC

fastboot devices
AMLG12A-RADXA-ZERO	fastboot
fastboot erase bootloader
Erasing 'bootloader'                               OKAY [  3.601s]
Finished. Total time: 3.613s
fastboot erase bootenv
fastboot erase bootenv
Erasing 'bootenv'                                  OKAY [  0.097s]
Finished. Total time: 0.110s

7] Now erase the eMMC user partition from offset 0:

fastboot erase 0
Erasing '0'                                        OKAY [ 17.574s]
Finished. Total time: 17.586s

The eMMC is completely wiped now, unplug and plug the USB C cable. Insert a bootable uSD card, the Zero should boot from it.

Bonus erase method:

sudo fastboot flashing unlock_critical
sudo fastboot flashing unlock
sudo fastboot erase bootloader
sudo fastboot erase bootloader-boot0
sudo fastboot erase bootloader-boot1