From 2c3cc503561763db289583072a54db3eb4eedffe Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Fri, 21 May 2010 10:11:05 -0700 Subject: [PATCH 1/2] add a utility erase_image. possible fix for d/s flashing bug from zinx --- mtdutils/Android.mk | 10 ++++++++++ mtdutils/flash_image.c | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/mtdutils/Android.mk b/mtdutils/Android.mk index 8da86a8..6dedcfb 100644 --- a/mtdutils/Android.mk +++ b/mtdutils/Android.mk @@ -77,6 +77,16 @@ LOCAL_STATIC_LIBRARIES := libmtdutils libcutils libc LOCAL_FORCE_STATIC_EXECUTABLE := true include $(BUILD_EXECUTABLE) +include $(CLEAR_VARS) +LOCAL_SRC_FILES := erase_image.c +LOCAL_MODULE := utility_erase_image +LOCAL_MODULE_CLASS := UTILITY_EXECUTABLES +LOCAL_MODULE_PATH := $(PRODUCT_OUT)/utilities +LOCAL_UNSTRIPPED_PATH := $(PRODUCT_OUT)/symbols/utilities +LOCAL_MODULE_STEM := erase_image +LOCAL_STATIC_LIBRARIES := libmtdutils libcutils libc +LOCAL_FORCE_STATIC_EXECUTABLE := true +include $(BUILD_EXECUTABLE) endif # TARGET_ARCH == arm endif # !TARGET_SIMULATOR diff --git a/mtdutils/flash_image.c b/mtdutils/flash_image.c index c776876..4684683 100644 --- a/mtdutils/flash_image.c +++ b/mtdutils/flash_image.c @@ -121,6 +121,10 @@ int main(int argc, char **argv) { size_t block_size; if (mtd_partition_info(partition, NULL, &block_size, NULL)) die("error getting %s block size", argv[1]); + + // Zinx says this fixes noncongiuous memory allocation issues? + if (block_size > 2048) + block_size = 2048; if (lseek(fd, headerlen, SEEK_SET) != headerlen) die("error rewinding %s", argv[2]); From 917c38af204593ac27cbfec3a20e5ceaf789b19a Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Mon, 24 May 2010 16:43:39 -0700 Subject: [PATCH 2/2] adjust menu start position: zinx --- ui.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui.c b/ui.c index 5ea4e42..039043e 100644 --- a/ui.c +++ b/ui.c @@ -527,11 +527,11 @@ int ui_menu_select(int sel) { if (menu_sel < menu_show_start && menu_show_start > 0) { - menu_show_start--; + menu_show_start = menu_sel; } if (menu_sel - menu_show_start + menu_top >= text_rows) { - menu_show_start++; + menu_show_start = menu_sel + menu_top - text_rows + 1; } sel = menu_sel;