Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:vim1s:development:erase-emmc

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
products:sbc:vim1s:development:erase-emmc [2022/07/17 21:31]
127.0.0.1 external edit
products:sbc:vim1s:development:erase-emmc [2022/08/24 02:00] (current)
hyphop old revision restored (2022/08/23 15:37)
Line 1: Line 1:
-====== VIM4 Erase eMMC ======+====== VIM1S Erase eMMC bootloader ======
  
-There are 3 ways to erase the eMMC:+We have several different ways to erase bootloader. 
 +=====U-Boot console======
  
-  * Serial Mode (Developers) 
-  * Interrupt Mode 
-  * CLI Mode 
  
-<tabbox Serial Mode (Developers)> +  - Connect your PC to the SBC using a [[products:sbc:vim1s:development:setup-serial-tool|Serial Debug Tool]]. 
- +  - As the SBC is booting-up, press ''SPACE''on the keyboard to enter the U-Boot mode.
-  - Connect your PC to your SBC using a [[products:sbc:vim4:development:setup-serial-tool|Serial Debug Tool]]. +
-  - Just as your SBC is booting-up, hit ''SPACE'' on your keyboard to enter U-Boot mode.+
   - Type ''store boot_erase bootloader'' into the U-Boot console, and wait for the erasure process to complete.   - Type ''store boot_erase bootloader'' into the U-Boot console, and wait for the erasure process to complete.
-  - After erasure is complete, type ''reboot'' or press the ''RESET'' button on your SBC.+  - After erasure is completed, type ''reboot'' or press the ''RESET'' button on your SBC.
  
 Use the following serial Terminal print-out as a reference: Use the following serial Terminal print-out as a reference:
  
-``` +```shell 
-kvim4# store boot_erase bootloader+kvim1s# store boot_erase bootloader
 GUID Partition Table Header signature is wrong: 0x0 != 0x5452415020494645 GUID Partition Table Header signature is wrong: 0x0 != 0x5452415020494645
 GUID Partition Table Header signature is wrong: 0x0 != 0x5452415020494645 GUID Partition Table Header signature is wrong: 0x0 != 0x5452415020494645
Line 39: Line 35:
  
 8191 blocks erased: OK 8191 blocks erased: OK
-kvim4# reboot+kvim1s# reboot
 ``` ```
  
Line 45: Line 41:
  
 ```txt ```txt
-T7:BL:055c20;ID:7CFDCF5E6052BDEC;FEAT:30F:1FFF0000:B002F:1;POC:CF;RCY:0;OVD:0;DFU:0;SD:2002;eMMC:0;RD-0:0;CHK:1;RD-1:0;CHK:1;RD-2:0;CHK:1;SPINOR:0;RD-0:0;CHK:1;RD-1:0;CHK:1;USB:ADFU�T7:BL:055c20;ID:7CFDCF5E6052BDEC;FEAT:30F:1FFF0000:B002F:1;POC:CF;RCY:0;OVD:0;DFU:1;USB:0;RD-00:0;+S4:BL:25dcde;ID:00D9C31D04901F08;FEAT:30F:1FFF0000:B002F:1;POC:DD;RCY:0;OVD:0;DFU:0;USB:ADFU�S4:BL:25dcde;ID:00D9C31D04901F08;FEAT:30F:1FFF0000:B002F:1;POC:DD;RCY:0;OVD:0;DFU:1;USB:0;RD-00:0;
 ``` ```
  
-<tabbox Interrupt Mode>+===== Interrupt Mode =====
  
 This erasure method is suitable for all products that use the Amlogic SoC: This erasure method is suitable for all products that use the Amlogic SoC:
  
-  - Carry out eMMC flashing via a [[products:sbc:vim4:install-os:install-os-into-emmc-via-usb-tool|USB-C cable]].+  - Carry out eMMC flashing via a [[products:sbc:vim1s:install-os:install-os-into-emmc-via-usb-tool|USB-C cable]].
   - Manually interrupt the upgrading process (forcefully disconnect after 15% is recommended). For example, unplug the USB-C cable or eject the TF card.   - Manually interrupt the upgrading process (forcefully disconnect after 15% is recommended). For example, unplug the USB-C cable or eject the TF card.
   - Power on your SBC again, and you'll find that all the data on the eMMC has been erased.   - Power on your SBC again, and you'll find that all the data on the eMMC has been erased.
  
