From c88324eafc9852266e3fb3593eb010f9fc9dd3a6 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Sat, 7 Jan 2012 14:20:34 +0100 Subject: [PATCH 1/3] libreboot: prepare extended reboot modes (2nd parameter) like "bootmenu recovery" "bootmenu shell"... add 2 new ifdef options to override (or not) the bootloader/recovery Change-Id: If20ccb6d253e34fe42d211040a4a5b22457a693d --- libreboot/reboot.c | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/libreboot/reboot.c b/libreboot/reboot.c index ae4f0d1..c2bca03 100644 --- a/libreboot/reboot.c +++ b/libreboot/reboot.c @@ -17,6 +17,8 @@ #endif #define DBG_LEVEL 0 +#define OVERRIDE_STOCK_RECOVERY +#define OVERRIDE_STOCK_BOOTLOADER int reboot_wrapper(const char* reason) { @@ -39,7 +41,6 @@ int reboot_wrapper(const char* reason) { // pass the reason to the kernel when we reboot reboot_with_reason = 1; - need_clear_reason = 1; system("mkdir -p /cache/recovery"); @@ -51,8 +52,8 @@ int reboot_wrapper(const char* reason) { } // called for all reboot reasons - if ( 0 == strncmp(reason,"bootloader",10) || 0 == strncmp(reason,"bootmenu", 8) ) { - + if ( 0 == strncmp(reason,"bootloader",10) ) { +#ifdef OVERRIDE_STOCK_BOOTLOADER // override bootloader reboot mode ret = fputs("bootmenu", config); @@ -60,6 +61,25 @@ int reboot_wrapper(const char* reason) { printf("reboot: %s->bootmenu " BOARD_BOOTMODE_CONFIG_FILE " (%d)\n", reason, ret); #endif + need_clear_reason = 1; +#endif + } else if ( 0 == strncmp(reason,"bootmenu", 8) ) { + + char ext_reason[128], dummy[10]; + if (strlen(reason) > 8 && sscanf(reason, "%s %s", dummy, ext_reason) > 0) { + // allow "bootmenu recovery" or "bootmenu shell" + ret = fputs(ext_reason, config); + #if (DBG_LEVEL) + printf("reboot: %s->bootmenu " BOARD_BOOTMODE_CONFIG_FILE " (%d)\n", ext_reason, ret); + #endif + } else { + ret = fputs(reason, config); + #if (DBG_LEVEL) + printf("reboot: %s->bootmenu " BOARD_BOOTMODE_CONFIG_FILE " (%d)\n", reason, ret); + #endif + } + need_clear_reason = 1; + } else if ( 0 == strncmp(reason,"shell",5) ) { // override bootloader reboot mode @@ -69,6 +89,17 @@ int reboot_wrapper(const char* reason) { printf("reboot: %s->shell " BOARD_BOOTMODE_CONFIG_FILE " (%d)\n", reason, ret); #endif + need_clear_reason = 1; + +#ifndef OVERRIDE_STOCK_RECOVERY + } else if ( 0 == strncmp(reason,"recovery",8) ) { + + system("rm -f '" BOARD_BOOTMODE_CONFIG_FILE "'"); + + #if (DBG_LEVEL) + printf("reboot: allowing stock recovery reboot\n"); + #endif +#endif } else { ret = fputs(reason, config); @@ -77,6 +108,7 @@ int reboot_wrapper(const char* reason) { printf("reboot: %s " BOARD_BOOTMODE_CONFIG_FILE " (%d)\n", reason, ret); #endif + need_clear_reason = 1; } fflush(config); From e600e943c6ef2f40ca341224a6fc88cf478438cc Mon Sep 17 00:00:00 2001 From: WangGuojian <5908183@163.com> Date: Fri, 27 Jan 2012 19:18:50 +0800 Subject: [PATCH 2/3] use custom graphic.c Change-Id: Iddedd6b53c7eecbd3b3bd44bde4aca9ded940065 --- minui/Android.mk | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/minui/Android.mk b/minui/Android.mk index dc5ff7b..f282842 100644 --- a/minui/Android.mk +++ b/minui/Android.mk @@ -4,7 +4,14 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) -LOCAL_SRC_FILES := graphics.c events.c resources.c +LOCAL_SRC_FILES := events.c resources.c + +ifneq ($(BOARD_CUSTOM_BOOTMENU_GRAPHICS),) + LOCAL_SRC_FILES += $(BOARD_CUSTOM_BOOTMENU_GRAPHICS) +else + LOCAL_SRC_FILES += graphics.c +endif + LOCAL_C_INCLUDES +=\ external/libpng\ From fc59a304fb5f34de41a41b27f029558e15179be4 Mon Sep 17 00:00:00 2001 From: WangGuojian <41245110@qq.com> Date: Wed, 1 Feb 2012 17:51:11 +0800 Subject: [PATCH 3/3] remove extra #endif Change-Id: Ie7aa7225bd52968ee083bac0014422a4566f2650 --- libreboot/reboot.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/libreboot/reboot.c b/libreboot/reboot.c index c3150cf..bff4597 100644 --- a/libreboot/reboot.c +++ b/libreboot/reboot.c @@ -66,21 +66,6 @@ int reboot_wrapper(const char* reason) { pr_debug("%s->bootmenu " BOARD_BOOTMODE_CONFIG_FILE " (%d)\n", reason, ret); need_clear_reason = 1; #endif - } else if ( 0 == strncmp(reason,"bootmenu", 8) ) { - - char ext_reason[128], dummy[10]; - if (strlen(reason) > 8 && sscanf(reason, "%s %s", dummy, ext_reason) > 0) { - // allow "bootmenu recovery" or "bootmenu shell" - ret = fputs(ext_reason, config); - pr_debug("bootmenu %s " BOARD_BOOTMODE_CONFIG_FILE " (%d)\n", ext_reason, ret); - } else { - ret = fputs(reason, config); - pr_debug("%s->bootmenu " BOARD_BOOTMODE_CONFIG_FILE " (%d)\n", reason, ret); - } - need_clear_reason = 1; - - need_clear_reason = 1; -#endif } else if ( 0 == strncmp(reason,"bootmenu", 8) ) { char ext_reason[128], dummy[10];