# Copyright (c) 2022 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. import("//base/startup/init/begetd.gni") init_common_sources = [ "../init_capability.c", "../init_common_cmds.c", "../init_common_service.c", "../init_config.c", "../init_group_manager.c", "../init_service_file.c", "../init_service_manager.c", "../init_service_socket.c", "../main.c", ] # feature: init executable("init") { output_name = "init" defines = [ "_GNU_SOURCE", "OHOS_LITE", "__MUSL__", ] if (enable_ohos_startup_init_feature_begetctl_liteos) { defines += [ "LITEOS_SUPPORT" ] } sources = [ "../adapter/init_adapter.c", "../lite/init.c", "../lite/init_cmds.c", "../lite/init_jobs.c", "../lite/init_reboot.c", "../lite/init_service.c", "../lite/init_signal_handler.c", ] sources += init_common_sources include_dirs = [ "//base/startup/init/interfaces/innerkits/include", "//base/startup/init/interfaces/innerkits/fd_holder", "//base/startup/init/services/include/param", "//base/startup/init/services/init/include", "//third_party/cJSON", "//third_party/bounds_checking_function/include", "//base/hiviewdfx/hilog_lite/interfaces/native/kits", ] ldflags = [] deps = [ "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", "//base/startup/init/services/log:init_log", "//base/startup/init/services/loopevent:loopevent", "//base/startup/init/services/modules/init_hook:inithook", "//base/startup/init/services/param/base:param_base", "//base/startup/init/services/utils:libinit_utils", "//build/lite/config/component/cJSON:cjson_static", "//third_party/bounds_checking_function:libsec_static", ] if (ohos_kernel_type == "liteos_a") { defines += [ "__LITEOS_A__" ] include_dirs += [ "//kernel/liteos_a/syscall", "//kernel/liteos_a/kernel/include", "//base/startup/init/interfaces/kits/syscap", "//base/startup/init/initsync/include", ] deps += [ "//base/startup/init/initsync:initsync", "//base/startup/init/services/param/liteos:param_init_lite", ] } if (ohos_kernel_type == "linux") { defines += [ "NEED_EXEC_RCS_LINUX", "__LINUX__", ] ldflags += [ "-lm", "-lpthread", ] deps += [ "//base/startup/init/services/param/linux:param_init", "//third_party/mksh", "//third_party/toybox", ] } }