Use raw partition functions for emmc
Change-Id: Ia5d9f18d43228a08f12633d432b299def8e26ae1
This commit is contained in:
parent
a25cf5ec4f
commit
066a1027a4
@ -278,9 +278,30 @@ mmc_scan_partitions() {
|
||||
return g_mmc_state.partition_count;
|
||||
}
|
||||
|
||||
static const MmcPartition *
|
||||
mmc_find_partition_by_device_index(const char *device_index)
|
||||
{
|
||||
if (g_mmc_state.partitions != NULL) {
|
||||
int i;
|
||||
for (i = 0; i < g_mmc_state.partitions_allocd; i++) {
|
||||
MmcPartition *p = &g_mmc_state.partitions[i];
|
||||
if (p->device_index !=NULL && p->name != NULL) {
|
||||
if (strcmp(p->device_index, device_index) == 0) {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const MmcPartition *
|
||||
mmc_find_partition_by_name(const char *name)
|
||||
{
|
||||
if (name[0] == '/') {
|
||||
return mmc_find_partition_by_device_index(name);
|
||||
}
|
||||
|
||||
if (g_mmc_state.partitions != NULL) {
|
||||
int i;
|
||||
for (i = 0; i < g_mmc_state.partitions_allocd; i++) {
|
||||
|
@ -109,7 +109,8 @@ int nandroid_backup_partition(const char* backup_path, const char* root) {
|
||||
// see if we need a raw backup (mtd)
|
||||
char tmp[PATH_MAX];
|
||||
int ret;
|
||||
if (strcmp(vol->fs_type, "mtd") == 0) {
|
||||
if (strcmp(vol->fs_type, "mtd") == 0 ||
|
||||
strcmp(vol->fs_type, "emmc") == 0) {
|
||||
const char* name = basename(root);
|
||||
sprintf(tmp, "%s/%s.img", backup_path, name);
|
||||
ui_print("Backing up %s image...\n", name);
|
||||
@ -280,7 +281,8 @@ int nandroid_restore_partition(const char* backup_path, const char* root) {
|
||||
|
||||
// see if we need a raw restore (mtd)
|
||||
char tmp[PATH_MAX];
|
||||
if (strcmp(vol->fs_type, "mtd") == 0) {
|
||||
if (strcmp(vol->fs_type, "mtd") == 0 ||
|
||||
strcmp(vol->fs_type, "emmc") == 0) {
|
||||
int ret;
|
||||
const char* name = basename(root);
|
||||
ui_print("Erasing %s before restore...\n", name);
|
||||
|
Loading…
Reference in New Issue
Block a user