Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[ICS-JB][Samsung] Safe No Brick Wipe Data/System/Cache/Dalvik from recovery

OP Phil3759

22nd September 2012, 05:38 AM   |  #11  
kenshinjar's Avatar
Senior Member
Flag Nha Trang
Thanks Meter: 31
 
144 posts
Join Date:Joined: Jul 2012
More
Hi Phil3759,
can I use this for Note GT-N7000, which official Rom or custom Rom?
waiting for your reply. thanks
22nd September 2012, 10:07 AM   |  #12  
Phil3759's Avatar
OP Recognized Developer
Thanks Meter: 31,864
 
9,387 posts
Join Date:Joined: May 2012
Donate to Me
Yes, it will be safe on the note, no format commands issued

Sent from my GT-I9100 using Tapatalk 2
The Following User Says Thank You to Phil3759 For This Useful Post: [ View ]
24th September 2012, 04:39 AM   |  #13  
Senior Recognized Developer
Flag Owego, NY
Thanks Meter: 24,608
 
13,446 posts
Join Date:Joined: Aug 2007
Donate to Me
More
Quote:
Originally Posted by Phil3759


Code:
ui_print("***************************");
ui_print("Wipe data-cache-system");
ui_print("Samsung Phones Only");
ui_print("***************************");
show_progress(1.000000, 0);

ui_print("Checking Samsung Phone...");
assert(getprop("ro.product.manufacturer") == "samsung");
set_progress(0.100000);

ui_print("Mounting partitions");
mount("ext4", "EMMC", "/dev/block/mmcblk0p9", "/system");
mount("ext4", "EMMC", "/dev/block/mmcblk0p7", "/cache");
mount("ext4", "EMMC", "/dev/block/mmcblk0p10", "/data");
set_progress(0.200000);

ui_print("Delete Cache Partition");
delete_recursive("/cache");
set_progress(0.400000);

ui_print("Delete Data Partition");
delete_recursive("/data");
set_progress(0.600000);

ui_print("Delete System Partition");
delete_recursive("/system");
set_progress(0.900000);

###############################################################################
############################ Formatting partitions ############################
#### You need to unmount (ALL?) partitions before formatting one partition ####
# unmount("/cache");
# unmount("/data");
# unmount("/system");
# format("ext4", "EMMC", "/dev/block/mmcblk0p9", "0");

#### Then remount if you intend to use it later in teh script ####
# mount("ext4", "EMMC", "/dev/block/mmcblk0p9", "/system");
# mount("ext4", "EMMC", "/dev/block/mmcblk0p7", "/cache");
# mount("ext4", "EMMC", "/dev/block/mmcblk0p10", "/data");

#### wipe dalvik-cache ####
# mount("ext4", "EMMC", "/dev/block/mmcblk0p10", "/data");
# delete_recursive("/data/dalvik-cache");
# unmount("/data");
#### wipe dalvik-cache done ####

#### Mount in busybox ####
# run_program("/sbin/mount", "/dev/block/mmcblk0p7", "/cache");
# run_program("/sbin/mount", "/dev/block/mmcblk0p10", "/data");
# run_program("/sbin/mount", "/dev/block/mmcblk0p9", "/system");
#### internal sd ####
# run_program("/sbin/mount", "/dev/block/mmcblk0p11", "/sdcard");
###############################################################################

ui_print("Unmounting Partitions");
unmount("/cache");
unmount("/data");
unmount("/system");
set_progress(1.000000);
show_progress(1.000000, 0);

ui_print("Wipe complete!");
ui_print("Reboot in download mode");
ui_print("Flash a full ROM in Odin");
ui_print("by Phil3759@xda-developers.com");

delete_recursive can leave the filesystem in an unclean state. Using this workaround is not advisable.

It is better to use an update-binary that has been rendered safe by building with BOARD_SUPPRESS_EMMC_WIPE.

Run this to check an update-binary for safety:
Code:
strings update-binary |grep MMC
It should return:
Code:
warning: %s: Wipe via secure discard suppressed due to bug in EMMC firmware
Any update-binary versions that have that string are safe to use.
The Following 2 Users Say Thank You to Entropy512 For This Useful Post: [ View ]
24th September 2012, 07:43 AM   |  #14  
Phil3759's Avatar
OP Recognized Developer
Thanks Meter: 31,864
 
