Wipe data / Factory reset via ADB

This is basically my problem /

I have another 200 Android phones that need to be erased (in Wipe Data / Factory Reset mode), and then install a new ROM with some additional apks.

Currently, everything is automated for me, except for the Wipe Data part. Everything else can be done through .bat with a set of commands quite happily, but I can’t understand for the rest of my life how to imitate or force the recovery mode to erase data.

Things I was trying now:

  • Removing the data itself with rm -r * in the folders that it should execute (data, cache, sd-ext, etc.). This wipes, but then the ROM does not work properly and gets stuck in the boot machine.
  • Trying to use "adb input keyevent" to simulate keystrokes. I have no idea what they are mapped to, because they are mostly in the UNIX shell, and even then there is no “input” because the OS was not loaded anyway.
  • Trying to find the / script file on a system that actually launches wipe / reset and then launches it manually. This might be the easiest way, since it has already been written for me somewhere, but I just don’t see where it is hidden, even in something like CWM.

If anyone has any method thanks to which I could make this Factory Reset via .bat or through adb shell, I would really appreciate it. I tried to solve this problem for about 2 days with little success.

+52
android reset recovery adb
May 30 '12 at 13:52
source share
1 answer

After many searches, I finally finished downloading the source code for the Android recovery partition. It turns out you can send recovery commands.

* The arguments which may be supplied in the recovery.command file: * --send_intent=anystring - write the text out to recovery.intent * --update_package=path - verify install an OTA package file * --wipe_data - erase user data (and cache), then reboot * --wipe_cache - wipe cache (but not user data), then reboot * --set_encrypted_filesystem=on|off - enables / diasables encrypted fs 

These are commands that you can use according to the one I found, but which may differ for modified files. Therefore, using adb, you can do this:

 adb shell recovery --wipe_data 

Using --wipe_data seemed to do what I was looking for, which was convenient, although I have not yet fully tested it at the moment.

EDIT:

For those still using this section, these commands may vary depending on which recovery you are using. If you use temporary word recovery, these commands should still work. Other commands can be found in / cache / recovery / command

For more information see here: https://github.com/CyanogenMod/android_bootable_recovery/blob/cm-10.2/recovery.c

+53
May 31 '12 at 8:02
source share



All Articles