# 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", ] FSCRYPT_PATH = "//foundation/filemanagement/storage_service/services/storage_daemon" import("//build/ohos.gni") import("//build/ohos/native_stub/native_stub.gni") ohos_executable("init") { sources = [ "../adapter/init_adapter.c", "../standard/device.c", "../standard/fd_holder_service.c", "../standard/init.c", "../standard/init_cmdexecutor.c", "../standard/init_cmds.c", "../standard/init_control_fd_service.c", "../standard/init_jobs.c", "../standard/init_mount.c", "../standard/init_reboot.c", "../standard/init_service.c", "../standard/init_signal_handler.c", "../standard/switch_root.c", ] modulemgr_sources = [ "//base/startup/init/interfaces/innerkits/hookmgr/hookmgr.c", "//base/startup/init/interfaces/innerkits/modulemgr/modulemgr.c", ] sources += modulemgr_sources sources += init_common_sources include_dirs = [ "//base/startup/init/services/init/include", "${FSCRYPT_PATH}/include/libfscrypt", ] deps = [ "//base/startup/init/interfaces/innerkits/control_fd:libcontrolfd", "//base/startup/init/interfaces/innerkits/fd_holder:fdholder", "//base/startup/init/interfaces/innerkits/fs_manager:libfsmanager_static", "//base/startup/init/interfaces/innerkits/sandbox:sandbox", "//base/startup/init/services/loopevent:loopevent", "//base/startup/init/services/param/linux:param_init", "//base/startup/init/services/utils:libinit_utils", ] if (use_musl == false) { deps += [ "//base/startup/init/services/param/base:parameterbase" ] } else { deps += [ "//base/startup/init/services/param/base:parameterbase_ext" ] } deps += [ "//base/customization/config_policy/frameworks/config_policy:configpolicy_util_for_init_static", "//base/security/access_token/interfaces/innerkits/nativetoken:libnativetoken", "//base/security/access_token/interfaces/innerkits/token_setproc:libtoken_setproc", "//base/startup/init/ueventd:libueventd_ramdisk_static", "//third_party/bounds_checking_function:libsec_static", "//third_party/cJSON:cjson_static", "//third_party/e2fsprogs:e2fsprogs", ] deps += [ "//base/startup/init/interfaces/innerkits/init_module_engine:libinit_stub_versionscript" ] deps += [ "//base/startup/init/interfaces/innerkits/init_module_engine:init_module_engine_sources" ] deps += [ "//base/startup/init/services/modules:static_modules" ] deps += [ "${FSCRYPT_PATH}/libfscrypt:libfscryptutils_static" ] cflags = [] if (use_musl) { deps += [ "//third_party/f2fs-tools:f2fs-tools", "//third_party/mksh:sh", "//third_party/toybox:toybox", ] } if (build_seccomp) { cflags += [ "-DWITH_SECCOMP" ] } 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 = [ "PARAM_SUPPORT_TRIGGER" ] if (param_test) { defines += [ "OHOS_SERVICE_DUMP", "INIT_TEST", ] } if (target_cpu == "arm64") { defines += [ "SUPPORT_64BIT" ] } if (!enable_ramdisk) { defines += [ "DISABLE_INIT_TWO_STAGES" ] } if (support_jsapi) { defines += [ "SUPPORT_PROFILER_HIDEBUG" ] } if (asan_detector) { defines += [ "ASAN_DETECTOR" ] } if (enable_ohos_startup_init_feature_loader) { defines += [ "PRODUCT_RK" ] } version_script = get_label_info( "//base/startup/init/interfaces/innerkits/init_module_engine:libinit_stub_versionscript", "target_gen_dir") + "/" + get_label_info( "//base/startup/init/interfaces/innerkits/init_module_engine:libinit_stub_versionscript", "name") + stub_version_script_suffix defines += [ "_GNU_SOURCE" ] install_images = [ "system", "updater", "ramdisk", ] install_enable = true part_name = "init" }