aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKoushik Dutta <koushd@gmail.com>2011-11-23 14:06:12 -0800
committerKoushik Dutta <koushd@gmail.com>2011-11-23 14:06:26 -0800
commitddc1241a36c48a857971f5d926a33680e52a59d6 (patch)
tree3ce69126672138d292f83563f55206a325ba10bb
parentedae7a5b0f20249528b72ac87d9b6b5d769b927f (diff)
downloadbootable_recovery-ddc1241a36c48a857971f5d926a33680e52a59d6.zip
bootable_recovery-ddc1241a36c48a857971f5d926a33680e52a59d6.tar.gz
bootable_recovery-ddc1241a36c48a857971f5d926a33680e52a59d6.tar.bz2
fix missing prebuilts in recovery. mmc bootloader message support. fix segfault happening due to C structs not being zeroed out.
-rw-r--r--Android.mk6
-rw-r--r--nandroid.c26
-rw-r--r--recovery.c2
-rw-r--r--roots.c7
-rwxr-xr-xutilities/Android.mk6
5 files changed, 30 insertions, 17 deletions
diff --git a/Android.mk b/Android.mk
index aadb293..202d190 100644
--- a/Android.mk
+++ b/Android.mk
@@ -34,7 +34,7 @@ else
RECOVERY_NAME := CWM-based Recovery
endif
-RECOVERY_VERSION := $(RECOVERY_NAME) v5.5.0.0
+RECOVERY_VERSION := $(RECOVERY_NAME) v5.5.0.2
LOCAL_CFLAGS += -DRECOVERY_VERSION="$(RECOVERY_VERSION)"
RECOVERY_API_VERSION := 2
@@ -114,8 +114,6 @@ $(RECOVERY_BUSYBOX_SYMLINKS): $(LOCAL_INSTALLED_MODULE)
@rm -rf $@
$(hide) ln -sf $(BUSYBOX_BINARY) $@
-ALL_DEFAULT_INSTALLED_MODULES += $(RECOVERY_BUSYBOX_SYMLINKS)
-
include $(CLEAR_VARS)
LOCAL_MODULE := nandroid-md5.sh
LOCAL_MODULE_TAGS := eng
@@ -132,6 +130,8 @@ LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
LOCAL_SRC_FILES := killrecovery.sh
include $(BUILD_PREBUILT)
+ALL_DEFAULT_INSTALLED_MODULES += $(RECOVERY_BUSYBOX_SYMLINKS) $(TARGET_RECOVERY_ROOT_OUT)/sbin/nandroid-md5.sh $(TARGET_RECOVERY_ROOT_OUT)/sbin/killrecovery.sh
+
include $(CLEAR_VARS)
LOCAL_SRC_FILES := verifier_test.c verifier.c
diff --git a/nandroid.c b/nandroid.c
index 315660c..56c633d 100644
--- a/nandroid.c
+++ b/nandroid.c
@@ -233,20 +233,19 @@ int nandroid_backup(const char* backup_path)
}
Volume* volume = volume_for_path(backup_path);
- if (NULL == volume)
- return print_and_error("Unable to find volume for backup path.\n");
int ret;
struct statfs s;
- if (0 != (ret = statfs(volume->mount_point, &s)))
- return print_and_error("Unable to stat backup path.\n");
- uint64_t bavail = s.f_bavail;
- uint64_t bsize = s.f_bsize;
- uint64_t sdcard_free = bavail * bsize;
- uint64_t sdcard_free_mb = sdcard_free / (uint64_t)(1024 * 1024);
- ui_print("SD Card space free: %lluMB\n", sdcard_free_mb);
- if (sdcard_free_mb < 150)
- ui_print("There may not be enough free space to complete backup... continuing...\n");
-
+ if (NULL != volume) {
+ if (0 != (ret = statfs(volume->mount_point, &s)))
+ return print_and_error("Unable to stat backup path.\n");
+ uint64_t bavail = s.f_bavail;
+ uint64_t bsize = s.f_bsize;
+ uint64_t sdcard_free = bavail * bsize;
+ uint64_t sdcard_free_mb = sdcard_free / (uint64_t)(1024 * 1024);
+ ui_print("SD Card space free: %lluMB\n", sdcard_free_mb);
+ if (sdcard_free_mb < 150)
+ ui_print("There may not be enough free space to complete backup... continuing...\n");
+ }
char tmp[PATH_MAX];
sprintf(tmp, "mkdir -p %s", backup_path);
__system(tmp);
@@ -436,6 +435,9 @@ int nandroid_restore_partition_extended(const char* backup_path, const char* mou
// This is because some phones (like DroidX) will freak out if you
// reformat the /system or /data partitions, and not boot due to
// a locked bootloader.
+ // Other devices, like the Galaxy Nexus, XOOM, and Galaxy Tab 10.1
+ // have a /sdcard symlinked to /data/media. /data is set to "auto"
+ // so that when the format occurs, /data/media is not erased.
// The "auto" fs type preserves the file system, and does not
// trigger that lock.
// Or of volume does not exist (.android_secure), just rm -rf.
diff --git a/recovery.c b/recovery.c
index 2b3543e..0e92a5b 100644
--- a/recovery.c
+++ b/recovery.c
@@ -161,7 +161,7 @@ static void
get_args(int *argc, char ***argv) {
struct bootloader_message boot;
memset(&boot, 0, sizeof(boot));
- if (device_flash_type() == MTD) {
+ if (device_flash_type() == MTD || device_flash_type() == MMC) {
get_bootloader_message(&boot); // this may fail, leaving a zeroed structure
}
diff --git a/roots.c b/roots.c
index 2a86346..dbb04bb 100644
--- a/roots.c
+++ b/roots.c
@@ -138,6 +138,11 @@ void load_volume_table() {
device_volumes[num_volumes].fs_options = NULL;
device_volumes[num_volumes].fs_options2 = NULL;
device_volumes[num_volumes].length = 0;
+
+ device_volumes[num_volumes].fs_type2 = NULL;
+ device_volumes[num_volumes].fs_options = NULL;
+ device_volumes[num_volumes].fs_options2 = NULL;
+
if (parse_options(options, device_volumes + num_volumes) != 0) {
LOGE("skipping malformed recovery.fstab line: %s\n", original);
} else {
@@ -213,7 +218,7 @@ int ensure_path_mounted_at_mount_point(const char* path, const char* mount_point
if (v == NULL) {
// no /sdcard? let's assume /data/media
if (strstr(path, "/sdcard") == path && is_data_media()) {
- LOGW("using /data/media, no /sdcard found.\n");
+ LOGI("using /data/media, no /sdcard found.\n");
int ret;
if (0 != (ret = ensure_path_mounted("/data")))
return ret;
diff --git a/utilities/Android.mk b/utilities/Android.mk
index 7d95449..c5189f3 100755
--- a/utilities/Android.mk
+++ b/utilities/Android.mk
@@ -27,6 +27,8 @@ LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
LOCAL_SRC_FILES := $(LOCAL_MODULE)
include $(BUILD_PREBUILT)
+ALL_DEFAULT_INSTALLED_MODULES += $(RECOVERY_BUSYBOX_SYMLINKS) $(TARGET_RECOVERY_ROOT_OUT)/sbin/fix_permissions $(TARGET_RECOVERY_ROOT_OUT)/sbin/parted $(TARGET_RECOVERY_ROOT_OUT)/sbin/sdparted
+
endif
include $(CLEAR_VARS)
@@ -60,6 +62,8 @@ endif
include $(BUILD_PREBUILT)
endif
+ALL_DEFAULT_INSTALLED_MODULES += $(RECOVERY_BUSYBOX_SYMLINKS) $(TARGET_RECOVERY_ROOT_OUT)/sbin/e2fsck $(TARGET_RECOVERY_ROOT_OUT)/sbin/tune2fs $(TARGET_RECOVERY_ROOT_OUT)/sbin/mke2fs
+
BOARD_RECOVERY_RFS_CHECK := $(shell grep rfs $(TARGET_DEVICE_DIR)/recovery.fstab)
ifneq ($(BOARD_RECOVERY_RFS_CHECK),)
include $(CLEAR_VARS)
@@ -69,4 +73,6 @@ LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
LOCAL_SRC_FILES := $(LOCAL_MODULE)
include $(BUILD_PREBUILT)
+
+ALL_DEFAULT_INSTALLED_MODULES += $(RECOVERY_BUSYBOX_SYMLINKS) $(TARGET_RECOVERY_ROOT_OUT)/sbin/fat.format
endif \ No newline at end of file