9,387 posts
Join Date:Joined: May 2012
Donate to Me
Quote:
Originally Posted by Entropy512

delete_recursive can leave the filesystem in an unclean state. Using this workaround is not advisable.

It is better to use an update-binary that has been rendered safe by building with BOARD_SUPPRESS_EMMC_WIPE.

Run this to check an update-binary for safety:

Code:
strings update-binary |grep MMC
It should return:
Code:
warning: %s: Wipe via secure discard suppressed due to bug in EMMC firmware
Any update-binary versions that have that string are safe to use.

Thank you a lot for the input.

However, Chainfire just answered me in his CF-Root for the n7000 that using format commands in update.zip could still brick an unsafe kernel whatever recovery (patched or non patched) it uses. Now, you say that a patched binary in update.zip will make it safe what ever kernel/recovery combo it is

If you confirm it, I will update my post. CF disagree the use of format commands in update.zip (yes, I know, if there are FS errors, they will not be fixed without format)
The Following User Says Thank You to Phil3759 For This Useful Post: [ View ]
25th September 2012, 02:23 PM   |  #15  
shoey63's Avatar
Recognized Contributor
Flag Somewhere in Oz...
Thanks Meter: 1,420
 
2,309 posts
Join Date:Joined: Jun 2012
More
Good news Phil! Ran Entropys command on Temp CWM Touch 6.0.12 update-binary and got this "ubuntu@ubuntu:~/Desktop/binary$ strings update-binary |grep MMC
warning: %s: Wipe via secure discard suppressed due to bug in EMMC firmware
EMMC
EMMC:" Unfortunately doesn't produce same result in update-binary for ur wiping script. So simply swap update binary, change "delete-recursive" to "format", re-sign file and job done right? (That's assuming u trust Entropy, and who doesn't?)
Last edited by shoey63; 14th October 2012 at 11:30 AM.
8th October 2012, 09:32 PM   |  #16  
Phil3759's Avatar
OP Recognized Developer
Thanks Meter: 31,864
 
9,387 posts
Join Date:Joined: May 2012
Donate to Me
Update 08.10.2012:
Quote:

Following Entropy512 recommendations, I updated the binary-update to a safe one.
Now format commands are used in script instead of delete_recursive.
This makes the wipe much clean if some file system errors are present

Special thanks to shoey63 for his contribution

22nd October 2012, 01:54 PM   |  #17  
shoey63's Avatar
Recognized Contributor
Flag Somewhere in Oz...
Thanks Meter: 1,420
 
2,309 posts
Join Date:Joined: Jun 2012
More
Well it's one thing to contribute theoretical information, but it's another to actually go ahead and do it! I hope Entropy is right, I'm about to use script to do factory reset based on his assertion that "format" commands in zips with update binarys that contain "secure discard supressed" are safe.

---------- Post added at 07:54 PM ---------- Previous post was at 07:10 PM ----------

Entropy's right! No problems whatsoever Flashed factory reset, format commands and all. and the patched update-binary prevented my Note from bricking! It only took seconds (Man.... that was a wild ride)
The Following User Says Thank You to shoey63 For This Useful Post: [ View ]
22nd October 2012, 10:07 PM   |  #18  
albertorodast2007's Avatar
Senior Member
Flag Guatemala
Thanks Meter: 50
 
600 posts
Join Date:Joined: Oct 2010
More
There's no updated binaries zip file for wiping dalvik right?

Sent from my GT-I9100 using xda premium
23rd October 2012, 08:00 AM   |  #19  
shoey63's Avatar
Recognized Contributor
Flag Somewhere in Oz...
Thanks Meter: 1,420
 
2,309 posts
Join Date:Joined: Jun 2012
More
Quote:
Originally Posted by albertorodast2007

There's no updated binaries zip file for wiping dalvik right?

Sent from my GT-I9100 using xda premium

Looks like PhilZ forgot. Im sure he will get around to it. The old one is safe too. Just wont work if there is file corruption.


Sent from my GT-N7000 using xda app-developers app
23rd October 2012, 08:00 AM   |  #20  
Junior Member
Thanks Meter: 6
 
28 posts
Join Date:Joined: Dec 2008
nice and simple, great work !

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes