add function for device-specific wipe data features
Some devices want to do special things when recovery wipes data (eg, wipe data in their baseband processor as well). Add a hook in the device-specific recovery library that gets called when data is wiped. Also add an amend root for the "mbm" partition.
This commit is contained in:
parent
f8aaf0a77f
commit
b128f54d0d
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
|
1
roots.c
1
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]))
|
||||
|
Loading…
Reference in New Issue
Block a user