summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--default_recovery_ui.c4
-rw-r--r--recovery.c9
-rw-r--r--recovery_ui.h8
-rw-r--r--roots.c1
4 files changed, 20 insertions, 2 deletions
diff --git a/default_recovery_ui.c b/default_recovery_ui.c
index 76fa43ea9..a2e4beafe 100644
--- a/default_recovery_ui.c
+++ b/default_recovery_ui.c
@@ -59,3 +59,7 @@ int device_handle_key(int key_code, int visible) {
int device_perform_action(int which) {
return which;
}
+
+int device_wipe_data() {
+ return 0;
+}
diff --git a/recovery.c b/recovery.c
index 8ad133948..499fda574 100644
--- a/recovery.c
+++ b/recovery.c
@@ -354,6 +354,7 @@ prompt_and_wait()
case ITEM_WIPE_DATA:
ui_print("\n-- Wiping data...\n");
+ device_wipe_data();
erase_root("DATA:");
erase_root("CACHE:");
ui_print("Data wipe complete.\n");
@@ -463,10 +464,14 @@ main(int argc, char **argv)
if (update_package != NULL) {
status = install_package(update_package);
if (status != INSTALL_SUCCESS) ui_print("Installation aborted.\n");
- } else if (wipe_data || wipe_cache) {
- if (wipe_data && erase_root("DATA:")) status = INSTALL_ERROR;
+ } else if (wipe_data) {
+ if (device_wipe_data()) status = INSTALL_ERROR;
+ if (erase_root("DATA:")) status = INSTALL_ERROR;
if (wipe_cache && erase_root("CACHE:")) status = INSTALL_ERROR;
if (status != INSTALL_SUCCESS) ui_print("Data wipe failed.\n");
+ } else if (wipe_cache) {
+ if (wipe_cache && erase_root("CACHE:")) status = INSTALL_ERROR;
+ if (status != INSTALL_SUCCESS) ui_print("Cache wipe failed.\n");
} else {
status = INSTALL_ERROR; // No command specified
}
diff --git a/recovery_ui.h b/recovery_ui.h
index 86f540b6e..671fe40ce 100644
--- a/recovery_ui.h
+++ b/recovery_ui.h
@@ -48,6 +48,14 @@ extern int device_handle_key(int key, int visible);
// information to the screen.
extern int device_perform_action(int which);
+// Called when we do a wipe data/factory reset operation (either via a
+// reboot from the main system with the --wipe_data flag, or when the
+// user boots into recovery manually and selects the option from the
+// menu.) Can perform whatever device-specific wiping actions are
+// needed. Return 0 on success. The userdata and cache partitions
+// are erased after this returns (whether it returns success or not).
+int device_wipe_data();
+
#define NO_ACTION -1
#define HIGHLIGHT_UP -2
diff --git a/roots.c b/roots.c
index 6a6cf8adc..8f8dacebf 100644
--- a/roots.c
+++ b/roots.c
@@ -52,6 +52,7 @@ static RootInfo g_roots[] = {
{ "RECOVERY:", g_mtd_device, NULL, "recovery", "/", g_raw },
{ "SDCARD:", "/dev/block/mmcblk0p1", "/dev/block/mmcblk0", NULL, "/sdcard", "vfat" },
{ "SYSTEM:", g_mtd_device, NULL, "system", "/system", "yaffs2" },
+ { "MBM:", g_mtd_device, NULL, "mbm", NULL, g_raw },
{ "TMP:", NULL, NULL, NULL, "/tmp", NULL },
};
#define NUM_ROOTS (sizeof(g_roots) / sizeof(g_roots[0]))