From 0e961cd47af149a8aaad6b61b1fe6ecb10ab9498 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Mon, 13 Jun 2011 19:51:00 -0700 Subject: [PATCH 1/3] Fix up tune2fs republish bug Change-Id: I43d77d52e73071777ee06bad360fe33f1cb747a0 --- Android.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Android.mk b/Android.mk index 745473f..dcd948a 100644 --- a/Android.mk +++ b/Android.mk @@ -86,6 +86,9 @@ ALL_DEFAULT_INSTALLED_MODULES += $(RECOVERY_SYMLINKS) # Now let's do recovery symlinks BUSYBOX_LINKS := $(shell cat external/busybox/busybox-minimal.links) +ifndef BOARD_HAS_SMALL_RECOVERY +exclude := tune2fs +endif RECOVERY_BUSYBOX_SYMLINKS := $(addprefix $(TARGET_RECOVERY_ROOT_OUT)/sbin/,$(filter-out $(exclude),$(notdir $(BUSYBOX_LINKS)))) $(RECOVERY_BUSYBOX_SYMLINKS): BUSYBOX_BINARY := busybox $(RECOVERY_BUSYBOX_SYMLINKS): $(LOCAL_INSTALLED_MODULE) From 2457adcdf77ba8da81a80c7bfa0535efaea243ac Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Tue, 14 Jun 2011 10:57:01 -0700 Subject: [PATCH 2/3] Do not duplicate reboot.c Change-Id: I2ed41ffd14372bec9e18865cf299e15abc67d689 --- Android.mk | 2 +- reboot.c | 76 ------------------------------------------------------ 2 files changed, 1 insertion(+), 77 deletions(-) delete mode 100644 reboot.c diff --git a/Android.mk b/Android.mk index dcd948a..a59fedf 100644 --- a/Android.mk +++ b/Android.mk @@ -18,7 +18,7 @@ LOCAL_SRC_FILES := \ mounts.c \ extendedcommands.c \ nandroid.c \ - reboot.c \ + ../../system/core/toolbox/reboot.c \ edifyscripting.c \ setprop.c diff --git a/reboot.c b/reboot.c deleted file mode 100644 index 6af84da..0000000 --- a/reboot.c +++ /dev/null @@ -1,76 +0,0 @@ -#include -#include -#include -#include -#include -#include - -int reboot_main(int argc, char *argv[]) -{ - int ret; - int nosync = 0; - int poweroff = 0; - int force = 0; - - opterr = 0; - do { - int c; - - c = getopt(argc, argv, "npf"); - - if (c == EOF) { - break; - } - - switch (c) { - case 'n': - nosync = 1; - break; - case 'p': - poweroff = 1; - break; - case 'f': - force = 1; - break; - case '?': - fprintf(stderr, "usage: %s [-n] [-p] [rebootcommand]\n", argv[0]); - exit(EXIT_FAILURE); - } - } while (1); - - if(argc > optind + 1) { - fprintf(stderr, "%s: too many arguments\n", argv[0]); - exit(EXIT_FAILURE); - } - - if(!nosync) - sync(); - - if(force || argc > optind) { - if(poweroff) - ret = __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_POWER_OFF, NULL); - else if(argc > optind) { -#ifdef TARGET_RECOVERY_PRE_COMMAND - if (!strncmp(argv[optind],"recovery",8)) - system( TARGET_RECOVERY_PRE_COMMAND ); -#endif - ret = __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, argv[optind]); - } else - ret = reboot(RB_AUTOBOOT); - } else { - if(poweroff) { - property_set("ctl.start", "poweroff"); - ret = 0; - } else { - property_set("ctl.start", "reboot"); - ret = 0; - } - } - - if(ret < 0) { - perror("reboot"); - exit(EXIT_FAILURE); - } - fprintf(stderr, "reboot returned\n"); - return 0; -} From 7126ef404cea011623bb836f27783924d843da75 Mon Sep 17 00:00:00 2001 From: Austen Dicken Date: Tue, 14 Jun 2011 15:47:40 -0500 Subject: [PATCH 3/3] use new libreboot static lib for rebooting relevant commit is here: http://review.cyanogenmod.com/#change,6128 Change-Id: Id8587cba4017c322b3a5b89c1f994ade684f424a --- Android.mk | 3 ++- extendedcommands.c | 6 ++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Android.mk b/Android.mk index a59fedf..2e0ffc6 100644 --- a/Android.mk +++ b/Android.mk @@ -31,7 +31,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_HAS_SMALL_RECOVERY BOARD_LDPI_RECOVERY BOARD_UMS_LUNFILE TARGET_RECOVERY_PRE_COMMAND +BOARD_RECOVERY_DEFINES := BOARD_HAS_NO_SELECT_BUTTON BOARD_HAS_SMALL_RECOVERY BOARD_LDPI_RECOVERY BOARD_UMS_LUNFILE $(foreach board_define,$(BOARD_RECOVERY_DEFINES), \ $(if $($(board_define)), \ @@ -53,6 +53,7 @@ else LOCAL_SRC_FILES += $(BOARD_CUSTOM_RECOVERY_KEYMAPPING) endif +LOCAL_STATIC_LIBRARIES += libreboot LOCAL_STATIC_LIBRARIES += libext4_utils libz LOCAL_STATIC_LIBRARIES += libminzip libunz libmincrypt diff --git a/extendedcommands.c b/extendedcommands.c index 4395377..64c4e3d 100644 --- a/extendedcommands.c +++ b/extendedcommands.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -894,10 +895,7 @@ void show_advanced_menu() switch (chosen_item) { case 0: -#ifdef TARGET_RECOVERY_PRE_COMMAND - __system( TARGET_RECOVERY_PRE_COMMAND ); -#endif - __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, "recovery"); + reboot_wrapper("recovery"); break; case 1: {