initial support for bml backup and restore

Change-Id: I7e6f1a76371c0d1c1f4cfac0413ba6fa7743f17a
This commit is contained in:
Koushik Dutta 2010-09-13 14:55:17 -07:00
parent 5a9fe1c964
commit 28a41b4df2
3 changed files with 17 additions and 10 deletions

View File

@ -125,6 +125,11 @@ ifdef BOARD_HAS_MTD_CACHE
LOCAL_CFLAGS += -DBOARD_HAS_MTD_CACHE
endif
ifdef BOARD_USES_BMLUTILS
LOCAL_CFLAGS += -DBOARD_USES_BMLUTILS
LOCAL_STATIC_LIBRARIES += libbmlutils
endif
# This binary is in the recovery ramdisk, which is otherwise a copy of root.
# It gets copied there in config/Makefile. LOCAL_MODULE_TAGS suppresses
# a (redundant) copy of the binary in /system/bin for user builds.
@ -132,12 +137,6 @@ endif
LOCAL_MODULE_TAGS := eng
LOCAL_STATIC_LIBRARIES :=
#ifeq ($(TARGET_RECOVERY_UI_LIB),)
# LOCAL_SRC_FILES += default_recovery_ui.c
#else
# LOCAL_STATIC_LIBRARIES += $(TARGET_RECOVERY_UI_LIB)
#endif
LOCAL_SRC_FILES += default_recovery_ui.c
LOCAL_STATIC_LIBRARIES += libbusybox libclearsilverregex libmkyaffs2image libunyaffs liberase_image libdump_image libflash_image libmtdutils
LOCAL_STATIC_LIBRARIES += libamend

View File

@ -42,6 +42,14 @@
#include "extendedcommands.h"
#include "nandroid.h"
#ifndef BOARD_USES_BMLUTILS
int write_raw_image(const char* partition, const char* filename) {
char tmp[PATH_MAX];
sprintf(tmp, "flash_image boot %s", filename);
return __system(tmp);
}
#endif
int print_and_error(char* message) {
ui_print(message);
return 1;
@ -283,9 +291,9 @@ int nandroid_restore(const char* backup_path, int restore_boot, int restore_syst
ui_print("Erasing boot before restore...\n");
if (0 != (ret = format_root_device("BOOT:")))
return print_and_error("Error while formatting BOOT:!\n");
sprintf(tmp, "flash_image boot %s/boot.img", backup_path);
sprintf(tmp, "%s/boot.img", backup_path);
ui_print("Restoring boot image...\n");
if (0 != (ret = __system(tmp))) {
if (0 != (ret = write_raw_image("boot", tmp))) {
ui_print("Error while flashing boot image!");
return ret;
}

View File

@ -19,8 +19,8 @@ LOCAL_MODULE_TAGS := eng
LOCAL_SRC_FILES := $(updater_src_files)
ifdef BOARD_USES_BMLUTILS
LOCAL_CFLAGS += -DBOARD_USES_BMLUTILS
LOCAL_STATIC_LIBRARIES += libbmlutils
LOCAL_CFLAGS += -DBOARD_USES_BMLUTILS
LOCAL_STATIC_LIBRARIES += libbmlutils
endif
LOCAL_STATIC_LIBRARIES += $(TARGET_RECOVERY_UPDATER_LIBS) $(TARGET_RECOVERY_UPDATER_EXTRA_LIBS)