• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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("//base/update/updater/updater_default_cfg.gni")
15import("//build/ohos.gni")
16
17FLASHD_PATH = "//base/update/updater/services/flashd"
18HDC_PATH = "//developtools/hdc/src"
19
20common_sources = [
21  "${HDC_PATH}/common/async_cmd.cpp",
22  "${HDC_PATH}/common/auth.cpp",
23  "${HDC_PATH}/common/base.cpp",
24  "${HDC_PATH}/common/channel.cpp",
25  "${HDC_PATH}/common/debug.cpp",
26  "${HDC_PATH}/common/file.cpp",
27  "${HDC_PATH}/common/file_descriptor.cpp",
28  "${HDC_PATH}/common/forward.cpp",
29  "${HDC_PATH}/common/session.cpp",
30  "${HDC_PATH}/common/task.cpp",
31  "${HDC_PATH}/common/tcp.cpp",
32  "${HDC_PATH}/common/transfer.cpp",
33  "${HDC_PATH}/common/usb.cpp",
34]
35
36config("flashd_hdc_config") {
37  include_dirs = [ "${FLASHD_PATH}/common" ]
38  cflags_cc = [ "-std=c++17" ]
39}
40
41ohos_source_set("flashd_deamon") {
42  sources = [
43    "${FLASHD_PATH}/daemon/daemon.cpp",
44    "${FLASHD_PATH}/daemon/system_depend.cpp",
45    "${HDC_PATH}/daemon/daemon_app.cpp",
46    "${HDC_PATH}/daemon/daemon_forward.cpp",
47    "${HDC_PATH}/daemon/daemon_tcp.cpp",
48    "${HDC_PATH}/daemon/daemon_unity.cpp",
49    "${HDC_PATH}/daemon/daemon_usb.cpp",
50    "${HDC_PATH}/daemon/jdwp.cpp",
51    "${HDC_PATH}/daemon/shell.cpp",
52  ]
53
54  sources += common_sources
55
56  defines = [ "HARMONY_PROJECT" ]
57
58  configs = [ ":flashd_hdc_config" ]
59
60  external_deps += [ "c_utils:utils" ]
61  deps = [
62    "//third_party/libuv:uv",
63    "//third_party/lz4:liblz4_static",
64    "//third_party/openssl:libcrypto_static",
65  ]
66
67  deps += [ "//developtools/hdc:hdc_hash_gen" ]
68
69  if (use_musl) {
70    external_deps += [ "init:libbegetutil" ]
71  }
72
73  include_dirs = [
74    "${HDC_PATH}/daemon",
75    "${HDC_PATH}/common",
76    "//base/update/updater/services/flashd",
77    "//base/update/updater/services/flashd/daemon",
78    "//base/update/updater/services/flashd/common",
79    "//base/update/updater/services/flashd/host",
80    "//base/update/updater/services/include",
81    "//base/update/updater/services/include/fs_manager",
82    "//base/update/updater/services/include/package",
83    "//base/update/updater/services/include/applypatch",
84    "//base/update/updater/services/include/script",
85    "//base/update/updater/services/include/log",
86    "//base/update/updater/interfaces/kits/include",
87    "//base/update/updater/utils/include",
88    "//base/startup/init/services/include/param",
89    "//base/startup/syspara_lite/interfaces/kits",
90    "//third_party/bounds_checking_function/include",
91    "//third_party/lz4/lib",
92    "//third_party/openssl/include",
93    "//third_party/libuv",
94  ]
95
96  if (build_selinux) {
97    deps += [ "//third_party/selinux:libselinux" ]
98    include_dirs += [ "//third_party/selinux/libselinux/include" ]
99    defines += [ "SURPPORT_SELINUX" ]
100  }
101}
102
103ohos_static_library("libflashd") {
104  sources = [
105    "//base/update/updater/services/flashd/daemon/commander.cpp",
106    "//base/update/updater/services/flashd/daemon/commander_factory.cpp",
107    "//base/update/updater/services/flashd/daemon/daemon_updater.cpp",
108    "//base/update/updater/services/flashd/daemon/erase_commander.cpp",
109    "//base/update/updater/services/flashd/daemon/flash_commander.cpp",
110    "//base/update/updater/services/flashd/daemon/flashd_main.cpp",
111    "//base/update/updater/services/flashd/daemon/flashd_utils.cpp",
112    "//base/update/updater/services/flashd/daemon/format_commander.cpp",
113    "//base/update/updater/services/flashd/daemon/update_commander.cpp",
114    "//base/update/updater/services/flashd/image_writer/image_writer.cpp",
115    "//base/update/updater/services/flashd/partition.cpp",
116    "//base/update/updater/services/hdi/client/update_hdi_client.cpp",
117    "//base/update/updater/services/updater_binary/update_image_block.cpp",
118    "//base/update/updater/services/updater_binary/update_image_patch.cpp",
119    "//base/update/updater/services/updater_binary/update_partitions.cpp",
120    "//base/update/updater/services/updater_binary/update_processor.cpp",
121  ]
122
123  defines = [ "HARMONY_PROJECT" ]
124
125  deps = [
126    ":flashd_deamon",
127    "//base/update/updater/interfaces/kits/misc_info:libmiscinfo",
128    "//base/update/updater/interfaces/kits/slot_info:libslotinfo",
129    "//base/update/updater/interfaces/kits/updaterkits:libupdaterkits",
130    "//base/update/updater/services/applypatch:libapplypatch",
131    "//base/update/updater/services/diffpatch/patch:libpatch",
132    "//base/update/updater/services/fs_manager:libfsmanager",
133    "//base/update/updater/services/hdi/server:libupdate_hdi_impl",
134    "//base/update/updater/services/log:libupdaterlog",
135    "//base/update/updater/services/package:libupdaterpackage",
136    "//base/update/updater/services/script:libupdaterscript",
137    "//base/update/updater/utils:libutils",
138    "//developtools/hdc:hdc_hash_gen",
139    "//third_party/bzip2:libbz2",
140    "//third_party/cJSON:cjson",
141    "//third_party/libuv:uv",
142    "//third_party/lz4:liblz4_static",
143    "//third_party/openssl:libcrypto_static",
144    "//third_party/zlib:libz",
145  ]
146
147  if (defined(binary_custom_lib)) {
148    deps += binary_custom_lib
149  }
150
151  include_dirs = [
152    "${HDC_PATH}/daemon",
153    "${HDC_PATH}/common",
154    "//base/update/updater/services",
155    "//base/update/updater/services/flashd",
156    "//base/update/updater/services/flashd/daemon",
157    "//base/update/updater/services/flashd/common",
158    "//base/update/updater/interfaces/kits/include",
159    "//base/update/updater/services/include/package",
160    "//base/update/updater/services/include/ptable_parse",
161    "//base/update/updater/services/include/script",
162    "//base/update/updater/services/include/log",
163    "//base/update/updater/services/include",
164    "//base/update/updater/services/ptable_parse",
165    "//base/update/updater/utils/include",
166    "//base/update/updater/utils/json",
167    "//base/startup/init/services/include/param",
168    "//drivers/peripheral/partitionslot/hal/include",
169    "//third_party/bounds_checking_function/include",
170    "//third_party/cJSON",
171    "//third_party/openssl/include",
172    "//third_party/lz4/lib",
173    "//third_party/libuv",
174  ]
175
176  if (build_selinux) {
177    deps += [ "//third_party/selinux:libselinux" ]
178    include_dirs += [ "//third_party/selinux/libselinux/include" ]
179    defines += [ "SURPPORT_SELINUX" ]
180  }
181
182  if (defined(use_ptable)) {
183    include_dirs += [ "//base/update/updater/services/ptable_parse" ]
184    deps += [ "//base/update/updater/services/ptable_parse:libptableparse" ]
185    defines += [ "UPDATER_USE_PTABLE" ]
186  }
187
188  external_deps += [
189    "c_utils:utils",
190    "init:libbegetutil",
191  ]
192
193  part_name = "updater"
194  subsystem_name = "updater"
195}
196
197group("updater_flashd") {
198  deps = [ ":libflashd" ]
199}
200