-<tabbox CLI Mode>+===== Linux command-line =====
  
-This erasure method is suitable for an SBC with Linux installed:+eMMC boot-loader can be stored on ''/dev/mmcblk0'' and special areas ''/dev/mmcblk0boot0'' or ''/dev/mmcblk0boot0''
 + 
 +==== Cleanup eMMC boot loaders ==== 
 + 
 +Cleanup special eMMC boot areas.  
 + 
 +```sh 
 +dd if=/dev/zero count=8192 | sudo tee /dev/mmcblk?boot? >/dev/null 
 +``` 
 + 
 +Also need cleanup eMMC common boot area.  
 + 
 +```sh 
 +sudo dd if=/dev/zero count=2000 seek=1 of=/dev/mmcblk0 
 +``` 
 + 
 +<WRAP important > 
 +''/dev/mmcblk0'' maybe different, please check how-to [[#get-block-device-names-for-boot-loaders]] 
 +</WRAP> 
 + 
 +==== Universal method for cleanup all eMMC boot-areas ==== 
 + 
 +```sh 
 +sudo dd if=/dev/zero count=8192 | sudo tee /dev/mmcblk?boot? >/dev/null 
 +sudo dd if=/dev/zero count=2000 seek=1 of=$(ls /dev/mmcblk?boot?|grep -m1 -o /dev/mmcblk.) 
 + 
 +``` 
 + 
 +==== Get block-device names for boot loaders ==== 
 + 
 +Get block-device names for special boot areas. 
 + 
 +```shell 
 +~$ ls -1 /dev/mmcblk?boot? /dev/bootloader? 
 +/dev/bootloader0 
 +/dev/bootloader1 
 +/dev/mmcblk0boot0 
 +/dev/mmcblk0boot1 
 +``` 
 +<WRAP important > 
 +''/dev/bootloader?'' same areas as ''/dev/mmcblk?boot?'', but shifted by 512 bytes 
 +</WRAP> 
 + 
 +Get eMMC block-device name. 
 + 
 +```shell 
 +~$ ls -1 $(ls /dev/mmcblk?boot?|grep -m1 -o /dev/mmcblk.) 
 +/dev/mmcblk0 
 +``` 
 + 
 +==== How-to check boot loaders content ==== 
 + 
 +This example display empty content for special boot-loaders areas. 
 + 
 +```shell 
 +~$ for m in /dev/bootloader?;do echo $m; dd if=$m count=1 2>/dev/null | hexdump -C ;done  
 + 
 +/dev/bootloader0 
 +00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................| 
 +
 +00000200 
 +/dev/bootloader1 
 +00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................| 
 +
 +00000200 
 + 
 +``` 
 + 
 +Display same but for other boot areas names. 
 + 
 +```shell 
 +~$ for m in /dev/mmcblk?boot?;do echo $m; dd if=$m skip=1 count=1 2>/dev/null | hexdump -C ;done  
 + 
 +/dev/mmcblk2boot0 
 +00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................| 
 +
 +00000200 
 +/dev/mmcblk2boot1 
 +00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................| 
 +
 +00000200 
 +``` 
 + 
 +Next example display valid boot loader header ''@ML''
 + 
 +```shell 
 +~$ dd if=/dev/mmcblk0 count=1 skip=1 2>/dev/null | hexdump -C | head -n1 
 +00000000  40 4d 4c 20 8d 66 31 ed  00 00 00 00 80 05 00 00  |@ML .f1.........| 
 +``` 
 + 
 +/* 
 +This erasure method is suitable for the SBC with Linux installed:
  
   - Power on and boot up.   - Power on and boot up.
   - Open a Terminal, and run ''dd'' to fill your bootloader partition with zeros:   - Open a Terminal, and run ''dd'' to fill your bootloader partition with zeros:
  
-```sh+ 
 +```shell
 khadas@Khadas:~$ sudo dd if=/dev/zero of=/dev/bootloader khadas@Khadas:~$ sudo dd if=/dev/zero of=/dev/bootloader
 dd: writing to '/dev/bootloader': No space left on device dd: writing to '/dev/bootloader': No space left on device
Line 71: Line 159:
 root@Khadas:~# reboot root@Khadas:~# reboot
 ``` ```
-</tabbox>+*/
Last modified: 2022/07/17 21:31 by 127.0.0.1