fix missing prebuilts in recovery. mmc bootloader message support. fix segfault happening due to C structs not being zeroed out.

This commit is contained in:
Koushik Dutta 2011-11-23 14:06:12 -08:00
parent edae7a5b0f
commit ddc1241a36
5 changed files with 30 additions and 17 deletions

View File

@ -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

View File

@ -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.

View File

@ -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
}

View File

@ -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;

View File

@ -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