diff options
author | Andres Morales <anmorales@google.com> | 2015-03-30 20:56:57 +0000 |
---|---|---|
committer | Andres Morales <anmorales@google.com> | 2015-04-01 22:43:35 +0000 |
commit | c94fa0b01b43709531dfbcdb94abb2a1cc23be3d (patch) | |
tree | 4fe170dd5cbb6a0f3b61576538e301d9d7c1bfff | |
parent | 18f371d814b26132aadf11de6cc305f02484535a (diff) | |
download | bootable_recovery-c94fa0b01b43709531dfbcdb94abb2a1cc23be3d.zip bootable_recovery-c94fa0b01b43709531dfbcdb94abb2a1cc23be3d.tar.gz bootable_recovery-c94fa0b01b43709531dfbcdb94abb2a1cc23be3d.tar.bz2 |
DO NOT MERGE Revert "Erase PST partition if its marked to be erased."
This now gets done at the framework level. Doing it here breaks the signature on the partition.
This reverts commit ee19387905650cab5da7dd97ada5502cd17ac93d.
Bug: 19967123
Change-Id: I447b926b733ca145f11a916d9569ce39889db627
-rw-r--r-- | recovery.cpp | 2 | ||||
-rw-r--r-- | roots.cpp | 37 | ||||
-rw-r--r-- | roots.h | 5 |
3 files changed, 0 insertions, 44 deletions
diff --git a/recovery.cpp b/recovery.cpp index 6deeaaa..575e287 100644 --- a/recovery.cpp +++ b/recovery.cpp @@ -716,7 +716,6 @@ wipe_data(int confirm, Device* device) { device->WipeData(); erase_volume("/data"); erase_volume("/cache"); - erase_persistent_partition(); ui->Print("Data wipe complete.\n"); } @@ -1122,7 +1121,6 @@ main(int argc, char **argv) { if (device->WipeData()) status = INSTALL_ERROR; if (erase_volume("/data")) status = INSTALL_ERROR; if (wipe_cache && erase_volume("/cache")) status = INSTALL_ERROR; - if (erase_persistent_partition() == -1 ) status = INSTALL_ERROR; if (status != INSTALL_SUCCESS) ui->Print("Data wipe failed.\n"); } else if (wipe_cache) { if (wipe_cache && erase_volume("/cache")) status = INSTALL_ERROR; @@ -39,8 +39,6 @@ static struct fstab *fstab = NULL; extern struct selabel_handle *sehandle; -static const char* PERSISTENT_PATH = "/persistent"; - void load_volume_table() { int i; @@ -266,41 +264,6 @@ int format_volume(const char* volume) { return -1; } -int erase_persistent_partition() { - Volume *v = volume_for_path(PERSISTENT_PATH); - if (v == NULL) { - // most devices won't have /persistent, so this is not an error. - return 0; - } - - int fd = open(v->blk_device, O_RDWR); - uint64_t size = get_file_size(fd); - if (size == 0) { - LOGE("failed to stat size of /persistent\n"); - close(fd); - return -1; - } - - char oem_unlock_enabled; - lseek(fd, size - 1, SEEK_SET); - read(fd, &oem_unlock_enabled, 1); - - if (oem_unlock_enabled) { - if (wipe_block_device(fd, size)) { - LOGE("error wiping /persistent: %s\n", strerror(errno)); - close(fd); - return -1; - } - - lseek(fd, size - 1, SEEK_SET); - write(fd, &oem_unlock_enabled, 1); - } - - close(fd); - - return (int) oem_unlock_enabled; -} - int setup_install_mounts() { if (fstab == NULL) { LOGE("can't set up install mounts: no fstab loaded\n"); @@ -46,11 +46,6 @@ int format_volume(const char* volume); // mounted (/tmp and /cache) are mounted. Returns 0 on success. int setup_install_mounts(); -// Conditionally wipes the /persistent partition if it's marked -// to wipe. Returns -1 on failure, 1 if the partition was wiped -// and 0 if the partition was not wiped. -int erase_persistent_partition(); - #ifdef __cplusplus } #endif |