Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
147227fd
S
Startup Init Lite
项目概览
OpenHarmony
/
Startup Init Lite
1 年多 前同步成功
通知
3
Star
37
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Startup Init Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
147227fd
编写于
2月 17, 2022
作者:
H
hw_mzyan
提交者:
Gitee
2月 17, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of gitee.com:openharmony/startup_init_lite into master
上级
2469ed59
40161568
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
19 addition
and
77 deletion
+19
-77
begetd.gni
begetd.gni
+1
-1
services/BUILD.gn
services/BUILD.gn
+3
-0
services/etc/init.cfg
services/etc/init.cfg
+1
-3
services/etc/init.without_two_stages.cfg
services/etc/init.without_two_stages.cfg
+1
-3
services/init/init_common_service.c
services/init/init_common_service.c
+2
-2
services/init/init_service_manager.c
services/init/init_service_manager.c
+1
-4
services/init/init_service_socket.c
services/init/init_service_socket.c
+1
-0
services/init/standard/init.c
services/init/standard/init.c
+4
-7
services/init/standard/init_cmds.c
services/init/standard/init_cmds.c
+1
-0
services/init/standard/init_service.c
services/init/standard/init_service.c
+1
-1
services/param/include/param_message.h
services/param/include/param_message.h
+1
-1
ueventd/BUILD.gn
ueventd/BUILD.gn
+2
-2
ueventd/lite/ueventd_main.c
ueventd/lite/ueventd_main.c
+0
-53
ueventd/ueventd_main.c
ueventd/ueventd_main.c
+0
-0
未找到文件。
begetd.gni
浏览文件 @
147227fd
...
...
@@ -13,7 +13,7 @@
declare_args() {
param_feature_watcher = true
param_test =
fals
e
param_test =
tru
e
if (defined(product_name) && product_name == "rk3568") {
boot_kernel_extended_cmdline =
...
...
services/BUILD.gn
浏览文件 @
147227fd
...
...
@@ -184,6 +184,9 @@ if (defined(ohos_lite)) {
if (!enable_ramdisk) {
defines += [ "DISABLE_INIT_TWO_STAGES" ]
}
if (support_jsapi) {
defines += [ "SUPPORT_PROFILER_HIDEBUG" ]
}
if (defined(product_name) && product_name == "rk3568") {
defines += [ "PRODUCT_RK" ]
...
...
services/etc/init.cfg
浏览文件 @
147227fd
...
...
@@ -420,8 +420,7 @@
"name" : "boot && param:const.debuggable=1",
"condition" : "boot && const.debuggable=1",
"cmds" : [
"start console",
"start misc"
"start console"
]
}, {
"name" : "services:console",
...
...
@@ -481,7 +480,6 @@
"gid" : ["shell", "log", "readproc"]
}, {
"name" : "misc",
"start-mode" : "normal",
"path" : ["/system/bin/misc_daemon", "--write_logo", "/vendor/logo.rgb"],
"once" : 1
}
...
...
services/etc/init.without_two_stages.cfg
浏览文件 @
147227fd
...
...
@@ -188,7 +188,6 @@
}, {
"name" : "post-fs-data",
"cmds" : [
"start misc",
"mkdir /data/app 0711 root root",
"mkdir /data/app/el1 0711 root root",
"mkdir /data/app/el1/bundle 0711 root root",
...
...
@@ -453,8 +452,7 @@
}, {
"name" : "misc",
"path" : ["/system/bin/misc_daemon", "--write_logo", "/vendor/logo.rgb"],
"once" : 1,
"start-mode" : "normal"
"once" : 1
}
]
}
services/init/init_common_service.c
浏览文件 @
147227fd
...
...
@@ -352,8 +352,8 @@ int ServiceStop(Service *service)
static
bool
CalculateCrashTime
(
Service
*
service
,
int
crashTimeLimit
,
int
crashCountLimit
)
{
INIT_ERROR_CHECK
(
service
!=
NULL
&&
crashTimeLimit
>
0
&&
crashCountLimit
>
0
,
return
0
,
"Service name=%s, input params error."
,
service
->
name
);
INIT_ERROR_CHECK
(
service
!=
NULL
&&
crashTimeLimit
>
0
&&
crashCountLimit
>
0
,
return
false
,
"input params error."
);
time_t
curTime
=
time
(
NULL
);
if
(
service
->
crashCnt
==
0
)
{
service
->
firstCrashTime
=
curTime
;
...
...
services/init/init_service_manager.c
浏览文件 @
147227fd
...
...
@@ -640,10 +640,7 @@ static int CheckServiceKeyName(const cJSON *curService)
char
*
cfgServiceKeyList
[]
=
{
"name"
,
"path"
,
"uid"
,
"gid"
,
"once"
,
"importance"
,
"caps"
,
"disabled"
,
"writepid"
,
"critical"
,
"socket"
,
"console"
,
"dynamic"
,
"file"
,
"ondemand"
,
"d-caps"
,
"apl"
,
"jobs"
,
"start-mode"
,
"end-mode"
,
"cpucore"
,
#ifdef WITH_SELINUX
SECON_STR_IN_CFG
,
#endif // WITH_SELINUX
"d-caps"
,
"apl"
,
"jobs"
,
"start-mode"
,
"end-mode"
,
"cpucore"
,
"secon"
};
INIT_CHECK_RETURN_VALUE
(
curService
!=
NULL
,
SERVICE_FAILURE
);
cJSON
*
child
=
curService
->
child
;
...
...
services/init/init_service_socket.c
浏览文件 @
147227fd
...
...
@@ -202,6 +202,7 @@ void SocketDelWatcher(ServiceWatcher watcherHandle)
int
CreateServiceSocket
(
Service
*
service
)
{
INIT_CHECK
(
service
!=
NULL
&&
service
->
socketCfg
!=
NULL
,
return
0
);
INIT_CHECK
(
service
->
socketCfg
->
sockFd
==
-
1
,
return
0
);
int
ret
=
0
;
ServiceSocket
*
tmpSock
=
service
->
socketCfg
;
while
(
tmpSock
!=
NULL
)
{
...
...
services/init/standard/init.c
浏览文件 @
147227fd
...
...
@@ -62,6 +62,7 @@ static int FdHolderSockInit(void)
unlink
(
INIT_HOLDER_SOCKET_PATH
);
}
struct
sockaddr_un
addr
;
addr
.
sun_family
=
AF_UNIX
;
if
(
strncpy_s
(
addr
.
sun_path
,
sizeof
(
addr
.
sun_path
),
INIT_HOLDER_SOCKET_PATH
,
strlen
(
INIT_HOLDER_SOCKET_PATH
))
!=
0
)
{
INIT_LOGE
(
"Faild to copy fd hoder socket path"
);
...
...
@@ -70,7 +71,7 @@ static int FdHolderSockInit(void)
}
socklen_t
len
=
(
socklen_t
)(
offsetof
(
struct
sockaddr_un
,
sun_path
)
+
strlen
(
addr
.
sun_path
)
+
1
);
if
(
bind
(
sock
,
(
struct
sockaddr
*
)
&
addr
,
len
)
<
0
)
{
INIT_LOGE
(
"Failed to binder fd folder socket
"
);
INIT_LOGE
(
"Failed to binder fd folder socket
%d"
,
errno
);
close
(
sock
);
return
-
1
;
}
...
...
@@ -158,6 +159,7 @@ static int StartUeventd(char **requiredDevices, int num)
return
-
1
;
}
RetriggerUevent
(
ueventSockFd
,
requiredDevices
,
num
);
close
(
ueventSockFd
);
return
0
;
}
...
...
@@ -242,12 +244,7 @@ static void BootStateChange(const char *content)
{
INIT_LOGI
(
"boot start %s finish."
,
content
);
if
(
strcmp
(
"init"
,
content
)
==
0
)
{
static
const
char
*
bootServiceNames
[]
=
{
"hdf_devmgr"
,
"samgr"
,
"appspawn"
,
"faultloggerd"
};
for
(
int
i
=
0
;
i
<
ARRAY_LENGTH
(
bootServiceNames
);
i
++
)
{
StartServiceByName
(
bootServiceNames
[
i
],
0
);
}
StartAllServices
(
START_MODE_BOOT
);
return
;
}
if
(
strcmp
(
"post-init"
,
content
)
==
0
)
{
...
...
services/init/standard/init_cmds.c
浏览文件 @
147227fd
...
...
@@ -63,6 +63,7 @@ int GetParamValue(const char *symValue, unsigned int symLen, char *paramValue, u
curr
+=
begin
-
start
;
}
while
(
*
begin
!=
'{'
)
{
INIT_CHECK_RETURN_VALUE
(
*
begin
!=
'\0'
,
-
1
);
begin
++
;
}
begin
++
;
...
...
services/init/standard/init_service.c
浏览文件 @
147227fd
...
...
@@ -132,7 +132,7 @@ void GetAccessToken(void)
uint64_t
tokenId
=
GetAccessTokenId
(
service
->
name
,
(
const
char
**
)
service
->
capsArgs
.
argv
,
service
->
capsArgs
.
count
,
service
->
apl
);
if
(
tokenId
==
0
)
{
INIT_LOGE
(
"
Set totken id %lld of service
\'
%s
\'
failed"
,
service
->
name
,
tokenId
);
INIT_LOGE
(
"
Get totken id %lld of service
\'
%s
\'
failed"
,
tokenId
,
service
->
name
);
}
service
->
tokenId
=
tokenId
;
}
...
...
services/param/include/param_message.h
浏览文件 @
147227fd
...
...
@@ -69,7 +69,7 @@ typedef struct {
typedef
struct
{
ParamMessage
msg
;
u
int32_t
result
;
int32_t
result
;
}
ParamResponseMessage
;
typedef
LoopBase
*
ParamTaskPtr
;
...
...
ueventd/BUILD.gn
浏览文件 @
147227fd
...
...
@@ -17,11 +17,11 @@ if (defined(ohos_lite)) {
sources = [
"//base/startup/init_lite/services/utils/init_utils.c",
"//base/startup/init_lite/services/utils/list.c",
"//base/startup/init_lite/ueventd/lite/ueventd_main.c",
"//base/startup/init_lite/ueventd/lite/ueventd_parameter.c",
"//base/startup/init_lite/ueventd/ueventd.c",
"//base/startup/init_lite/ueventd/ueventd_device_handler.c",
"//base/startup/init_lite/ueventd/ueventd_firmware_handler.c",
"//base/startup/init_lite/ueventd/ueventd_main.c",
"//base/startup/init_lite/ueventd/ueventd_read_cfg.c",
"//base/startup/init_lite/ueventd/ueventd_socket.c",
]
...
...
@@ -104,8 +104,8 @@ if (defined(ohos_lite)) {
ohos_executable("ueventd") {
sources = service_ueventd_sources
sources += [
"//base/startup/init_lite/ueventd/standard/ueventd_main.c",
"//base/startup/init_lite/ueventd/standard/ueventd_parameter.c",
"//base/startup/init_lite/ueventd/ueventd_main.c",
]
include_dirs = service_ueventd_include
include_dirs += [
...
...
ueventd/lite/ueventd_main.c
已删除
100755 → 0
浏览文件 @
2469ed59
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <poll.h>
#include "ueventd.h"
#include "ueventd_read_cfg.h"
#include "ueventd_socket.h"
#define INIT_LOG_TAG "ueventd"
#include "init_log.h"
int
main
(
int
argc
,
char
**
argv
)
{
char
*
ueventdConfigs
[]
=
{
"/etc/ueventd.config"
,
NULL
};
int
i
=
0
;
int
ret
=
-
1
;
while
(
ueventdConfigs
[
i
]
!=
NULL
)
{
ParseUeventdConfigFile
(
ueventdConfigs
[
i
++
]);
}
int
ueventSockFd
=
UeventdSocketInit
();
if
(
ueventSockFd
<
0
)
{
INIT_LOGE
(
"Failed to create uevent socket"
);
return
-
1
;
}
RetriggerUevent
(
ueventSockFd
,
NULL
,
0
);
// Not require boot devices
struct
pollfd
pfd
=
{};
pfd
.
events
=
POLLIN
;
pfd
.
fd
=
ueventSockFd
;
while
(
1
)
{
pfd
.
revents
=
0
;
ret
=
poll
(
&
pfd
,
1
,
-
1
);
if
(
ret
<=
0
)
{
continue
;
}
if
(
pfd
.
revents
&
POLLIN
)
{
ProcessUevent
(
ueventSockFd
,
NULL
,
0
);
// Not require boot devices
}
}
return
0
;
}
ueventd/
standard/
ueventd_main.c
→
ueventd/ueventd_main.c
浏览文件 @
147227fd
文件已移动
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录