提交 d69b944c 编写于 作者: O openharmony_ci 提交者: Gitee

!174 dayu200 增加进入下载模式命令(reboot loader)

Merge pull request !174 from yang_hongliang/master
......@@ -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);
......
......@@ -16,6 +16,7 @@
#include <stdlib.h>
#include <sys/mount.h>
#include <sys/reboot.h>
#include <sys/syscall.h>
#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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册