1# Copyright (c) 2021 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//build/ohos.gni") 15import("//foundation/filemanagement/storage_service/storage_service_aafwk.gni") 16 17## Install storage_daemon.cfg to /system/etc/init/storage_daemon.cfg {{{ 18ohos_prebuilt_etc("storage_daemon_cfg") { 19 source = "storage_daemon.cfg" 20 relative_install_dir = "init" 21 part_name = "storage_service" 22 subsystem_name = "filemanagement" 23} 24 25## Install storage_daemon.cfg to /system/etc/init/storage_daemon.cfg }}} 26 27config("storage_daemon_config") { 28 include_dirs = [ 29 "include", 30 "//third_party/bounds_checking_function/include", 31 "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/include", 32 "../storage_manager/include", 33 "//foundation/systemabilitymgr/safwk/interfaces/innerkits/safwk", 34 "//foundation/filemanagement/storage_service/interfaces/innerkits/storage_manager/native", 35 "//base/security/access_token/interfaces/innerkits/accesstoken/include", 36 "//foundation/filemanagement/storage_service/services/common/include", 37 ] 38} 39 40## Install config.txt to /system/etc/init/config.txt {{{ 41ohos_prebuilt_etc("storage_daemon_disk_config") { 42 source = "config.txt" 43 relative_install_dir = "init" 44 part_name = "storage_service" 45 subsystem_name = "filemanagement" 46} 47 48declare_args() { 49 storage_service_user_file_sharing = true 50} 51 52ohos_executable("storage_daemon") { 53 sources = [ 54 "../storage_manager/innerkits_impl/src/bundle_stats.cpp", 55 "../storage_manager/innerkits_impl/src/disk.cpp", 56 "../storage_manager/innerkits_impl/src/storage_stats.cpp", 57 "../storage_manager/innerkits_impl/src/volume_core.cpp", 58 "../storage_manager/innerkits_impl/src/volume_external.cpp", 59 "../storage_manager/ipc/src/storage_manager_proxy.cpp", 60 "disk/src/disk_config.cpp", 61 "disk/src/disk_info.cpp", 62 "disk/src/disk_manager.cpp", 63 "ipc/src/storage_daemon.cpp", 64 "ipc/src/storage_daemon_stub.cpp", 65 "ipc/src/storage_manager_client.cpp", 66 "main.cpp", 67 "netlink/src/netlink_data.cpp", 68 "netlink/src/netlink_handler.cpp", 69 "netlink/src/netlink_listener.cpp", 70 "netlink/src/netlink_manager.cpp", 71 "user/src/mount_manager.cpp", 72 "user/src/user_manager.cpp", 73 "utils/disk_utils.cpp", 74 "utils/mount_argument_utils.cpp", 75 "volume/src/external_volume_info.cpp", 76 "volume/src/process.cpp", 77 "volume/src/volume_info.cpp", 78 "volume/src/volume_manager.cpp", 79 ] 80 81 defines = [ 82 "STORAGE_LOG_TAG = \"StorageDaemon\"", 83 "LOG_DOMAIN = 0xD004301", 84 ] 85 86 if (storage_service_user_file_sharing) { 87 defines += [ "USER_FILE_SHARING" ] 88 sources += [ 89 "file_sharing/src/acl.cpp", 90 "file_sharing/src/file_sharing.cpp", 91 "file_sharing/src/setacl.cpp", 92 ] 93 } 94 95 configs = [ ":storage_daemon_config" ] 96 97 deps = [ 98 ":sdc", 99 ":storage_common_utils", 100 "crypto:libsdcrypto", 101 "libfscrypt:libfscryptutils", 102 ] 103 104 external_deps = [ 105 "ability_base:base", 106 "ability_base:want", 107 "ability_base:zuri", 108 "access_token:libaccesstoken_sdk", 109 "app_file_service:fileshare_native", 110 "c_utils:utils", 111 "hiviewdfx_hilog_native:libhilog", 112 "init:libbegetutil", 113 "ipc:ipc_core", 114 "samgr:samgr_proxy", 115 ] 116 117 subsystem_name = "filemanagement" 118 part_name = "storage_service" 119 install_enable = true 120} 121 122config("sdc_config") { 123 include_dirs = [ 124 "include", 125 "//foundation/filemanagement/storage_service/services/common/include", 126 "//commonlibrary/c_utils/base/include", 127 "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/include", 128 "//utils/system/safwk/native/include", 129 "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include/", 130 "client/include", 131 "../../interfaces/innerkits/storage_manager/native", 132 "../storage_manager/include", 133 "//foundation/bundlemanager/bundle_framework/services/bundlemgr/include", 134 "//foundation/systemabilitymgr/safwk/interfaces/innerkits/safwk", 135 ] 136} 137 138ohos_executable("sdc") { 139 sources = [ 140 "../storage_manager/client/storage_manager_client.cpp", 141 "../storage_manager/innerkits_impl/src/bundle_stats.cpp", 142 "../storage_manager/innerkits_impl/src/disk.cpp", 143 "../storage_manager/innerkits_impl/src/storage_stats.cpp", 144 "../storage_manager/innerkits_impl/src/volume_core.cpp", 145 "../storage_manager/innerkits_impl/src/volume_external.cpp", 146 "../storage_manager/ipc/src/storage_manager_proxy.cpp", 147 "client/storage_daemon_client.cpp", 148 "ipc/src/storage_daemon_proxy.cpp", 149 "sdc.cpp", 150 ] 151 152 defines = [ 153 "STORAGE_LOG_TAG = \"StorageDaemon\"", 154 "LOG_DOMAIN = 0xD004301", 155 ] 156 157 configs = [ ":sdc_config" ] 158 159 deps = [ 160 ":storage_common_utils", 161 "libfscrypt:libfscryptutils", 162 ] 163 164 public_deps = [ "//commonlibrary/c_utils/base:utils" ] 165 166 external_deps = [ 167 "hiviewdfx_hilog_native:libhilog", 168 "ipc:ipc_core", 169 "samgr:samgr_proxy", 170 ] 171 172 subsystem_name = "filemanagement" 173 part_name = "storage_service" 174 install_enable = true 175} 176 177declare_args() { 178 storage_service_fstools = true 179} 180 181ohos_shared_library("storage_common_utils") { 182 include_dirs = [ 183 "./include", 184 "//foundation/filemanagement/storage_service/services/common/include", 185 ] 186 187 defines = [ 188 "STORAGE_LOG_TAG = \"StorageCommonUtils\"", 189 "LOG_DOMAIN = 0xD004301", 190 ] 191 192 sources = [ 193 "./utils/file_utils.cpp", 194 "./utils/string_utils.cpp", 195 ] 196 197 if (build_selinux) { 198 defines += [ "USE_LIBRESTORECON" ] 199 include_dirs += 200 [ "//base/security/selinux/interfaces/policycoreutils/include" ] 201 202 deps = [ "//base/security/selinux:librestorecon" ] 203 } 204 205 external_deps = [ 206 "c_utils:utils", 207 "hiviewdfx_hilog_native:libhilog", 208 ] 209 210 subsystem_name = "filemanagement" 211 part_name = "storage_service" 212 install_enable = true 213} 214 215group("storage_daemon_third_party") { 216 deps = [] 217 if (storage_service_fstools) { 218 deps += [ 219 "//third_party/FreeBSD/sbin/fsck_msdosfs:fsck_msdos", 220 "//third_party/FreeBSD/sbin/newfs_msdos:newfs_msdos", 221 "//third_party/e2fsprogs/misc:blkid", 222 "//third_party/exfatprogs:exfatprogs", 223 "//third_party/f2fs-tools:f2fs-tools", 224 "//third_party/gptfdisk:sgdisk", 225 "//third_party/ntfs-3g:ntfsprogs", 226 ] 227 } 228} 229