mirror of
https://gitee.com/openharmony/startup_init
synced 2024-11-30 05:41:10 +00:00
3817020fa0
Signed-off-by: xionglei6 <xionglei6@huawei.com>
352 lines
10 KiB
Plaintext
Executable File
352 lines
10 KiB
Plaintext
Executable File
# Copyright (c) 2020-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.
|
|
|
|
init_common_sources = [
|
|
"init/init_capability.c",
|
|
"init/init_common_cmds.c",
|
|
"init/init_common_service.c",
|
|
"init/init_config.c",
|
|
"init/init_group_manager.c",
|
|
"init/init_service_file.c",
|
|
"init/init_service_manager.c",
|
|
"init/init_service_socket.c",
|
|
"init/main.c",
|
|
]
|
|
|
|
if (defined(ohos_lite)) {
|
|
# feature: init
|
|
executable("init_lite") {
|
|
output_name = "init"
|
|
defines = [
|
|
"_GNU_SOURCE", #syscall function need this macro definition
|
|
"OHOS_LITE",
|
|
]
|
|
defines += [ "__MUSL__" ]
|
|
sources = [
|
|
"init/adapter/init_adapter.c",
|
|
"init/lite/init.c",
|
|
"init/lite/init_cmds.c",
|
|
"init/lite/init_jobs.c",
|
|
"init/lite/init_reboot.c",
|
|
"init/lite/init_service.c",
|
|
"init/lite/init_signal_handler.c",
|
|
"log/init_log.c",
|
|
"utils/init_hashmap.c",
|
|
"utils/init_utils.c",
|
|
"utils/list.c",
|
|
]
|
|
|
|
sources += init_common_sources
|
|
|
|
include_dirs = [
|
|
"//base/startup/init_lite/services/include",
|
|
"//base/startup/init_lite/services/init/include",
|
|
"//base/startup/init_lite/services/log",
|
|
"//base/startup/init_lite/services/loopevent/include",
|
|
"//base/startup/init_lite/interfaces/innerkits/include",
|
|
"//third_party/cJSON",
|
|
"//third_party/bounds_checking_function/include",
|
|
"//base/startup/syspara_lite/interfaces/kits",
|
|
"//base/hiviewdfx/hilog_lite/interfaces/native/kits",
|
|
"//base/startup/init_lite/interfaces/innerkits/fd_holder",
|
|
]
|
|
|
|
cflags = [ "-Wall" ]
|
|
|
|
deps = [
|
|
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
|
|
"//base/startup/init_lite/initsync:initsync",
|
|
"//base/startup/init_lite/services/loopevent:loopevent",
|
|
"//base/startup/syspara_lite/frameworks/parameter:parameter",
|
|
"//build/lite/config/component/cJSON:cjson_shared",
|
|
"//third_party/bounds_checking_function:libsec_shared",
|
|
]
|
|
ldflags = []
|
|
if (ohos_kernel_type == "liteos_a") {
|
|
include_dirs += [
|
|
"//kernel/liteos_a/syscall",
|
|
"//base/startup/init_lite/interfaces/kits",
|
|
"//base/startup/init_lite/initsync/include",
|
|
]
|
|
deps += [ "//base/startup/init_lite/initsync:initsync" ]
|
|
}
|
|
if (ohos_kernel_type == "linux") {
|
|
defines += [ "NEED_EXEC_RCS_LINUX" ]
|
|
defines += [ "_GNU_SOURCE" ]
|
|
ldflags += [
|
|
"-lm",
|
|
"-lpthread",
|
|
]
|
|
deps += [
|
|
"//third_party/mksh",
|
|
"//third_party/toybox",
|
|
]
|
|
}
|
|
}
|
|
|
|
if (ohos_build_type == "debug") {
|
|
group("unittest") {
|
|
deps = [ "//base/startup/init_lite/test/unittest/common:unittest" ]
|
|
}
|
|
}
|
|
} else {
|
|
import("//base/startup/init_lite/begetd.gni")
|
|
import("//build/ohos.gni")
|
|
|
|
ohos_executable("init") {
|
|
sources = [
|
|
"//base/startup/init_lite/interfaces/innerkits/fd_holder/fd_holder_internal.c",
|
|
"init/adapter/init_adapter.c",
|
|
"init/standard/device.c",
|
|
"init/standard/fd_holder_service.c",
|
|
"init/standard/init.c",
|
|
"init/standard/init_cmds.c",
|
|
"init/standard/init_jobs.c",
|
|
"init/standard/init_mount.c",
|
|
"init/standard/init_plugin_manager.c",
|
|
"init/standard/init_reboot.c",
|
|
"init/standard/init_service.c",
|
|
"init/standard/init_signal_handler.c",
|
|
"init/standard/switch_root.c",
|
|
]
|
|
|
|
sources += init_common_sources
|
|
|
|
include_dirs = [
|
|
"//base/security/access_token/interfaces/innerkits/token_setproc/include",
|
|
"//base/security/access_token/interfaces/innerkits/nativetoken/include",
|
|
"//base/startup/init_lite/interfaces/innerkits/sandbox/include",
|
|
"//base/startup/init_lite/services/include/param",
|
|
"//base/startup/init_lite/services/include",
|
|
"//base/startup/init_lite/services/init/include",
|
|
"//base/startup/init_lite/services/log",
|
|
"//base/startup/init_lite/interfaces/innerkits/include",
|
|
"//base/startup/init_lite/services/loopevent/include",
|
|
"//base/startup/init_lite/interfaces/innerkits/include",
|
|
"//base/startup/init_lite/interfaces/innerkits/fd_holder",
|
|
"//base/startup/init_lite/ueventd/include",
|
|
"//third_party/cJSON",
|
|
"//third_party/bounds_checking_function/include",
|
|
]
|
|
deps = [
|
|
"//base/security/access_token/interfaces/innerkits/nativetoken:libnativetoken",
|
|
"//base/security/access_token/interfaces/innerkits/token_setproc:libtoken_setproc",
|
|
"//base/startup/init_lite/interfaces/innerkits:libfsmanager_static",
|
|
"//base/startup/init_lite/interfaces/innerkits/sandbox:libsandbox_static",
|
|
"//base/startup/init_lite/services/log:init_log",
|
|
"//base/startup/init_lite/services/loopevent:loopevent",
|
|
"//base/startup/init_lite/services/param:param_service",
|
|
"//base/startup/init_lite/services/utils:libinit_tools",
|
|
"//base/startup/init_lite/services/utils:libinit_utils",
|
|
"//base/startup/init_lite/ueventd:libueventd_ramdisk_static",
|
|
"//third_party/bounds_checking_function:libsec_static",
|
|
"//third_party/cJSON:cjson_static",
|
|
]
|
|
|
|
cflags = []
|
|
|
|
if (use_musl) {
|
|
deps += [
|
|
"//third_party/mksh:sh",
|
|
"//third_party/toybox:toybox",
|
|
]
|
|
}
|
|
|
|
if (build_selinux) {
|
|
include_dirs += [
|
|
"//third_party/selinux/libselinux/include/",
|
|
"//base/security/selinux/interfaces/policycoreutils/include/",
|
|
]
|
|
deps += [
|
|
"//base/security/selinux:libload_policy",
|
|
"//base/security/selinux:librestorecon",
|
|
"//third_party/selinux:libselinux",
|
|
]
|
|
cflags += [ "-DWITH_SELINUX" ]
|
|
}
|
|
|
|
defines = []
|
|
if (param_test) {
|
|
defines += [
|
|
"OHOS_SERVICE_DUMP",
|
|
"INIT_TEST",
|
|
]
|
|
}
|
|
|
|
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" ]
|
|
}
|
|
defines += [ "_GNU_SOURCE" ]
|
|
install_images = [
|
|
"system",
|
|
"updater",
|
|
"ramdisk",
|
|
]
|
|
install_enable = true
|
|
part_name = "init"
|
|
}
|
|
|
|
group("startup_init") {
|
|
deps = [
|
|
":init",
|
|
":init_etc",
|
|
"//base/startup/init_lite/services/param:param_client",
|
|
"//base/startup/init_lite/services/param:param_service",
|
|
]
|
|
if (param_feature_watcher) {
|
|
deps += [
|
|
"//base/startup/init_lite/services/param/watcher:param_watcher",
|
|
"//base/startup/init_lite/services/param/watcher:param_watcher.rc",
|
|
"//base/startup/init_lite/services/param/watcher:param_watcheragent",
|
|
"//base/startup/init_lite/services/param/watcher/sa_profile:param_watcher_profile",
|
|
]
|
|
}
|
|
}
|
|
|
|
# init etc files group
|
|
ohos_prebuilt_etc("init.cfg") {
|
|
if (!enable_ramdisk) {
|
|
source =
|
|
"//base/startup/init_lite/services/etc/init.without_two_stages.cfg"
|
|
} else {
|
|
source = "//base/startup/init_lite/services/etc/init.cfg"
|
|
}
|
|
part_name = "init"
|
|
}
|
|
|
|
ohos_prebuilt_etc("passwd") {
|
|
source = "//base/startup/init_lite/services/etc/passwd"
|
|
install_images = [
|
|
"system",
|
|
"updater",
|
|
]
|
|
part_name = "init"
|
|
}
|
|
|
|
ohos_prebuilt_etc("group") {
|
|
source = "//base/startup/init_lite/services/etc/group"
|
|
install_images = [
|
|
"system",
|
|
"updater",
|
|
]
|
|
part_name = "init"
|
|
}
|
|
|
|
ohos_prebuilt_etc("init.usb.cfg") {
|
|
source = "//base/startup/init_lite/services/etc/init.usb.cfg"
|
|
part_name = "init"
|
|
}
|
|
|
|
ohos_prebuilt_etc("init.usb.configfs.cfg") {
|
|
source = "//base/startup/init_lite/services/etc/init.usb.configfs.cfg"
|
|
part_name = "init"
|
|
}
|
|
|
|
ohos_prebuilt_etc("ohos.para") {
|
|
source = "//base/startup/init_lite/services/etc/param/ohos.para"
|
|
part_name = "init"
|
|
module_install_dir = "etc/param"
|
|
}
|
|
|
|
ohos_prebuilt_etc("ohos.para.dac") {
|
|
source = "//base/startup/init_lite/services/etc/param/ohos.para.dac"
|
|
part_name = "init"
|
|
module_install_dir = "etc/param"
|
|
}
|
|
|
|
ohos_prebuilt_etc("boot.group") {
|
|
source = "//base/startup/init_lite/services/etc/device.boot.group.cfg"
|
|
part_name = "init"
|
|
}
|
|
|
|
ohos_prebuilt_etc("charing.group") {
|
|
source = "//base/startup/init_lite/services/etc/device.charing.group.cfg"
|
|
part_name = "init"
|
|
}
|
|
|
|
ohos_prebuilt_etc("syscap.para") {
|
|
source =
|
|
"${preloader_output_dir}/${product_name}/system/etc/param/syscap.para"
|
|
module_install_dir = "etc/param/"
|
|
part_name = "init"
|
|
}
|
|
|
|
ohos_prebuilt_etc("syscap.json") {
|
|
source = "${preloader_output_dir}/${product_name}/system/etc/syscap.json"
|
|
part_name = "init"
|
|
}
|
|
|
|
ohos_prebuilt_etc("systemcapability.json") {
|
|
source = "${preloader_output_dir}/${product_name}/system/etc/SystemCapability.json"
|
|
part_name = "init"
|
|
}
|
|
|
|
ohos_prebuilt_etc("plugin_modules") {
|
|
source = "//base/startup/init_lite/services/etc/plugin_modules.cfg"
|
|
part_name = "init"
|
|
}
|
|
|
|
ohos_prebuilt_etc("system-sandbox.json") {
|
|
source = "//base/startup/init_lite/interfaces/innerkits/sandbox/system-sandbox.json"
|
|
part_name = "init"
|
|
module_install_dir = "etc/sandbox"
|
|
}
|
|
|
|
ohos_prebuilt_etc("chipset-sandbox.json") {
|
|
source = "//base/startup/init_lite/interfaces/innerkits/sandbox/chipset-sandbox.json"
|
|
part_name = "init"
|
|
module_install_dir = "etc/sandbox"
|
|
}
|
|
|
|
ohos_prebuilt_etc("privapp-sandbox.json") {
|
|
source = "//base/startup/init_lite/interfaces/innerkits/sandbox/privapp-sandbox.json"
|
|
part_name = "init"
|
|
module_install_dir = "etc/sandbox"
|
|
}
|
|
|
|
ohos_prebuilt_etc("app-sandbox.json") {
|
|
source = "//base/startup/init_lite/interfaces/innerkits/sandbox/app-sandbox.json"
|
|
part_name = "init"
|
|
module_install_dir = "etc/sandbox"
|
|
}
|
|
|
|
group("init_etc") {
|
|
deps = [
|
|
":app-sandbox.json",
|
|
":boot.group",
|
|
":charing.group",
|
|
":chipset-sandbox.json",
|
|
":group",
|
|
":init.cfg",
|
|
":init.usb.cfg",
|
|
":init.usb.configfs.cfg",
|
|
":ohos.para",
|
|
":ohos.para.dac",
|
|
":passwd",
|
|
":plugin_modules",
|
|
":privapp-sandbox.json",
|
|
":syscap.json",
|
|
":syscap.para",
|
|
":system-sandbox.json",
|
|
":systemcapability.json",
|
|
]
|
|
}
|
|
}
|