Fix mount USB storage bug. Fix bug where boot image was not being restored by Nandroid.

This commit is contained in:
Koushik K. Dutta 2010-03-16 13:34:51 -07:00
parent 23116c95c7
commit f721594cd0
2 changed files with 16 additions and 9 deletions

View File

@ -352,7 +352,7 @@ void show_nandroid_restore_menu()
void show_mount_usb_storage_menu()
{
system("echo /dev/block/mmcblk0 > /sys/devices/platform/usb_mass_storage/lun0/file");
__system("echo /dev/block/mmcblk0 > /sys/devices/platform/usb_mass_storage/lun0/file");
static char* headers[] = { "USB Mass Storage device",
"Leaving this menu unmount",
"your SD card from your PC.",
@ -369,8 +369,8 @@ void show_mount_usb_storage_menu()
break;
}
system("echo '' > /sys/devices/platform/usb_mass_storage/lun0/file");
system("echo 0 > /sys/devices/platform/usb_mass_storage/lun0/enable");
__system("echo '' > /sys/devices/platform/usb_mass_storage/lun0/file");
__system("echo 0 > /sys/devices/platform/usb_mass_storage/lun0/enable");
}
@ -382,7 +382,7 @@ void show_mount_menu()
};
typedef char* string;
string mounts[3][3] = {
string mounts[4][3] = {
{ "mount /system", "unmount /system", "SYSTEM:" },
{ "mount /data", "unmount /data", "DATA:" },
{ "mount /cache", "unmount /cache", "CACHE:" },
@ -391,17 +391,17 @@ void show_mount_menu()
for (;;)
{
int ismounted[3];
int ismounted[4];
int i;
static string options[5];
for (i = 0; i < 3; i++)
static string options[6];
for (i = 0; i < 4; i++)
{
ismounted[i] = is_root_path_mounted(mounts[i][2]);
options[i] = ismounted[i] ? mounts[i][1] : mounts[i][0];
}
options[3] = "mount USB storage";
options[4] = NULL;
options[4] = "mount USB storage";
options[5] = NULL;
int chosen_item = get_menu_selection(headers, options, 0);
if (chosen_item == GO_BACK)

View File

@ -178,6 +178,13 @@ int nandroid_restore(char* backup_path)
return print_and_error("MD5 mismatch!\n");
int ret;
sprintf(tmp, "flash_image boot %s/boot.img", backup_path);
ui_print("Restoring boot image...\n");
if (0 != (ret = __system(tmp))) {
ui_print("Error while flashing boot image!");
return ret;
}
if (0 != (ret = nandroid_restore_partition(backup_path, "SYSTEM:", "system")))
return ret;