diff --git a/services/cmds/reboot/init_cmd_reboot.c b/services/cmds/reboot/init_cmd_reboot.c index ad3dd2bed020ddfd1577b4df76c826aecdbcce3d..ac018fcf72e5305ffb92f6dabf31a90546fffe9a 100755 --- a/services/cmds/reboot/init_cmd_reboot.c +++ b/services/cmds/reboot/init_cmd_reboot.c @@ -24,6 +24,7 @@ " reboot updater[:options]\n" \ " reboot flashd\n" \ " reboot flashd[:options]\n" \ + " reboot loader\n" \ " reboot\n" int main(int argc, char* argv[]) @@ -36,6 +37,7 @@ int main(int argc, char* argv[]) if (argc == REBOOT_CMD_NUMBER && strcmp(argv[1], "shutdown") != 0 && strcmp(argv[1], "updater") != 0 && strcmp(argv[1], "flashd") != 0 && + strcmp(argv[1], "loader") !=0 && strncmp(argv[1], "updater:", strlen("updater:")) != 0 && strncmp(argv[1], "flashd:", strlen("flashd:")) != 0) { printf("%s", USAGE_INFO); diff --git a/services/init/standard/init_reboot.c b/services/init/standard/init_reboot.c index 8cf702f3f91a4c0d9593ec64911adaec6374c712..0dcc4c67ac41b73316dd8cd01a13527f05ded190 100755 --- a/services/init/standard/init_reboot.c +++ b/services/init/standard/init_reboot.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "init_log.h" #include "init_service.h" @@ -27,6 +28,10 @@ #define MAX_COMMAND_SIZE 20 #define MAX_UPDATE_SIZE 100 +#define REBOOT_MAGIC1 0xfee1dead +#define REBOOT_MAGIC2 672274793 +#define REBOOT_CMD_RESTART2 0xA1B2C3D4 + struct RBMiscUpdateMessage { char command[MAX_COMMAND_SIZE]; char update[MAX_UPDATE_SIZE]; @@ -137,7 +142,7 @@ static int CheckRebootParam(const char *valueData) return 0; } static const char *cmdParams[] = { - "shutdown", "updater", "updater:", "flash", "flash:", "NoArgument", "bootloader" + "shutdown", "updater", "updater:", "flash", "flash:", "NoArgument", "loader","bootloader" }; size_t i = 0; for (; i < ARRAY_LENGTH(cmdParams); i++) { @@ -188,6 +193,8 @@ void ExecReboot(const char *value) ret = CheckAndRebootToUpdater(valueData, "updater", "updater:", "boot_updater"); } else if (strncmp(valueData, "flash", strlen("flash")) == 0) { ret = CheckAndRebootToUpdater(valueData, "flash", "flash:", "boot_flash"); + } else if (strncmp(valueData, "loader", strlen("loader")) == 0) { + syscall(__NR_reboot, REBOOT_MAGIC1, REBOOT_MAGIC2, REBOOT_CMD_RESTART2, "loader"); } INIT_LOGI("Reboot %s %s.", value, (ret == 0) ? "success" : "fail"); return;