From 9765a037a1342b17c596f0aa70b410295bbc5f05 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Sat, 18 Dec 2010 21:31:02 -0800 Subject: [PATCH] Remove usage of BOARD_HAS_NO_MISC_PARTITION. Change-Id: I5775f47fb1d5ef66e2461a0c53166af03354a6f6 --- Android.mk | 2 +- extendedcommands.c | 10 ++++++---- recovery.c | 30 ++++++++++++++++-------------- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/Android.mk b/Android.mk index b0fc158..e16f226 100644 --- a/Android.mk +++ b/Android.mk @@ -30,7 +30,7 @@ LOCAL_CFLAGS += -DRECOVERY_VERSION="$(RECOVERY_VERSION)" RECOVERY_API_VERSION := 2 LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION) -BOARD_RECOVERY_DEFINES := BOARD_HAS_NO_SELECT_BUTTON BOARD_SDCARD_DEVICE_PRIMARY BOARD_SDCARD_DEVICE_SECONDARY BOARD_SDEXT_DEVICE BOARD_SDEXT_FILESYSTEM BOARD_DATA_DEVICE BOARD_DATA_FILESYSTEM BOARD_DATADATA_DEVICE BOARD_DATADATA_FILESYSTEM BOARD_CACHE_DEVICE BOARD_CACHE_FILESYSTEM BOARD_SYSTEM_DEVICE BOARD_SYSTEM_FILESYSTEM BOARD_HAS_DATADATA BOARD_DATA_FILESYSTEM_OPTIONS BOARD_DATADATA_FILESYSTEM_OPTIONS BOARD_CACHE_FILESYSTEM_OPTIONS BOARD_SYSTEM_FILESYSTEM_OPTIONS BOARD_HAS_MTD_CACHE BOARD_USES_BMLUTILS BOARD_USES_MMCUTILS BOARD_HAS_SMALL_RECOVERY BOARD_LDPI_RECOVERY BOARD_RECOVERY_IGNORE_BOOTABLES BOARD_HAS_NO_MISC_PARTITION BOARD_HAS_SDCARD_INTERNAL BOARD_SDCARD_DEVICE_INTERNAL BOARD_HIJACK_RECOVERY_PATH +BOARD_RECOVERY_DEFINES := BOARD_HAS_NO_SELECT_BUTTON BOARD_SDCARD_DEVICE_PRIMARY BOARD_SDCARD_DEVICE_SECONDARY BOARD_SDEXT_DEVICE BOARD_SDEXT_FILESYSTEM BOARD_DATA_DEVICE BOARD_DATA_FILESYSTEM BOARD_DATADATA_DEVICE BOARD_DATADATA_FILESYSTEM BOARD_CACHE_DEVICE BOARD_CACHE_FILESYSTEM BOARD_SYSTEM_DEVICE BOARD_SYSTEM_FILESYSTEM BOARD_HAS_DATADATA BOARD_DATA_FILESYSTEM_OPTIONS BOARD_DATADATA_FILESYSTEM_OPTIONS BOARD_CACHE_FILESYSTEM_OPTIONS BOARD_SYSTEM_FILESYSTEM_OPTIONS BOARD_HAS_MTD_CACHE BOARD_USES_BMLUTILS BOARD_USES_MMCUTILS BOARD_HAS_SMALL_RECOVERY BOARD_LDPI_RECOVERY BOARD_RECOVERY_IGNORE_BOOTABLES BOARD_HAS_SDCARD_INTERNAL BOARD_SDCARD_DEVICE_INTERNAL BOARD_HIJACK_RECOVERY_PATH $(foreach board_define,$(BOARD_RECOVERY_DEFINES), \ $(if $($(board_define)), \ diff --git a/extendedcommands.c b/extendedcommands.c index 834ee66..8ad69e2 100644 --- a/extendedcommands.c +++ b/extendedcommands.c @@ -36,6 +36,7 @@ #include "extendedcommands.h" #include "nandroid.h" #include "mounts.h" +#include "flashutils/flashutils.h" int signature_check_enabled = 1; int script_assert_enabled = 1; @@ -57,9 +58,9 @@ void toggle_script_asserts() int install_zip(const char* packagefilepath) { ui_print("\n-- Installing: %s\n", packagefilepath); -#ifndef BOARD_HAS_NO_MISC_PARTITION - set_sdcard_update_bootloader_message(); -#endif + if (device_flash_type() == MTD) { + set_sdcard_update_bootloader_message(); + } int status = install_package(packagefilepath); ui_reset_progress(); if (status != INSTALL_SUCCESS) { @@ -883,7 +884,7 @@ void write_fstab_root(char *path, FILE *file) { Volume *vol = volume_for_path(path); if (vol == NULL) { - LOGW("Unable to get recovery.fstab info for %s during fstab generation!", path); + LOGW("Unable to get recovery.fstab info for %s during fstab generation!\n", path); return; } @@ -910,6 +911,7 @@ void create_fstab() write_fstab_root("/sdcard", file); write_fstab_root("/sd-ext", file); fclose(file); + LOGI("Completed outputting fstab.\n"); } void handle_failure(int ret) diff --git a/recovery.c b/recovery.c index 33b54ba..741d59e 100644 --- a/recovery.c +++ b/recovery.c @@ -43,6 +43,7 @@ #include "encryptedfs_provisioning.h" #include "extendedcommands.h" +#include "flashutils/flashutils.h" static const struct option OPTIONS[] = { { "send_intent", required_argument, NULL, 's' }, @@ -178,9 +179,9 @@ static void get_args(int *argc, char ***argv) { struct bootloader_message boot; memset(&boot, 0, sizeof(boot)); -#ifndef BOARD_HAS_NO_MISC_PARTITION - get_bootloader_message(&boot); // this may fail, leaving a zeroed structure -#endif + if (device_flash_type() == MTD) { + get_bootloader_message(&boot); // this may fail, leaving a zeroed structure + } if (boot.command[0] != 0 && boot.command[0] != 255) { LOGI("Boot command: %.*s\n", sizeof(boot.command), boot.command); @@ -237,12 +238,11 @@ get_args(int *argc, char ***argv) { strlcat(boot.recovery, (*argv)[i], sizeof(boot.recovery)); strlcat(boot.recovery, "\n", sizeof(boot.recovery)); } -#ifndef BOARD_HAS_NO_MISC_PARTITION - set_bootloader_message(&boot); -#endif + if (device_flash_type() == MTD) { + set_bootloader_message(&boot); + } } -#ifndef BOARD_HAS_NO_MISC_PARTITION void set_sdcard_update_bootloader_message() { struct bootloader_message boot; @@ -251,7 +251,6 @@ set_sdcard_update_bootloader_message() { strlcpy(boot.recovery, "recovery\n", sizeof(boot.recovery)); set_bootloader_message(&boot); } -#endif // How much of the temp log we have copied to the copy in cache. static long tmplog_offset = 0; @@ -303,12 +302,12 @@ finish_recovery(const char *send_intent) { copy_log_file(LAST_LOG_FILE, false); chmod(LAST_LOG_FILE, 0640); -#ifndef BOARD_HAS_NO_MISC_PARTITION - // Reset to mormal system boot so recovery won't cycle indefinitely. - struct bootloader_message boot; - memset(&boot, 0, sizeof(boot)); - set_bootloader_message(&boot); -#endif + if (device_flash_type() == MTD) { + // Reset to mormal system boot so recovery won't cycle indefinitely. + struct bootloader_message boot; + memset(&boot, 0, sizeof(boot)); + set_bootloader_message(&boot); + } // Remove the command file, so recovery won't repeat indefinitely. if (ensure_path_mounted(COMMAND_FILE) != 0 || @@ -797,6 +796,7 @@ main(int argc, char **argv) { ui_print(EXPAND(RECOVERY_VERSION)"\n"); load_volume_table(); create_fstab(); + LOGI("Processing arguments.\n"); get_args(&argc, &argv); int previous_runs = 0; @@ -807,6 +807,7 @@ main(int argc, char **argv) { int toggle_secure_fs = 0; encrypted_fs_info encrypted_fs_data; + LOGI("Checking arguments.\n"); int arg; while ((arg = getopt_long(argc, argv, "", OPTIONS, NULL)) != -1) { switch (arg) { @@ -823,6 +824,7 @@ main(int argc, char **argv) { } } + LOGI("device_recovery_start()\n"); device_recovery_start(); printf("Command:");