Merge branch 'gingerbread' of git://github.com/CyanogenMod/android_bootable_recovery into gingerbread
This commit is contained in:
commit
16cfb3c72f
@ -18,7 +18,7 @@ LOCAL_SRC_FILES := \
|
||||
mounts.c \
|
||||
extendedcommands.c \
|
||||
nandroid.c \
|
||||
reboot.c \
|
||||
../../system/core/toolbox/reboot.c \
|
||||
edifyscripting.c \
|
||||
setprop.c
|
||||
|
||||
@ -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
|
||||
|
||||
@ -86,6 +87,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)
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <reboot/reboot.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
@ -885,10 +886,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:
|
||||
{
|
||||
|
76
reboot.c
76
reboot.c
@ -1,76 +0,0 @@
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <unistd.h>
|
||||
#include <cutils/properties.h>
|
||||
|
||||
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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user