提交 97d8bd8b 编写于 作者: Z zhong_ning

modify updater init

上级 3900746c
...@@ -21,7 +21,7 @@ if (defined(ohos_lite)) { ...@@ -21,7 +21,7 @@ if (defined(ohos_lite)) {
executable("init") { executable("init") {
defines = [ defines = [
"_GNU_SOURCE", #syscall function need this macro definition "_GNU_SOURCE", #syscall function need this macro definition
"OHOS_LITE=1", "OHOS_LITE",
] ]
sources = [ sources = [
"src/init_adapter.c", "src/init_adapter.c",
...@@ -97,7 +97,6 @@ if (defined(ohos_lite)) { ...@@ -97,7 +97,6 @@ if (defined(ohos_lite)) {
"src/init_signal_handler.c", "src/init_signal_handler.c",
"src/device.c", "src/device.c",
] ]
defines = [ "OHOS_LITE=0" ]
include_dirs = [ include_dirs = [
"include", "include",
"//third_party/cJSON", "//third_party/cJSON",
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <sys/mount.h> #include <sys/mount.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#if !OHOS_LITE #ifndef OHOS_LITE
#include <sys/syscall.h> #include <sys/syscall.h>
#include <fcntl.h> #include <fcntl.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -320,7 +320,7 @@ static void DoMount(const char* cmdContent) ...@@ -320,7 +320,7 @@ static void DoMount(const char* cmdContent)
free(target); free(target);
} }
#if !OHOS_LITE #ifndef OHOS_LITE
// format insmod <ko name> [-f] [options] // format insmod <ko name> [-f] [options]
static void DoInsmod(const char *cmdContent) static void DoInsmod(const char *cmdContent)
{ {
...@@ -370,10 +370,12 @@ static void DoInsmod(const char *cmdContent) ...@@ -370,10 +370,12 @@ static void DoInsmod(const char *cmdContent)
if (p != NULL) { if (p != NULL) {
if (restPtr != NULL) { if (restPtr != NULL) {
if (snprintf_s(options, sizeof(options), OPTIONS_SIZE -1, "%s %s", p, restPtr) == -1) { if (snprintf_s(options, sizeof(options), OPTIONS_SIZE -1, "%s %s", p, restPtr) == -1) {
goto out;
return; return;
} }
} else { } else {
if (strncpy_s(options, OPTIONS_SIZE - 1, p, strlen(p)) != 0) { if (strncpy_s(options, OPTIONS_SIZE - 1, p, strlen(p)) != 0) {
goto out;
return; return;
} }
} }
...@@ -487,7 +489,7 @@ void DoCmd(const CmdLine* curCmd) ...@@ -487,7 +489,7 @@ void DoCmd(const CmdLine* curCmd)
} else if (strncmp(curCmd->name, "loadcfg ", strlen("loadcfg ")) == 0) { } else if (strncmp(curCmd->name, "loadcfg ", strlen("loadcfg ")) == 0) {
DoLoadCfg(curCmd->cmdContent); DoLoadCfg(curCmd->cmdContent);
} }
#if !OHOS_LITE #ifndef OHOS_LITE
else if (strncmp(curCmd->name, "insmod ", strlen("insmod ")) == 0) { else if (strncmp(curCmd->name, "insmod ", strlen("insmod ")) == 0) {
DoInsmod(curCmd->cmdContent); DoInsmod(curCmd->cmdContent);
} }
......
...@@ -27,11 +27,11 @@ ...@@ -27,11 +27,11 @@
#include "init_adapter.h" #include "init_adapter.h"
#include "init_read_cfg.h" #include "init_read_cfg.h"
#include "init_signal_handler.h" #include "init_signal_handler.h"
#if OHOS_LITE #ifdef OHOS_LITE
#include "parameter.h" #include "parameter.h"
#endif #endif
#if !OHOS_LITE #ifndef OHOS_LITE
#include "device.h" #include "device.h"
#endif #endif
...@@ -39,7 +39,7 @@ static const pid_t INIT_PROCESS_PID = 1; ...@@ -39,7 +39,7 @@ static const pid_t INIT_PROCESS_PID = 1;
static void PrintSysInfo() static void PrintSysInfo()
{ {
#if OHOS_LITE #ifdef OHOS_LITE
char* sysInfo = GetVersionId(); char* sysInfo = GetVersionId();
if (sysInfo != NULL) { if (sysInfo != NULL) {
printf("[Init] %s\n", sysInfo); printf("[Init] %s\n", sysInfo);
...@@ -80,7 +80,7 @@ int main(int argc, char * const argv[]) ...@@ -80,7 +80,7 @@ int main(int argc, char * const argv[])
// 1. print system info // 1. print system info
PrintSysInfo(); PrintSysInfo();
#if !OHOS_LITE #ifndef OHOS_LITE
// 2. Mount basic filesystem and create common device node. // 2. Mount basic filesystem and create common device node.
MountBasicFs(); MountBasicFs();
CreateDeviceNode(); CreateDeviceNode();
......
...@@ -21,9 +21,9 @@ unittest("init_test") { ...@@ -21,9 +21,9 @@ unittest("init_test") {
"-lpthread", "-lpthread",
"-lm", "-lm",
] ]
defines = ["OHOS_LITE"]
if (storage_type == "emmc") { if (storage_type == "emmc") {
defines = [ "USE_EMMC_STORAGE" ] defines += [ "USE_EMMC_STORAGE" ]
} }
include_dirs = [ "//base/startup/init_lite/services/include" ] include_dirs = [ "//base/startup/init_lite/services/include" ]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册