blob: 60aa564dde7278f9143e8983fb776a85672ef715 [file] [log] [blame]
Koushik K. Duttaee57bbc2010-03-12 23:21:12 -08001#include <ctype.h>
2#include <errno.h>
3#include <fcntl.h>
4#include <getopt.h>
5#include <limits.h>
6#include <linux/input.h>
7#include <stdio.h>
8#include <stdlib.h>
9#include <string.h>
10#include <sys/reboot.h>
11#include <sys/types.h>
12#include <time.h>
13#include <unistd.h>
14
15#include <sys/wait.h>
16#include <sys/limits.h>
17#include <dirent.h>
18#include <sys/stat.h>
19
20#include <signal.h>
21#include <sys/wait.h>
22
23#include "bootloader.h"
24#include "common.h"
25#include "cutils/properties.h"
26#include "firmware.h"
27#include "install.h"
28#include "minui/minui.h"
29#include "minzip/DirUtil.h"
30#include "roots.h"
31#include "recovery_ui.h"
32
Koushik K. Duttaee57bbc2010-03-12 23:21:12 -080033#include "../../external/yaffs2/yaffs2/utils/mkyaffs2image.h"
34#include "../../external/yaffs2/yaffs2/utils/unyaffs.h"
35
Koushik K. Dutta78686292010-03-25 17:58:45 -070036#include <sys/vfs.h>
37
Koushik K. Duttaee57bbc2010-03-12 23:21:12 -080038#include "extendedcommands.h"
39#include "nandroid.h"
40
Koushik Duttadf1e4062010-12-18 17:42:31 -080041int print_and_error(const char* message) {
42 ui_print("%s", message);
Koushik K. Dutta4b249cd2010-03-15 16:31:03 -070043 return 1;
44}
45
Koushik K. Duttaee57bbc2010-03-12 23:21:12 -080046int yaffs_files_total = 0;
47int yaffs_files_count = 0;
48void yaffs_callback(char* filename)
49{
50 char* justfile = basename(filename);
51 if (strlen(justfile) < 30)
Koushik Duttadf1e4062010-12-18 17:42:31 -080052 ui_print("%s", justfile);
Koushik K. Duttaee57bbc2010-03-12 23:21:12 -080053 yaffs_files_count++;
54 if (yaffs_files_total != 0)
55 ui_set_progress((float)yaffs_files_count / (float)yaffs_files_total);
56 ui_reset_text_col();
57}
58
59void compute_directory_stats(char* directory)
60{
61 char tmp[PATH_MAX];
62 sprintf(tmp, "find %s | wc -l > /tmp/dircount", directory);
63 __system(tmp);
64 char count_text[100];
65 FILE* f = fopen("/tmp/dircount", "r");
66 fread(count_text, 1, sizeof(count_text), f);
67 fclose(f);
68 yaffs_files_count = 0;
69 yaffs_files_total = atoi(count_text);
70 ui_reset_progress();
71 ui_show_progress(1, 0);
72}
73
Koushik Duttadf1e4062010-12-18 17:42:31 -080074int nandroid_backup_partition_extended(const char* backup_path, const char* mount_point, int umount_when_finished) {
Koushik K. Dutta4b249cd2010-03-15 16:31:03 -070075 int ret = 0;
Koushik K. Dutta68b01902010-04-01 12:20:39 -070076 char* name = basename(mount_point);
Koushik Dutta58131e72010-06-09 12:41:20 -070077
78 struct stat file_info;
79 mkyaffs2image_callback callback = NULL;
80 if (0 != stat("/sdcard/clockworkmod/.hidenandroidprogress", &file_info)) {
81 callback = yaffs_callback;
82 }
Koushik K. Dutta4b249cd2010-03-15 16:31:03 -070083
84 ui_print("Backing up %s...\n", name);
Koushik Duttadf1e4062010-12-18 17:42:31 -080085 if (0 != (ret = ensure_path_mounted(mount_point) != 0)) {
Koushik K. Dutta4b249cd2010-03-15 16:31:03 -070086 ui_print("Can't mount %s!\n", mount_point);
87 return ret;
88 }
89 compute_directory_stats(mount_point);
90 char tmp[PATH_MAX];
91 sprintf(tmp, "%s/%s.img", backup_path, name);
Koushik Dutta58131e72010-06-09 12:41:20 -070092 ret = mkyaffs2image(mount_point, tmp, 0, callback);
Koushik Dutta062d6b02010-07-03 13:54:21 -070093 if (umount_when_finished) {
Koushik Duttadf1e4062010-12-18 17:42:31 -080094 ensure_path_unmounted(mount_point);
Koushik Dutta062d6b02010-07-03 13:54:21 -070095 }
Koushik K. Dutta4b249cd2010-03-15 16:31:03 -070096 if (0 != ret) {
97 ui_print("Error while making a yaffs2 image of %s!\n", mount_point);
98 return ret;
99 }
100 return 0;
101}
102
Koushik Dutta062d6b02010-07-03 13:54:21 -0700103int nandroid_backup_partition(const char* backup_path, char* root) {
104 return nandroid_backup_partition_extended(backup_path, root, 1);
105}
106
Koushik Dutta2f73e582010-04-18 16:00:21 -0700107int nandroid_backup(const char* backup_path)
Koushik K. Duttaee57bbc2010-03-12 23:21:12 -0800108{
109 ui_set_background(BACKGROUND_ICON_INSTALLING);
110
Koushik Duttadf1e4062010-12-18 17:42:31 -0800111 if (ensure_path_mounted("/sdcard") != 0)
Koushik K. Duttaee57bbc2010-03-12 23:21:12 -0800112 return print_and_error("Can't mount /sdcard\n");
113
Koushik K. Dutta78686292010-03-25 17:58:45 -0700114 int ret;
Koushik K. Duttaf3534d02010-04-18 18:06:24 -0700115 struct statfs s;
Koushik K. Dutta78686292010-03-25 17:58:45 -0700116 if (0 != (ret = statfs("/sdcard", &s)))
117 return print_and_error("Unable to stat /sdcard\n");
Koushik K. Dutta68b01902010-04-01 12:20:39 -0700118 uint64_t bavail = s.f_bavail;
119 uint64_t bsize = s.f_bsize;
120 uint64_t sdcard_free = bavail * bsize;
121 uint64_t sdcard_free_mb = sdcard_free / (uint64_t)(1024 * 1024);
122 ui_print("SD Card space free: %lluMB\n", sdcard_free_mb);
123 if (sdcard_free_mb < 150)
Koushik K. Duttac0970932010-03-25 23:19:19 -0700124 ui_print("There may not be enough free space to complete backup... continuing...\n");
Koushik K. Dutta78686292010-03-25 17:58:45 -0700125
Koushik K. Duttaee57bbc2010-03-12 23:21:12 -0800126 char tmp[PATH_MAX];
127 sprintf(tmp, "mkdir -p %s", backup_path);
128 __system(tmp);
129
Koushik Dutta5aaa8232010-07-20 16:23:18 -0700130#ifndef BOARD_RECOVERY_IGNORE_BOOTABLES
Koushik K. Duttaee57bbc2010-03-12 23:21:12 -0800131 ui_print("Backing up boot...\n");
132 sprintf(tmp, "%s/%s", backup_path, "boot.img");
Koushik Dutta19447c02010-11-10 10:40:44 -0800133 ret = backup_raw_partition("boot", tmp);
Koushik K. Duttaee57bbc2010-03-12 23:21:12 -0800134 if (0 != ret)
135 return print_and_error("Error while dumping boot image!\n");
Koushik K. Dutta6923cc32010-03-29 14:46:00 -0700136
137 ui_print("Backing up recovery...\n");
138 sprintf(tmp, "%s/%s", backup_path, "recovery.img");
Koushik Dutta19447c02010-11-10 10:40:44 -0800139 ret = backup_raw_partition("recovery", tmp);
Koushik K. Dutta6923cc32010-03-29 14:46:00 -0700140 if (0 != ret)
Koushik Dutta5aaa8232010-07-20 16:23:18 -0700141 return print_and_error("Error while dumping recovery image!\n");
142#endif
Koushik K. Dutta6923cc32010-03-29 14:46:00 -0700143
agrabren1f76a5d2010-12-29 12:15:18 -0600144 if (0 == (ret = get_partition_device("wimax", tmp)))
145 {
Joshua Wise05d4a092010-12-31 02:05:35 -0500146 char serialno[PROPERTY_VALUE_MAX];
Joshua Wiseca889ec2010-12-30 02:48:25 -0500147 ui_print("Backing up WiMAX...\n");
Joshua Wise05d4a092010-12-31 02:05:35 -0500148 serialno[0] = 0;
149 property_get("ro.serialno", serialno, "");
150 sprintf(tmp, "%s/wimax.%s.img", backup_path, serialno);
agrabren1f76a5d2010-12-29 12:15:18 -0600151 ret = backup_raw_partition("wimax", tmp);
152 if (0 != ret)
Joshua Wiseca889ec2010-12-30 02:48:25 -0500153 return print_and_error("Error while dumping WiMAX image!\n");
agrabren1f76a5d2010-12-29 12:15:18 -0600154 }
155
Koushik Duttadf1e4062010-12-18 17:42:31 -0800156 if (0 != (ret = nandroid_backup_partition(backup_path, "/system")))
Koushik K. Dutta4b249cd2010-03-15 16:31:03 -0700157 return ret;
158
Koushik Duttadf1e4062010-12-18 17:42:31 -0800159 if (0 != (ret = nandroid_backup_partition(backup_path, "/data")))
Koushik K. Dutta4b249cd2010-03-15 16:31:03 -0700160 return ret;
161
Koushik Dutta5460f0c2010-12-18 22:37:49 -0800162 if (has_datadata()) {
163 if (0 != (ret = nandroid_backup_partition(backup_path, "/datadata")))
164 return ret;
165 }
Koushik Dutta8b5e1852010-06-14 22:04:22 -0700166
Koushik Dutta062d6b02010-07-03 13:54:21 -0700167 struct stat st;
168 if (0 != stat("/sdcard/.android_secure", &st))
169 {
170 ui_print("No /sdcard/.android_secure found. Skipping backup of applications on external storage.\n");
171 }
172 else
173 {
Koushik Duttadf1e4062010-12-18 17:42:31 -0800174 if (0 != (ret = nandroid_backup_partition_extended(backup_path, "/sdcard/.android_secure", 0)))
Koushik Dutta062d6b02010-07-03 13:54:21 -0700175 return ret;
176 }
177
Koushik Duttadf1e4062010-12-18 17:42:31 -0800178 if (0 != (ret = nandroid_backup_partition_extended(backup_path, "/cache", 0)))
Koushik K. Dutta4b249cd2010-03-15 16:31:03 -0700179 return ret;
Koushik K. Dutta3f995392010-03-30 23:29:43 -0700180
Koushik Duttadf1e4062010-12-18 17:42:31 -0800181 Volume *vol = volume_for_path("/sd-ext");
182 if (vol == NULL || 0 != stat(vol->device, &st))
Koushik K. Dutta6771aca2010-04-03 23:28:39 -0700183 {
Koushik K. Dutta71ef11f2010-04-02 22:17:42 -0700184 ui_print("No sd-ext found. Skipping backup of sd-ext.\n");
Koushik K. Dutta6771aca2010-04-03 23:28:39 -0700185 }
186 else
187 {
Koushik Duttadf1e4062010-12-18 17:42:31 -0800188 if (0 != ensure_path_mounted("/sd-ext"))
Koushik Dutta8b5e1852010-06-14 22:04:22 -0700189 ui_print("Could not mount sd-ext. sd-ext backup may not be supported on this device. Skipping backup of sd-ext.\n");
Koushik K. Dutta6771aca2010-04-03 23:28:39 -0700190 else if (0 != (ret = nandroid_backup_partition(backup_path, "SDEXT:")))
191 return ret;
192 }
Koushik Dutta062d6b02010-07-03 13:54:21 -0700193
Koushik K. Duttad7178922010-03-24 14:38:40 -0700194 ui_print("Generating md5 sum...\n");
Koushik K. Dutta68b01902010-04-01 12:20:39 -0700195 sprintf(tmp, "nandroid-md5.sh %s", backup_path);
Koushik K. Duttab0a25032010-03-24 10:34:38 -0700196 if (0 != (ret = __system(tmp))) {
197 ui_print("Error while generating md5 sum!\n");
198 return ret;
199 }
Koushik K. Duttaee57bbc2010-03-12 23:21:12 -0800200
Koushik K. Dutta3f38f322010-03-12 23:45:25 -0800201 sync();
Koushik K. Duttaee57bbc2010-03-12 23:21:12 -0800202 ui_set_background(BACKGROUND_ICON_NONE);
203 ui_reset_progress();
Koushik K. Dutta4b249cd2010-03-15 16:31:03 -0700204 ui_print("\nBackup complete!\n");
205 return 0;
206}
207
Koushik K. Dutta68b01902010-04-01 12:20:39 -0700208typedef int (*format_function)(char* root);
209
Koushik Dutta5aaa8232010-07-20 16:23:18 -0700210static void ensure_directory(const char* dir) {
211 char tmp[PATH_MAX];
212 sprintf(tmp, "mkdir -p %s", dir);
213 __system(tmp);
214}
215
Koushik Duttadf1e4062010-12-18 17:42:31 -0800216int nandroid_restore_partition_extended(const char* backup_path, const char* mount_point, int umount_when_finished) {
Koushik K. Dutta4b249cd2010-03-15 16:31:03 -0700217 int ret = 0;
Koushik K. Dutta68b01902010-04-01 12:20:39 -0700218 char* name = basename(mount_point);
Koushik K. Dutta4b249cd2010-03-15 16:31:03 -0700219
Koushik Dutta5aaa8232010-07-20 16:23:18 -0700220 char tmp[PATH_MAX];
221 sprintf(tmp, "%s/%s.img", backup_path, name);
Koushik Dutta58131e72010-06-09 12:41:20 -0700222 struct stat file_info;
Koushik Dutta5aaa8232010-07-20 16:23:18 -0700223 if (0 != (ret = statfs(tmp, &file_info))) {
Koushik Duttad4060c32010-07-22 20:14:44 -0700224 ui_print("%s.img not found. Skipping restore of %s.\n", name, mount_point);
Koushik Dutta5aaa8232010-07-20 16:23:18 -0700225 return 0;
226 }
227
228 ensure_directory(mount_point);
229
Koushik Dutta58131e72010-06-09 12:41:20 -0700230 unyaffs_callback callback = NULL;
231 if (0 != stat("/sdcard/clockworkmod/.hidenandroidprogress", &file_info)) {
232 callback = yaffs_callback;
233 }
234
Koushik K. Dutta4b249cd2010-03-15 16:31:03 -0700235 ui_print("Restoring %s...\n", name);
Koushik Dutta852bb422010-07-24 11:18:00 -0700236 /*
Koushik K. Dutta4b249cd2010-03-15 16:31:03 -0700237 if (0 != (ret = ensure_root_path_unmounted(root))) {
238 ui_print("Can't unmount %s!\n", mount_point);
239 return ret;
240 }
Koushik Dutta852bb422010-07-24 11:18:00 -0700241 */
Koushik Duttabf4444f2010-12-18 18:57:47 -0800242 if (0 != (ret = format_volume(mount_point))) {
Koushik Duttadf1e4062010-12-18 17:42:31 -0800243 ui_print("Error while formatting %s!\n", mount_point);
Koushik K. Dutta4b249cd2010-03-15 16:31:03 -0700244 return ret;
245 }
246
Koushik Duttadf1e4062010-12-18 17:42:31 -0800247 if (0 != (ret = ensure_path_mounted(mount_point))) {
Koushik K. Dutta4b249cd2010-03-15 16:31:03 -0700248 ui_print("Can't mount %s!\n", mount_point);
249 return ret;
250 }
251
Koushik Dutta58131e72010-06-09 12:41:20 -0700252 if (0 != (ret = unyaffs(tmp, mount_point, callback))) {
Koushik K. Dutta4b249cd2010-03-15 16:31:03 -0700253 ui_print("Error while restoring %s!\n", mount_point);
254 return ret;
255 }
Koushik Dutta2f73e582010-04-18 16:00:21 -0700256
Koushik Dutta062d6b02010-07-03 13:54:21 -0700257 if (umount_when_finished) {
Koushik Duttadf1e4062010-12-18 17:42:31 -0800258 ensure_path_unmounted(mount_point);
Koushik Dutta2f73e582010-04-18 16:00:21 -0700259 }
Koushik Dutta062d6b02010-07-03 13:54:21 -0700260
Koushik K. Duttaee57bbc2010-03-12 23:21:12 -0800261 return 0;
262}
263
Koushik Dutta062d6b02010-07-03 13:54:21 -0700264int nandroid_restore_partition(const char* backup_path, const char* root) {
265 return nandroid_restore_partition_extended(backup_path, root, 1);
266}
267
agrabren1f76a5d2010-12-29 12:15:18 -0600268int nandroid_restore(const char* backup_path, int restore_boot, int restore_system, int restore_data, int restore_cache, int restore_sdext, int restore_wimax)
Koushik K. Duttaee57bbc2010-03-12 23:21:12 -0800269{
270 ui_set_background(BACKGROUND_ICON_INSTALLING);
271 ui_show_indeterminate_progress();
272 yaffs_files_total = 0;
273
Koushik Duttadf1e4062010-12-18 17:42:31 -0800274 if (ensure_path_mounted("/sdcard") != 0)
Koushik K. Duttaee57bbc2010-03-12 23:21:12 -0800275 return print_and_error("Can't mount /sdcard\n");
276
277 char tmp[PATH_MAX];
278
279 ui_print("Checking MD5 sums...\n");
Koushik K. Duttaface5882010-03-13 10:15:55 -0800280 sprintf(tmp, "cd %s && md5sum -c nandroid.md5", backup_path);
Koushik K. Duttaee57bbc2010-03-12 23:21:12 -0800281 if (0 != __system(tmp))
282 return print_and_error("MD5 mismatch!\n");
283
Koushik K. Dutta4b249cd2010-03-15 16:31:03 -0700284 int ret;
Koushik Dutta5aaa8232010-07-20 16:23:18 -0700285#ifndef BOARD_RECOVERY_IGNORE_BOOTABLES
Koushik K. Duttafe84a7f2010-03-25 18:19:23 -0700286 if (restore_boot)
287 {
Koushik K. Dutta84306552010-04-18 21:21:58 -0700288 ui_print("Erasing boot before restore...\n");
Koushik Duttadf1e4062010-12-18 17:42:31 -0800289 if (0 != (ret = format_device("boot")))
Koushik K. Dutta84306552010-04-18 21:21:58 -0700290 return print_and_error("Error while formatting BOOT:!\n");
Koushik Dutta28a41b42010-09-13 14:55:17 -0700291 sprintf(tmp, "%s/boot.img", backup_path);
Koushik K. Duttafe84a7f2010-03-25 18:19:23 -0700292 ui_print("Restoring boot image...\n");
Koushik Dutta19447c02010-11-10 10:40:44 -0800293 if (0 != (ret = restore_raw_partition("boot", tmp))) {
Koushik K. Duttafe84a7f2010-03-25 18:19:23 -0700294 ui_print("Error while flashing boot image!");
295 return ret;
296 }
Koushik K. Duttaf7215942010-03-16 13:34:51 -0700297 }
Koushik Dutta5aaa8232010-07-20 16:23:18 -0700298#endif
Koushik K. Duttaf7215942010-03-16 13:34:51 -0700299
agrabren1f76a5d2010-12-29 12:15:18 -0600300 if (restore_wimax && 0 == (ret = get_partition_device("wimax", tmp)))
301 {
Joshua Wise05d4a092010-12-31 02:05:35 -0500302 char serialno[PROPERTY_VALUE_MAX];
303
304 serialno[0] = 0;
305 property_get("ro.serialno", serialno, "");
306 sprintf(tmp, "%s/wimax.%s.img", backup_path, serialno);
agrabren1f76a5d2010-12-29 12:15:18 -0600307
308 struct stat st;
309 if (0 != stat(tmp, &st))
310 {
Joshua Wiseca889ec2010-12-30 02:48:25 -0500311 ui_print("WARNING: WiMAX partition exists, but nandroid\n");
312 ui_print(" backup does not contain WiMAX image.\n");
agrabren1f76a5d2010-12-29 12:15:18 -0600313 ui_print(" You should create a new backup to\n");
Joshua Wiseca889ec2010-12-30 02:48:25 -0500314 ui_print(" protect your WiMAX keys.\n");
agrabren1f76a5d2010-12-29 12:15:18 -0600315 }
316 else
317 {
Joshua Wise5a3f1d82010-12-31 02:16:00 -0500318 ui_print("Erasing WiMAX before restore...\n");
319 if (0 != (ret = format_device("wimax")))
320 return print_and_error("Error while formatting wimax!\n");
Joshua Wise05d4a092010-12-31 02:05:35 -0500321 ui_print("Restoring WiMAX image...\n");
agrabren1f76a5d2010-12-29 12:15:18 -0600322 if (0 != (ret = restore_raw_partition("wimax", tmp)))
323 return ret;
324 }
325 }
326
Koushik Duttadf1e4062010-12-18 17:42:31 -0800327 if (restore_system && 0 != (ret = nandroid_restore_partition(backup_path, "/system")))
Koushik K. Dutta4b249cd2010-03-15 16:31:03 -0700328 return ret;
Koushik K. Duttaee57bbc2010-03-12 23:21:12 -0800329
Koushik Duttadf1e4062010-12-18 17:42:31 -0800330 if (restore_data && 0 != (ret = nandroid_restore_partition(backup_path, "/data")))
Koushik K. Dutta4b249cd2010-03-15 16:31:03 -0700331 return ret;
Koushik Dutta8b5e1852010-06-14 22:04:22 -0700332
Koushik Dutta5460f0c2010-12-18 22:37:49 -0800333 if (has_datadata()) {
334 if (restore_data && 0 != (ret = nandroid_restore_partition(backup_path, "/datadata")))
335 return ret;
336 }
Koushik K. Duttaee57bbc2010-03-12 23:21:12 -0800337
Koushik Duttadf1e4062010-12-18 17:42:31 -0800338 if (restore_data && 0 != (ret = nandroid_restore_partition_extended(backup_path, "/sdcard/.android_secure", 0)))
Koushik Dutta5aaa8232010-07-20 16:23:18 -0700339 return ret;
Koushik Dutta062d6b02010-07-03 13:54:21 -0700340
Koushik Duttadf1e4062010-12-18 17:42:31 -0800341 if (restore_cache && 0 != (ret = nandroid_restore_partition_extended(backup_path, "/cache", 0)))
Koushik K. Dutta4b249cd2010-03-15 16:31:03 -0700342 return ret;
343
Koushik Duttadf1e4062010-12-18 17:42:31 -0800344 if (restore_sdext && 0 != (ret = nandroid_restore_partition(backup_path, "/sd-ext")))
Koushik Dutta5aaa8232010-07-20 16:23:18 -0700345 return ret;
Koushik K. Dutta68b01902010-04-01 12:20:39 -0700346
Koushik K. Dutta3f38f322010-03-12 23:45:25 -0800347 sync();
Koushik K. Duttaee57bbc2010-03-12 23:21:12 -0800348 ui_set_background(BACKGROUND_ICON_NONE);
349 ui_reset_progress();
Koushik K. Dutta4b249cd2010-03-15 16:31:03 -0700350 ui_print("\nRestore complete!\n");
Koushik K. Duttaee57bbc2010-03-12 23:21:12 -0800351 return 0;
352}
Koushik Dutta08370912010-06-26 12:25:02 -0700353
354void nandroid_generate_timestamp_path(char* backup_path)
355{
356 time_t t = time(NULL);
357 struct tm *tmp = localtime(&t);
358 if (tmp == NULL)
359 {
360 struct timeval tp;
361 gettimeofday(&tp, NULL);
362 sprintf(backup_path, "/sdcard/clockworkmod/backup/%d", tp.tv_sec);
363 }
364 else
365 {
366 strftime(backup_path, PATH_MAX, "/sdcard/clockworkmod/backup/%F.%H.%M.%S", tmp);
367 }
368}
369
370int nandroid_usage()
371{
372 printf("Usage: nandroid backup\n");
373 printf("Usage: nandroid restore <directory>\n");
374 return 1;
375}
376
377int nandroid_main(int argc, char** argv)
378{
379 if (argc > 3 || argc < 2)
380 return nandroid_usage();
381
382 if (strcmp("backup", argv[1]) == 0)
383 {
384 if (argc != 2)
385 return nandroid_usage();
386
387 char backup_path[PATH_MAX];
388 nandroid_generate_timestamp_path(backup_path);
389 return nandroid_backup(backup_path);
390 }
391
392 if (strcmp("restore", argv[1]) == 0)
393 {
394 if (argc != 3)
395 return nandroid_usage();
Koushik Dutta5b7f34a2010-12-29 23:36:03 -0800396 return nandroid_restore(argv[2], 1, 1, 1, 1, 1, 0);
Koushik Dutta08370912010-06-26 12:25:02 -0700397 }
398
399 return nandroid_usage();
400}