Use raw partition functions for emmc

Change-Id: Ia5d9f18d43228a08f12633d432b299def8e26ae1
This commit is contained in:
Christopher Lais 2011-01-16 06:02:34 -06:00
parent a25cf5ec4f
commit 066a1027a4
3 changed files with 29 additions and 2 deletions

View File

@ -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++) {

View File

@ -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);

View File

@ -248,6 +248,10 @@ int format_volume(const char* volume) {
return 0;
}
if (strcmp(v->fs_type, "emmc") == 0) {
return erase_raw_partition(v->device);
}
if (strcmp(v->fs_type, "ext4") == 0) {
reset_ext4fs_info();
int result = make_ext4fs(v->device, NULL, NULL, 0, 0, 0);