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

modify updater init

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