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


  1. MacFett

    MacFett Well-Known Member

    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.

    Advertisement
    :
  2. ktb83

    ktb83 Well-Known Member

    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");
  3. MacFett

    MacFett Well-Known Member

    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 (Text):
    1. ui_print("Performing Wipe...");
    2. ui_print("Mounting mount points...");
    3. run_program("/sbin/mount", "/dev/block/platform/s3c-sdhci.0/by-name/system", "/system");
    4. run_program("/sbin/mount", "/dev/block/platform/s3c-sdhci.0/by-name/userdata", "/data");
    5. run_program("/sbin/mount", "/dev/block/mtdblock4", "/cache");
    6. run_program("/sbin/mount", "/dev/block/mtdblock2", "/boot");
    7. show_progress(0.1, 0);
    8. ui_print("Wiping BOOT, CACHE, DATA, SYSTEM");
    9. delete_recursive("/boot");
    10. delete_recursive("/cache");
    11. delete_recursive("/data");
    12. delete_recursive("/system");
    13. show_progress(0.1, 10);
    14. ui_print("Unmounting mount points...");
    15. run_program("/sbin/umount", "/system");
    16. run_program("/sbin/umount", "/data");
    17. run_program("/sbin/umount", "/cache");
    18. 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.
  4. ktb83

    ktb83 Well-Known Member

  5. MacFett

    MacFett Well-Known Member

    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.)
  6. ktb83

    ktb83 Well-Known Member

    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
    MacFett likes this.
  7. mysticalnyte

    mysticalnyte Well-Known Member

    I've got two of them. One for installing a new rom and one for updating a rom that LeslieAnn made when I had my OV.
    Will post when I get home in a bit.
  8. kwknott

    kwknott Well-Known Member Contributor

    They won't work for elite. The ov was yaffs file system and elite is ext4.

    Even if they were the same file system the partitions more than likely wouldn't be the same.
  9. mysticalnyte

    mysticalnyte Well-Known Member

    I tested the Prep for a new rom and it seemed to work fine, but I didn't test the update for a new rom.
    Oh, well. Ok then.
  10. kwknott

    kwknott Well-Known Member Contributor

    Maybe I'm wrong then.. I thought the difference in file system and partitions would prevent it from working . They made be made in a way that might work. I'll have to look at them
  11. ktb83

    ktb83 Well-Known Member

    I wouldn't think it would work either, but I could be wrong.
  12. Rxpert83

    Rxpert83 Dr. Feelgood Moderator

    The thing that's going to matter is whether its written in edify or amend scripting, and which one your recovery uses
  13. ktb83

    ktb83 Well-Known Member

    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?
  14. Rxpert83

    Rxpert83 Dr. Feelgood Moderator

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

    The recovery should handle the partitions and mounts. I would think the script should be easy enough to write
  15. Leslie Ann

    Leslie Ann Well-Known Member

    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.
    Rxpert83 likes this.
  16. Rxpert83

    Rxpert83 Dr. Feelgood Moderator

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


    There are still plenty of alternative recoveries out there that support both scripts
  17. Leslie Ann

    Leslie Ann Well-Known Member

    Yes, many still do, but they are slowly falling by the wayside.

    Edify is simpler and can do more.
  18. TheByteSmasher

    TheByteSmasher Well-Known Member

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

    MacFett Well-Known Member

    CWM is the only working recovery for the Elite right now.
  20. TheByteSmasher

    TheByteSmasher Well-Known Member

    OK.. but the zips from my thread that you downloaded used the TWRP binary... they worked, right?
  21. MacFett

    MacFett Well-Known Member

    The zips i got from you were used on a nexus4 and worked fine.
  22. TheByteSmasher

    TheByteSmasher Well-Known Member

    Oh yeah... but the binary from those should work on any system really.
Loading...

Share This Page