Merge branch 'gingerbread' of git://github.com/CyanogenMod/android_bootable_recovery into gingerbread
This commit is contained in:
commit
9154b8cfd2
@ -26,12 +26,12 @@ LOCAL_MODULE := recovery
|
||||
|
||||
LOCAL_FORCE_STATIC_EXECUTABLE := true
|
||||
|
||||
RECOVERY_VERSION := ClockworkMod Recovery v4.0.0.5
|
||||
RECOVERY_VERSION := ClockworkMod Recovery v4.0.0.8
|
||||
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_HAS_SMALL_RECOVERY BOARD_LDPI_RECOVERY BOARD_UMS_LUNFILE
|
||||
BOARD_RECOVERY_DEFINES := BOARD_HAS_NO_SELECT_BUTTON BOARD_HAS_SMALL_RECOVERY BOARD_LDPI_RECOVERY BOARD_UMS_LUNFILE BOARD_RECOVERY_ALWAYS_WIPES
|
||||
|
||||
$(foreach board_define,$(BOARD_RECOVERY_DEFINES), \
|
||||
$(if $($(board_define)), \
|
||||
|
@ -1,7 +1,15 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_CFLAGS += -DBOARD_BOOT_DEVICE=\"$(BOARD_BOOT_DEVICE)\"
|
||||
|
||||
BOARD_RECOVERY_DEFINES := BOARD_BML_BOOT BOARD_BML_RECOVERY
|
||||
|
||||
$(foreach board_define,$(BOARD_RECOVERY_DEFINES), \
|
||||
$(if $($(board_define)), \
|
||||
$(eval LOCAL_CFLAGS += -D$(board_define)=\"$($(board_define))\") \
|
||||
) \
|
||||
)
|
||||
|
||||
LOCAL_SRC_FILES := bmlutils.c
|
||||
LOCAL_MODULE := libbmlutils
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
|
@ -23,6 +23,13 @@
|
||||
extern int __system(const char *command);
|
||||
#define BML_UNLOCK_ALL 0x8A29 ///< unlock all partition RO -> RW
|
||||
|
||||
#ifndef BOARD_BML_BOOT
|
||||
#define BOARD_BML_BOOT "/dev/block/bml7"
|
||||
#endif
|
||||
|
||||
#ifndef BOARD_BML_RECOVERY
|
||||
#define BOARD_BML_RECOVERY "/dev/block/bml8"
|
||||
#endif
|
||||
|
||||
static int restore_internal(const char* bml, const char* filename)
|
||||
{
|
||||
@ -66,13 +73,13 @@ int cmd_bml_restore_raw_partition(const char *partition, const char *filename)
|
||||
// always restore boot, regardless of whether recovery or boot is flashed.
|
||||
// this is because boot and recovery are the same on some samsung phones.
|
||||
// unless of course, recoveryonly is explictly chosen (bml8)
|
||||
ret = restore_internal("/dev/block/bml7", filename);
|
||||
ret = restore_internal(BOARD_BML_BOOT, filename);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (strcmp(partition, "recovery") == 0 || strcmp(partition, "recoveryonly") == 0)
|
||||
ret = restore_internal("/dev/block/bml8", filename);
|
||||
ret = restore_internal(BOARD_BML_RECOVERY, filename);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -80,9 +87,9 @@ int cmd_bml_backup_raw_partition(const char *partition, const char *out_file)
|
||||
{
|
||||
char* bml;
|
||||
if (strcmp("boot", partition) == 0)
|
||||
bml = "/dev/block/bml7";
|
||||
bml = BOARD_BML_BOOT;
|
||||
else if (strcmp("recovery", partition) == 0)
|
||||
bml = "/dev/block/bml8";
|
||||
bml = BOARD_BML_RECOVERY;
|
||||
else {
|
||||
printf("Invalid partition.\n");
|
||||
return -1;
|
||||
|
1
common.h
1
common.h
@ -33,6 +33,7 @@ void ui_clear_key_queue();
|
||||
// The screen is small, and users may need to report these messages to support,
|
||||
// so keep the output short and not too cryptic.
|
||||
void ui_print(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
|
||||
void ui_printlogtail(int nb_lines);
|
||||
|
||||
void ui_reset_text_col();
|
||||
void ui_set_show_text(int value);
|
||||
|
@ -145,6 +145,10 @@ Value* FormatFn(const char* name, State* state, int argc, Expr* argv[]) {
|
||||
free(path);
|
||||
return StringValue(strdup(""));
|
||||
}
|
||||
if (0 != format_volume("/sdcard/Android")) {
|
||||
free(path);
|
||||
return StringValue(strdup(""));
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
|
@ -867,6 +867,7 @@ void show_advanced_menu()
|
||||
"Wipe Battery Stats",
|
||||
"Report Error",
|
||||
"Key Test",
|
||||
"Show log",
|
||||
#ifndef BOARD_HAS_SMALL_RECOVERY
|
||||
"Partition SD Card",
|
||||
"Fix Permissions",
|
||||
@ -885,8 +886,10 @@ void show_advanced_menu()
|
||||
switch (chosen_item)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
reboot_wrapper("recovery");
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
if (0 != ensure_path_mounted("/data"))
|
||||
@ -927,6 +930,11 @@ void show_advanced_menu()
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
ui_printlogtail(12);
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
static char* ext_sizes[] = { "128M",
|
||||
"256M",
|
||||
@ -969,7 +977,7 @@ void show_advanced_menu()
|
||||
ui_print("An error occured while partitioning your SD Card. Please see /tmp/recovery.log for more details.\n");
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
case 7:
|
||||
{
|
||||
ensure_path_mounted("/system");
|
||||
ensure_path_mounted("/data");
|
||||
@ -978,7 +986,7 @@ void show_advanced_menu()
|
||||
ui_print("Done!\n");
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
case 8:
|
||||
{
|
||||
static char* ext_sizes[] = { "128M",
|
||||
"256M",
|
||||
|
@ -9,6 +9,15 @@ LOCAL_MODULE := libflashutils
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_C_INCLUDES += bootable/recovery
|
||||
LOCAL_STATIC_LIBRARIES := libmmcutils libmtdutils libbmlutils libcrecovery
|
||||
|
||||
BOARD_RECOVERY_DEFINES := BOARD_BML_BOOT BOARD_BML_RECOVERY
|
||||
|
||||
$(foreach board_define,$(BOARD_RECOVERY_DEFINES), \
|
||||
$(if $($(board_define)), \
|
||||
$(eval LOCAL_CFLAGS += -D$(board_define)=\"$($(board_define))\") \
|
||||
) \
|
||||
)
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
@ -6,12 +6,20 @@
|
||||
|
||||
#include "flashutils/flashutils.h"
|
||||
|
||||
#ifndef BOARD_BML_BOOT
|
||||
#define BOARD_BML_BOOT "/dev/block/bml7"
|
||||
#endif
|
||||
|
||||
#ifndef BOARD_BML_RECOVERY
|
||||
#define BOARD_BML_RECOVERY "/dev/block/bml8"
|
||||
#endif
|
||||
|
||||
int the_flash_type = UNKNOWN;
|
||||
|
||||
int device_flash_type()
|
||||
{
|
||||
if (the_flash_type == UNKNOWN) {
|
||||
if (access("/dev/block/bml7", F_OK) == 0) {
|
||||
if (access(BOARD_BML_BOOT, F_OK) == 0) {
|
||||
the_flash_type = BML;
|
||||
} else if (access("/proc/emmc", F_OK) == 0) {
|
||||
the_flash_type = MMC;
|
||||
|
13
nandroid.c
13
nandroid.c
@ -277,6 +277,16 @@ int nandroid_backup(const char* backup_path)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (0 != stat("/sdcard/Android", &s))
|
||||
{
|
||||
ui_print("No /sdcard/Android found. Skipping backup of application files on external storage.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (0 != (ret = nandroid_backup_partition_extended(backup_path, "/sdcard/Android", 0)))
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (0 != (ret = nandroid_backup_partition_extended(backup_path, "/cache", 0)))
|
||||
return ret;
|
||||
|
||||
@ -514,6 +524,9 @@ int nandroid_restore(const char* backup_path, int restore_boot, int restore_syst
|
||||
if (restore_data && 0 != (ret = nandroid_restore_partition_extended(backup_path, "/sdcard/.android_secure", 0)))
|
||||
return ret;
|
||||
|
||||
if (restore_data && 0 != (ret = nandroid_restore_partition_extended(backup_path, "/sdcard/Android", 0)))
|
||||
return ret;
|
||||
|
||||
if (restore_cache && 0 != (ret = nandroid_restore_partition_extended(backup_path, "/cache", 0)))
|
||||
return ret;
|
||||
|
||||
|
@ -677,6 +677,7 @@ wipe_data(int confirm) {
|
||||
}
|
||||
erase_volume("/sd-ext");
|
||||
erase_volume("/sdcard/.android_secure");
|
||||
erase_volume("/sdcard/Android");
|
||||
ui_print("Data wipe complete.\n");
|
||||
}
|
||||
|
||||
@ -817,7 +818,11 @@ main(int argc, char **argv) {
|
||||
case 'p': previous_runs = atoi(optarg); break;
|
||||
case 's': send_intent = optarg; break;
|
||||
case 'u': update_package = optarg; break;
|
||||
case 'w': wipe_data = wipe_cache = 1; break;
|
||||
case 'w':
|
||||
#ifndef BOARD_RECOVERY_ALWAYS_WIPES
|
||||
wipe_data = wipe_cache = 1;
|
||||
#endif
|
||||
break;
|
||||
case 'c': wipe_cache = 1; break;
|
||||
case 'e': encrypted_fs_mode = optarg; toggle_secure_fs = 1; break;
|
||||
case 't': ui_show_text(1); break;
|
||||
|
30
ui.c
30
ui.c
@ -29,6 +29,8 @@
|
||||
#include "minui/minui.h"
|
||||
#include "recovery_ui.h"
|
||||
|
||||
extern int __system(const char *command);
|
||||
|
||||
#ifdef BOARD_HAS_NO_SELECT_BUTTON
|
||||
static int gShowBackButton = 1;
|
||||
#else
|
||||
@ -58,6 +60,7 @@ static gr_surface gProgressBarIndeterminate[PROGRESSBAR_INDETERMINATE_STATES];
|
||||
static gr_surface gProgressBarEmpty;
|
||||
static gr_surface gProgressBarFill;
|
||||
static int ui_has_initialized = 0;
|
||||
static int ui_log_stdout = 1;
|
||||
|
||||
static const struct { gr_surface* surface; const char *name; } BITMAPS[] = {
|
||||
{ &gBackgroundIcon[BACKGROUND_ICON_INSTALLING], "icon_installing" },
|
||||
@ -98,7 +101,7 @@ static int show_text = 0;
|
||||
static char menu[MENU_MAX_ROWS][MENU_MAX_COLS];
|
||||
static int show_menu = 0;
|
||||
static int menu_top = 0, menu_items = 0, menu_sel = 0;
|
||||
static int menu_show_start = 0; // this is line which menu display is starting at
|
||||
static int menu_show_start = 0; // this is line which menu display is starting at
|
||||
|
||||
// Key event input queue
|
||||
static pthread_mutex_t key_queue_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
@ -460,7 +463,8 @@ void ui_print(const char *fmt, ...)
|
||||
vsnprintf(buf, 256, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
fputs(buf, stdout);
|
||||
if (ui_log_stdout)
|
||||
fputs(buf, stdout);
|
||||
|
||||
// This can get called before ui_init(), so be careful.
|
||||
pthread_mutex_lock(&gUpdateMutex);
|
||||
@ -481,6 +485,28 @@ void ui_print(const char *fmt, ...)
|
||||
pthread_mutex_unlock(&gUpdateMutex);
|
||||
}
|
||||
|
||||
void ui_printlogtail(int nb_lines) {
|
||||
char * log_data;
|
||||
char tmp[PATH_MAX];
|
||||
FILE * f;
|
||||
int line=0;
|
||||
//don't log output to recovery.log
|
||||
ui_log_stdout=0;
|
||||
sprintf(tmp, "tail -n %d /tmp/recovery.log > /tmp/tail.log", nb_lines);
|
||||
__system(tmp);
|
||||
f = fopen("/tmp/tail.log", "rb");
|
||||
if (f != NULL) {
|
||||
while (line < nb_lines) {
|
||||
log_data = fgets(tmp, PATH_MAX, f);
|
||||
if (log_data == NULL) break;
|
||||
ui_print("%s", tmp);
|
||||
line++;
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
ui_log_stdout=1;
|
||||
}
|
||||
|
||||
void ui_reset_text_col()
|
||||
{
|
||||
pthread_mutex_lock(&gUpdateMutex);
|
||||
|
Loading…
Reference in New Issue
Block a user