Skip to content

Commit

Permalink
initial support for bml backup and restore
Browse files Browse the repository at this point in the history
Change-Id: I7e6f1a76371c0d1c1f4cfac0413ba6fa7743f17a
  • Loading branch information
koush committed Sep 13, 2010
1 parent 5a9fe1c commit 28a41b4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
11 changes: 5 additions & 6 deletions Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -125,19 +125,18 @@ 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.
# TODO: Build the ramdisk image in a more principled way.

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
Expand Down
12 changes: 10 additions & 2 deletions nandroid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions updater/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 28a41b4

Please sign in to comment.