initial support for bml backup and restore
Change-Id: I7e6f1a76371c0d1c1f4cfac0413ba6fa7743f17a
diff --git a/Android.mk b/Android.mk
index 2a4087a..e68fd94 100644
--- a/Android.mk
+++ b/Android.mk
@@ -125,6 +125,11 @@
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 @@
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
diff --git a/nandroid.c b/nandroid.c
index 35ad641..6bf6e91 100644
--- a/nandroid.c
+++ b/nandroid.c
@@ -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 @@
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;
}
diff --git a/updater/Android.mk b/updater/Android.mk
index b0e5811..ff89f96 100644
--- a/updater/Android.mk
+++ b/updater/Android.mk
@@ -19,8 +19,8 @@
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)