• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root [Help] Make a flashable zip to wipe data, cache and dalvik?

How would I go about to make a flashable zip for CWM to wipe my data, cache and dalvik-cache?

I am using Apps2zip to make a flashable app package for when I flash a ROM, but I'd love to be able to flash wipe all needed partitions.

You could try this:

# Wipe data and dalvik

ui_print(" Clearing data and dalvik");
mount("ext4", "EMMC", "/dev/block/mmcblk0p13", "/data");
delete_recursive("/data");

# Wipe cache

ui_print(" Clearing cache");
mount("ext4", "EMMC", "/dev/block/mmcblk0p6", "/cache");
delete_recursive("/cache");
 
Upvote 0
I found another flashable wipe zip to take a look and see what was happening. with it.

It has two files within the zip.
/META-INF/com/google/android/updater-script
/META-INF/com/google/android/updater-binary

The contents of the script are:
Code:
ui_print("Performing Wipe...");
ui_print("Mounting mount points...");
run_program("/sbin/mount", "/dev/block/platform/s3c-sdhci.0/by-name/system", "/system");
run_program("/sbin/mount", "/dev/block/platform/s3c-sdhci.0/by-name/userdata", "/data");
run_program("/sbin/mount", "/dev/block/mtdblock4", "/cache");
run_program("/sbin/mount", "/dev/block/mtdblock2", "/boot"); 
show_progress(0.1, 0);
ui_print("Wiping BOOT, CACHE, DATA, SYSTEM");
delete_recursive("/boot");
delete_recursive("/cache");
delete_recursive("/data");
delete_recursive("/system");
show_progress(0.1, 10);
ui_print("Unmounting mount points...");
run_program("/sbin/umount", "/system");
run_program("/sbin/umount", "/data");
run_program("/sbin/umount", "/cache");
ui_print("Wipe Complete.");

The binary is just gobbledy gook.

Thinking about it, I should make one that does system too for doing a nandroid restore and not all ROM will wipe the system partition like Leslie Ann's does.
 
Upvote 0
Thanks, I'll try this next time I flash.

If you don't mind telling me what you did? I appreciate that you did it, but I'm trying to learn more to help the community.

What is the update-binary file? Where did you get it?

After making the zip does it need to be signed? You make a zip with no compression correct?

(Normally I try and learn from stuff others ask and post and I find around the net, but this is something I've been unable to find any info.)
 
Upvote 0
Thanks, I'll try this next time I flash.

If you don't mind telling me what you did? I appreciate that you did it, but I'm trying to learn more to help the community.

What is the update-binary file? Where did you get it?

After making the zip does it need to be signed? You make a zip with no compression correct?

(Normally I try and learn from stuff others ask and post and I find around the net, but this is something I've been unable to find any info.)

Just read the updater-script in the ZIP I posted.

The update-binary is a compiled file and just about every flashable ZIP contains one version or another. You don't make changes to it yourself. The one I've been using lately is from an update.zip which Titanium Backup creates.

It does not need to be signed, that's what makes CWM so useful.

No compression is prob a good idea, but I'm not sure whether it matters or not.

More info: Free Your Android - An introduction to the Edify (Updater-Script) language
 
  • Like
Reactions: MacFett
Upvote 0
The thing that's going to matter is whether its written in edify or amend scripting, and which one your recovery uses

I was thinking it wouldn't work because the other phone probably uses mtd and so the script might just simply mount /data and /cache as opposed to specifying the partitions by mmcblk0p*. But yeah, if that is the case, it should be easy to update the script.

Isn't amend for CWM versions prior to v3?
 
Upvote 0
I was thinking it wouldn't work because the other phone probably uses mtd and so the script might just simply mount /data and /cache as opposed to specifying the partitions by mmcblk0p*. But yeah, if that is the case, it should be easy to update the script.

Isn't amend for CWM versions prior to v3?

I personally won't use Cwm, so I don't know at what point it switched. :thinking:

The recovery should handle the partitions and mounts. I would think the script should be easy enough to write
 
Upvote 0
The thing that's going to matter is whether its written in edify or amend scripting, and which one your recovery uses
Amend hasn't been used in a year, Edify has been standard since GB took over.

What it depends on is what the recovery supports (Amend or Edify), and what the install Binary is using, such as yaffs.

Another consideration is if the recovery know what partition is where. In our case the recovery doesn't understand that /system is located at block 12 so the installer has to account for that by telling it.



The link I posted has the flashable zips done for the Elite. They should work fine as they are based on the code used for formatting the roms.
 
  • Like
Reactions: Rxpert83
Upvote 0
Amend hasn't been used in a year, Edify has been standard since GB took over.

What it depends on is what the recovery supports (Amend or Edify), and what the install Binary is using, such as yaffs.

Another consideration is if the recovery know what partition is where. In our case the recovery doesn't understand that /system is located at block 12 so the installer has to account for that by telling it.



The link I posted has the flashable zips done. They should work fine as they are based on the code used for formatting the roms.

Ah, your phone complicates things then. Thanks for clearing that up.


There are still plenty of alternative recoveries out there that support both scripts
 
Upvote 0
Thanks, I'll try this next time I flash.

If you don't mind telling me what you did? I appreciate that you did it, but I'm trying to learn more to help the community.

What is the update-binary file? Where did you get it?

After making the zip does it need to be signed? You make a zip with no compression correct?

(Normally I try and learn from stuff others ask and post and I find around the net, but this is something I've been unable to find any info.)

It seems like you use CWM, but the TWRP website has a binary to use that seems to work on all.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones