blob: 13f90df8e3158281d0f258cdd68593e9e6728181 [file] [log] [blame]
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001//
2// Copyright (C) 2015 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
Colin Cross606913a2017-11-14 13:05:37 -080017// AIDL interface between libupdate_engine and framework.jar
Bob Badour9b85a6c2021-02-12 21:28:32 -080018package {
19 default_applicable_licenses: ["system_update_engine_license"],
20}
21
22// Added automatically by a large-scale-change
23// See: http://go/android-license-faq
24license {
25 name: "system_update_engine_license",
26 visibility: [":__subpackages__"],
27 license_kinds: [
28 "SPDX-license-identifier-Apache-2.0",
29 ],
30 license_text: [
31 "NOTICE",
32 ],
33}
34
Colin Cross606913a2017-11-14 13:05:37 -080035filegroup {
36 name: "libupdate_engine_aidl",
37 srcs: [
38 "binder_bindings/android/os/IUpdateEngine.aidl",
39 "binder_bindings/android/os/IUpdateEngineCallback.aidl",
40 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -070041 path: "binder_bindings",
42}
43
44cc_defaults {
45 name: "ue_defaults",
46
47 cflags: [
Amin Hassani2e4eda52019-01-07 14:01:17 -080048 "-DBASE_VER=576279",
Dan Willemsenf5a904e2018-10-23 01:02:44 -070049 "-DUSE_HWID_OVERRIDE=0",
Dan Willemsenf5a904e2018-10-23 01:02:44 -070050 "-D_FILE_OFFSET_BITS=64",
51 "-D_POSIX_C_SOURCE=199309L",
52 "-Wa,--noexecstack",
53 "-Wall",
54 "-Werror",
55 "-Wextra",
56 "-Wformat=2",
57 "-Wno-psabi",
58 "-Wno-unused-parameter",
59 "-ffunction-sections",
60 "-fstack-protector-strong",
61 "-fvisibility=hidden",
Kelvin Zhangc5803b72021-09-02 09:06:16 -070062 "-g3",
Dan Willemsenf5a904e2018-10-23 01:02:44 -070063 ],
64 cppflags: [
65 "-Wnon-virtual-dtor",
66 "-fno-strict-aliasing",
67 ],
68 include_dirs: ["system"],
69 local_include_dirs: ["client_library/include"],
Elliott Hughes88f3c8c2021-04-22 13:47:21 -070070 header_libs: ["libgtest_prod_headers"],
Dan Willemsenf5a904e2018-10-23 01:02:44 -070071 shared_libs: [
72 "libbrillo-stream",
73 "libbrillo",
74 "libchrome",
75 ],
76 ldflags: ["-Wl,--gc-sections"],
77
Dan Willemsenf5a904e2018-10-23 01:02:44 -070078 target: {
Sen Jiangb5f631d2018-12-18 16:59:57 -080079 android: {
80 cflags: [
81 "-DUSE_FEC=1",
82 ],
83 },
84 host: {
85 cflags: [
86 "-DUSE_FEC=0",
87 ],
88 },
Dan Willemsenf5a904e2018-10-23 01:02:44 -070089 darwin: {
90 enabled: false,
91 },
92 },
93}
94
Kelvin Zhang9b10dba2020-09-25 17:09:11 -040095// libcow_operation_convert (type: library)
96// ========================================================
Kelvin Zhangeb8703b2020-12-10 14:17:21 -050097cc_library_static {
98 name: "libpayload_extent_utils",
99 defaults: [
100 "ue_defaults",
101 ],
102 host_supported: true,
103 recovery_available: true,
104 srcs: [
105 "payload_generator/extent_utils.cc",
106 ],
107 static_libs: [
108 "update_metadata-protos",
109 ],
110}
111
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400112cc_library {
113 name: "libcow_operation_convert",
114 host_supported: true,
115 recovery_available: true,
116 defaults: [
117 "ue_defaults",
118 "update_metadata-protos_exports",
119 ],
120 srcs: [
121 "common/cow_operation_convert.cc",
122 ],
123 static_libs: [
124 "libsnapshot_cow",
125 "update_metadata-protos",
126 "libpayload_extent_ranges",
Kelvin Zhangeb8703b2020-12-10 14:17:21 -0500127 "libpayload_extent_utils",
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400128 "libbrotli",
129 "libz",
130 ],
131}
132
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700133// update_metadata-protos (type: static_library)
134// ========================================================
135// Protobufs.
136cc_defaults {
137 name: "update_metadata-protos_exports",
138
139 shared_libs: ["libprotobuf-cpp-lite"],
140}
141
Devendra Singhi87484b02022-11-22 14:10:14 +0530142cc_defaults {
143 name: "update_metadata-protos-defaults",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700144 host_supported: true,
Inseob Kim3cce62a2021-06-14 11:55:35 +0900145 ramdisk_available: true,
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700146 recovery_available: true,
147
148 srcs: ["update_engine/update_metadata.proto"],
149 cflags: [
150 "-Wall",
151 "-Werror",
152 ],
153 proto: {
154 canonical_path_from_root: false,
155 export_proto_headers: true,
156 },
157}
158
Devendra Singhi87484b02022-11-22 14:10:14 +0530159cc_library_static {
160 name: "update_metadata-protos",
161 defaults: ["update_metadata-protos-defaults"],
162 proto: {
163 type: "lite",
164 },
165}
166
167cc_library_static {
168 name: "update_metadata-protos-full",
169 defaults: ["update_metadata-protos-defaults"],
170}
171
Kelvin Zhang73202a92022-06-02 10:19:54 -0700172python_library_host {
173 name: "update_metadata-protos-python",
174 srcs: ["update_metadata.proto"],
175 proto: {
176 canonical_path_from_root: false,
177 },
178}
179
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700180// libpayload_consumer (type: static_library)
181// ========================================================
182// The payload application component and common dependencies.
183cc_defaults {
Devendra Singhi87484b02022-11-22 14:10:14 +0530184 name: "libpayload_consumer_exports_defaults",
185 defaults: ["update_metadata-protos_exports",],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700186
187 static_libs: [
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700188 "libxz",
189 "libbz",
190 "libbspatch",
191 "libbrotli",
192 "libfec_rs",
193 "libpuffpatch",
194 "libverity_tree",
Kelvin Zhang94f51cc2020-09-25 11:34:49 -0400195 "libsnapshot_cow",
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400196 "libbrotli",
197 "libz",
198 "libpayload_extent_ranges",
Kelvin Zhangeb8703b2020-12-10 14:17:21 -0500199 "libpayload_extent_utils",
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400200 "libcow_operation_convert",
Kelvin Zhang55624032021-12-20 12:13:24 -0800201 "lz4diff-protos",
Kelvin Zhang4eae81e2021-12-09 17:07:17 -0800202 "liblz4patch",
Kelvin Zhang27757a22023-02-15 16:58:27 -0800203 "libzstd",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700204 ],
205 shared_libs: [
206 "libbase",
207 "libcrypto",
Sen Jiangb5f631d2018-12-18 16:59:57 -0800208 "libfec",
Kelvin Zhang4eae81e2021-12-09 17:07:17 -0800209 "liblz4",
Tianjie99d570d2020-06-04 14:57:19 -0700210 "libziparchive",
Gabriele M3f1d6692018-06-14 01:10:09 +0200211 "libprocessgroup",
Luca Stefani4be6d112019-01-03 21:20:42 +0100212 "libselinux",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700213 ],
Luca Stefanid2ae8952020-03-13 11:32:29 +0100214 product_variables: {
215 debuggable: {
216 cflags: [
217 "-DRUN_BACKUPTOOL",
218 ],
219 },
220 },
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700221}
222
Devendra Singhi87484b02022-11-22 14:10:14 +0530223cc_defaults {
224 name: "libpayload_consumer_exports",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700225 defaults: [
Devendra Singhi87484b02022-11-22 14:10:14 +0530226 "libpayload_consumer_exports_defaults"
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700227 ],
Devendra Singhi87484b02022-11-22 14:10:14 +0530228 static_libs: ["update_metadata-protos",],
229}
230
231cc_defaults {
232 name: "libpayload_consumer_exports_proto-full",
233 defaults: [
234 "libpayload_consumer_exports_defaults"
235 ],
236 static_libs: ["update_metadata-protos-full",],
237}
238
239cc_defaults {
240 name: "libpayload_consumer_defaults",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700241 host_supported: true,
242 recovery_available: true,
243
244 srcs: [
Amin Hassaniec7bc112020-10-29 16:47:58 -0700245 "aosp/platform_constants_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700246 "common/action_processor.cc",
247 "common/boot_control_stub.cc",
248 "common/clock.cc",
249 "common/constants.cc",
250 "common/cpu_limiter.cc",
Yifan Hongdaac7322019-11-07 10:48:26 -0800251 "common/dynamic_partition_control_stub.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700252 "common/error_code_utils.cc",
253 "common/file_fetcher.cc",
254 "common/hash_calculator.cc",
255 "common/http_common.cc",
256 "common/http_fetcher.cc",
257 "common/hwid_override.cc",
258 "common/multi_range_http_fetcher.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700259 "common/prefs.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700260 "common/subprocess.cc",
261 "common/terminator.cc",
262 "common/utils.cc",
263 "payload_consumer/bzip_extent_writer.cc",
264 "payload_consumer/cached_file_descriptor.cc",
Tianjie Xu7a78d632019-10-08 16:32:39 -0700265 "payload_consumer/certificate_parser_android.cc",
Kelvin Zhang569c97e2020-10-26 12:12:24 -0400266 "payload_consumer/cow_writer_file_descriptor.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700267 "payload_consumer/delta_performer.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700268 "payload_consumer/extent_reader.cc",
269 "payload_consumer/extent_writer.cc",
270 "payload_consumer/file_descriptor.cc",
271 "payload_consumer/file_descriptor_utils.cc",
272 "payload_consumer/file_writer.cc",
273 "payload_consumer/filesystem_verifier_action.cc",
Kelvin Zhang40d96662021-02-24 14:21:29 -0500274 "payload_consumer/install_operation_executor.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700275 "payload_consumer/install_plan.cc",
276 "payload_consumer/mount_history.cc",
277 "payload_consumer/payload_constants.cc",
278 "payload_consumer/payload_metadata.cc",
279 "payload_consumer/payload_verifier.cc",
Kelvin Zhang50bac652020-09-28 15:51:41 -0400280 "payload_consumer/partition_writer.cc",
Kelvin Zhang94f51cc2020-09-25 11:34:49 -0400281 "payload_consumer/partition_writer_factory_android.cc",
282 "payload_consumer/vabc_partition_writer.cc",
Kelvin Zhang4bb49202021-07-08 21:39:05 -0400283 "payload_consumer/xor_extent_writer.cc",
Kelvin Zhangb1706762021-06-25 15:05:22 -0400284 "payload_consumer/block_extent_writer.cc",
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400285 "payload_consumer/snapshot_extent_writer.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700286 "payload_consumer/postinstall_runner_action.cc",
Kelvin Zhangab3ce602021-02-24 14:46:40 -0500287 "payload_consumer/verified_source_fd.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700288 "payload_consumer/verity_writer_android.cc",
289 "payload_consumer/xz_extent_writer.cc",
290 "payload_consumer/fec_file_descriptor.cc",
Tianjied3865d12020-06-03 15:25:17 -0700291 "payload_consumer/partition_update_generator_android.cc",
Kelvin Zhangc5803b72021-09-02 09:06:16 -0700292 "update_status_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700293 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700294}
295
Vova Sharaienkod62c81b2022-09-21 05:32:43 +0000296cc_library_static {
Devendra Singhi87484b02022-11-22 14:10:14 +0530297 name: "libpayload_consumer",
298 defaults: [
299 "ue_defaults",
300 "libpayload_consumer_exports",
301 "libpayload_consumer_defaults",
302 ],
303}
304
305cc_library_static {
306 name: "libpayload_consumer_proto-full",
307 defaults: [
308 "ue_defaults",
309 "libpayload_consumer_exports_proto-full",
310 "libpayload_consumer_defaults",
311 ],
312}
313
314cc_library_static {
Vova Sharaienkod62c81b2022-09-21 05:32:43 +0000315 name: "libstatslog_ue",
316 generated_sources: ["statslog_ue.cpp"],
317 generated_headers: ["statslog_ue.h"],
318 export_generated_headers: ["statslog_ue.h"],
319 shared_libs: [
320 "libstatssocket",
321 ]
322}
323
324genrule {
325 name: "statslog_ue.h",
326 tools: ["stats-log-api-gen"],
327 cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_ue.h --module update_engine --namespace chromeos_update_engine,statsd",
328 out: [
329 "statslog_ue.h",
330 ],
331}
332
333genrule {
334 name: "statslog_ue.cpp",
335 tools: ["stats-log-api-gen"],
336 cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_ue.cpp --module update_engine --namespace chromeos_update_engine,statsd --importHeader statslog_ue.h",
337 out: [
338 "statslog_ue.cpp",
339 ],
340}
341
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700342// libupdate_engine_boot_control (type: static_library)
343// ========================================================
344// A BootControl class implementation using Android's HIDL boot_control HAL.
345cc_defaults {
Devendra Singhi87484b02022-11-22 14:10:14 +0530346 name: "libupdate_engine_boot_control_exports_defaults",
347 defaults: ["update_metadata-protos_exports",],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700348
Yifan Hong420db9b2019-07-23 20:50:33 -0700349 static_libs: [
David Andersone7ce8212019-12-16 20:13:19 -0800350 "libcutils",
351 "libfs_mgr_binder",
352 "libgsi",
David Anderson8f2f5292023-08-03 12:28:38 -0700353 "libsnapshot_static",
Vova Sharaienkod62c81b2022-09-21 05:32:43 +0000354 "libstatslog_ue",
David Anderson6c190a22020-09-21 17:09:53 -0700355 "libz",
Yifan Hong420db9b2019-07-23 20:50:33 -0700356 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700357 shared_libs: [
358 "libbootloader_message",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700359 "libhidlbase",
360 "liblp",
361 "libutils",
362 "android.hardware.boot@1.0",
David Anderson2111d062019-10-15 22:36:27 -0700363 "android.hardware.boot@1.1",
Kelvin Zhangcb419e62021-06-16 13:56:47 -0400364 "android.hardware.boot@1.2",
Kelvin Zhang8251dc02022-06-14 09:46:46 -0700365 "android.hardware.boot-V1-ndk",
Kelvin Zhange9c1d372022-06-13 15:40:44 -0700366 "libboot_control_client",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700367 ],
Yifan Hong29692902020-03-26 12:47:05 -0700368 header_libs: [
369 "avb_headers",
370 ],
Yifan Hong420db9b2019-07-23 20:50:33 -0700371 target: {
372 recovery: {
David Andersone7ce8212019-12-16 20:13:19 -0800373 static_libs: [
374 "libfs_mgr",
375 "libsnapshot_nobinder",
376 ],
377 exclude_static_libs: [
378 "libfs_mgr_binder",
David Anderson8f2f5292023-08-03 12:28:38 -0700379 "libsnapshot_static",
Vova Sharaienkod62c81b2022-09-21 05:32:43 +0000380 "libstatslog_ue"
Yifan Hong212d7952020-02-04 11:08:08 -0800381 ],
Yifan Hong420db9b2019-07-23 20:50:33 -0700382 },
383 },
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700384}
385
Devendra Singhi87484b02022-11-22 14:10:14 +0530386cc_defaults {
387 name: "libupdate_engine_boot_control_exports",
388 defaults: [
389 "libupdate_engine_boot_control_exports_defaults",
390 ],
391 static_libs: [
392 "libpayload_consumer",
393 "update_metadata-protos",
394 ]
395}
396
397cc_defaults {
398 name: "libupdate_engine_boot_control_exports_proto-full",
399 defaults: [
400 "libupdate_engine_boot_control_exports_defaults",
401 ],
402 static_libs: [
403 "libpayload_consumer_proto-full",
404 "update_metadata-protos-full",
405 ]
406}
407
408cc_defaults {
409 name: "libupdate_engine_boot_control_defaults",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700410 defaults: [
411 "ue_defaults",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700412 ],
413 recovery_available: true,
414
415 srcs: [
Amin Hassaniec7bc112020-10-29 16:47:58 -0700416 "aosp/boot_control_android.cc",
417 "aosp/cleanup_previous_update_action.cc",
418 "aosp/dynamic_partition_control_android.cc",
419 "aosp/dynamic_partition_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700420 ],
421}
422
Devendra Singhi87484b02022-11-22 14:10:14 +0530423cc_library_static {
424 name: "libupdate_engine_boot_control",
425 defaults: [
426 "libupdate_engine_boot_control_defaults",
427 "libupdate_engine_boot_control_exports",
428 "libpayload_consumer_exports",
429 ],
430}
431
432cc_library_static {
Nikita Putikhine788f952024-03-11 19:21:24 +0100433 name: "libupdate_engine_boot_control_nostats",
434 cflags: ["-DUE_DISABLE_STATS"],
435 defaults: [
436 "libupdate_engine_boot_control_defaults",
437 "libupdate_engine_boot_control_exports",
438 "libpayload_consumer_exports",
439 ],
440}
441
442cc_library_static {
Devendra Singhi87484b02022-11-22 14:10:14 +0530443 name: "libupdate_engine_boot_control_proto-full",
444 defaults: [
445 "libupdate_engine_boot_control_defaults",
446 "libupdate_engine_boot_control_exports_proto-full",
447 "libpayload_consumer_exports_proto-full",
448 ],
449}
450
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700451// libupdate_engine_android (type: static_library)
452// ========================================================
453// The main daemon static_library used in Android (non-Brillo). This only has a
454// loop to apply payloads provided by the upper layer via a Binder interface.
455cc_defaults {
Devendra Singhi87484b02022-11-22 14:10:14 +0530456 name: "libupdate_engine_android_exports_defaults",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700457 defaults: [
458 "ue_defaults",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700459 ],
460
461 static_libs: [
Tianjie838793d2021-01-14 22:05:13 -0800462 "libavb",
463 "libavb_user",
Trevor Radcliffee877eac2022-06-08 14:10:21 +0000464 "libgkiprops",
Vova Sharaienkod62c81b2022-09-21 05:32:43 +0000465 "libstatslog_ue",
Trevor Radcliffee877eac2022-06-08 14:10:21 +0000466 "libPlatformProperties",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700467 ],
468 shared_libs: [
Mohammad Samiul Islam24a82792021-02-12 16:52:36 +0000469 "apex_aidl_interface-cpp",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700470 "libandroid_net",
471 "libbase",
472 "libbinder",
473 "libbinderwrapper",
474 "libbootloader_message",
475 "libbrillo-binder",
476 "libcurl",
477 "libcutils",
Pawan Wagh39fe9822024-01-03 17:03:16 +0000478 "libupdate_engine_stable-V2-cpp",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700479 "liblog",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700480 "libssl",
Vova Sharaienkod62c81b2022-09-21 05:32:43 +0000481 "libstatssocket",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700482 "libutils",
483 ],
Nikita Ioffeaedfef32021-04-28 13:54:14 +0100484 whole_static_libs: [
Trevor Radcliffee877eac2022-06-08 14:10:21 +0000485 "libcom.android.sysprop.apex",
Nikita Ioffeaedfef32021-04-28 13:54:14 +0100486 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700487}
488
Devendra Singhi87484b02022-11-22 14:10:14 +0530489cc_defaults {
490 name: "libupdate_engine_android_exports",
491 defaults: [
492 "libupdate_engine_android_exports_defaults",
493 "libupdate_engine_boot_control_exports",
494 "libpayload_consumer_exports",
495 ],
496 static_libs: [
497 "libpayload_consumer",
498 "libupdate_engine_boot_control",
499 ],
500}
501
502cc_defaults {
503 name: "libupdate_engine_android_exports_proto-full",
504 defaults: [
505 "libupdate_engine_android_exports_defaults",
506 "libupdate_engine_boot_control_exports_proto-full",
507 "libpayload_consumer_exports_proto-full",
508 ],
509 static_libs: [
510 "libpayload_consumer_proto-full",
511 "libupdate_engine_boot_control_proto-full",
512 ],
513}
514
515cc_defaults {
516 name: "libupdate_engine_android_defaults",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700517 defaults: [
518 "ue_defaults",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700519 ],
520
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700521 aidl: {
522 local_include_dirs: ["binder_bindings"],
523 export_aidl_headers: true,
524 },
525
526 srcs: [
527 ":libupdate_engine_aidl",
Amin Hassani538bd592020-11-04 20:46:08 -0800528 "common/system_state.cc",
Mohammad Samiul Islam24a82792021-02-12 16:52:36 +0000529 "aosp/apex_handler_android.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700530 "aosp/binder_service_android.cc",
531 "aosp/binder_service_stable_android.cc",
532 "aosp/daemon_android.cc",
533 "aosp/daemon_state_android.cc",
534 "aosp/hardware_android.cc",
535 "aosp/logging_android.cc",
536 "aosp/network_selector_android.cc",
537 "aosp/update_attempter_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700538 "certificate_checker.cc",
Amin Hassani538bd592020-11-04 20:46:08 -0800539 "download_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700540 "libcurl_http_fetcher.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700541 "metrics_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700542 "update_boot_flags_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700543 ],
544}
545
Devendra Singhi87484b02022-11-22 14:10:14 +0530546cc_library_static {
547 name: "libupdate_engine_android",
548 defaults: [
549 "libupdate_engine_android_defaults",
550 "libupdate_engine_android_exports",
551 ]
552}
553
554cc_library_static {
555 name: "libupdate_engine_android_proto-full",
556 defaults: [
557 "libupdate_engine_android_defaults",
558 "libupdate_engine_android_exports_proto-full",
559 ]
560}
561
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700562// update_engine (type: executable)
563// ========================================================
564// update_engine daemon.
565cc_binary {
566 name: "update_engine",
567 defaults: [
568 "ue_defaults",
569 "libupdate_engine_android_exports",
570 ],
571
Kelvin Zhang77cb1c62023-03-31 20:34:52 -0700572 static_libs: [
573 "libupdate_engine_android",
574 "libgflags",
575 ],
Tao Bao1e1c86c2019-04-18 10:48:32 -0700576 required: [
Darren Krahn03c7be52023-11-30 15:40:12 -0800577 "cacerts",
Tianjie Xube4ea232019-10-15 18:08:31 -0700578 "otacerts",
Tao Bao1e1c86c2019-04-18 10:48:32 -0700579 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700580
Amin Hassaniec7bc112020-10-29 16:47:58 -0700581 srcs: ["main.cc", "aosp/metrics_reporter_android.cc"],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700582 init_rc: ["update_engine.rc"],
583}
584
Nikita Putikhine788f952024-03-11 19:21:24 +0100585// update_engine_nostats (type: executable)
586// ========================================================
587// update_engine daemon version without the stats integration.
588cc_binary {
589 name: "update_engine_nostats",
590 defaults: [
591 "ue_defaults",
592 "libupdate_engine_android_exports",
593 ],
594
595 static_libs: [
596 "libupdate_engine_android",
597 "libgflags",
598 "libupdate_engine_boot_control_nostats",
599 ],
600 required: [
601 "cacerts",
602 "otacerts",
603 ],
604
605 exclude_static_libs: [
606 "libstatslog_ue",
607 "libupdate_engine_boot_control"
608 ],
609
610 exclude_shared_libs: [
611 "libstatssocket",
612 ],
613
614 cflags: ["-DUE_DISABLE_STATS"],
615 srcs: [
616 "main.cc",
617 "common/metrics_reporter_stub.cc",
618 ],
619 init_rc: ["update_engine_nostats.rc"],
620}
621
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700622// update_engine_sideload (type: executable)
623// ========================================================
624// A binary executable equivalent to update_engine daemon that installs an update
625// from a local file directly instead of running in the background. Used in
626// recovery image.
627cc_binary {
628 name: "update_engine_sideload",
629 defaults: [
630 "ue_defaults",
631 "update_metadata-protos_exports",
632 "libupdate_engine_boot_control_exports",
633 "libpayload_consumer_exports",
634 ],
635 recovery: true,
636
Nikita Putikhine788f952024-03-11 19:21:24 +0100637 cflags: [
638 "-D_UE_SIDELOAD",
639 "-DUE_DISABLE_STATS",
640 ],
Elliott Hughes88f3c8c2021-04-22 13:47:21 -0700641 header_libs: ["libgtest_prod_headers"],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700642
643 srcs: [
Amin Hassaniec7bc112020-10-29 16:47:58 -0700644 "aosp/hardware_android.cc",
645 "aosp/logging_android.cc",
646 "aosp/sideload_main.cc",
647 "aosp/update_attempter_android.cc",
648 "common/metrics_reporter_stub.cc",
649 "common/network_selector_stub.cc",
Amin Hassani538bd592020-11-04 20:46:08 -0800650 "common/system_state.cc",
651 "download_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700652 "metrics_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700653 "update_boot_flags_action.cc",
654 "update_status_utils.cc",
655 ],
656
657 // Use commonly used shared libraries. libprotobuf-cpp-lite.so is filtered out,
658 // as it doesn't look beneficial to be installed separately due to its size. Note
659 // that we explicitly request their recovery variants, so that the expected files
660 // will be used and installed.
661 shared_libs: [
662 "libbase",
663 "liblog",
Kelvin Zhang4eae81e2021-12-09 17:07:17 -0800664 "liblz4",
Kelvin Zhang0dfaf402023-10-31 17:26:58 -0700665 "libprotobuf-cpp-lite",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700666 ],
667 static_libs: [
668 "libpayload_consumer",
669 "libupdate_engine_boot_control",
670 "update_metadata-protos",
671
672 // We add the static versions of the shared libraries that are not installed to
673 // recovery image due to size concerns. Need to include all the static library
674 // dependencies of these static libraries.
Trevor Radcliffee877eac2022-06-08 14:10:21 +0000675 "libgkiprops",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700676 "libevent",
677 "libmodpb64",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700678 "libbrillo-stream",
679 "libbrillo",
680 "libchrome",
681 ],
682 target: {
683 recovery: {
684 exclude_shared_libs: [
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700685 "libbrillo-stream",
686 "libbrillo",
687 "libchrome",
688 ],
689 },
690 },
691
Tao Bao1e1c86c2019-04-18 10:48:32 -0700692 required: [
Tianjie Xube4ea232019-10-15 18:08:31 -0700693 "otacerts.recovery",
Tao Bao1e1c86c2019-04-18 10:48:32 -0700694 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700695}
696
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700697// update_engine_client (type: executable)
698// ========================================================
699// update_engine console client.
700cc_binary {
701 name: "update_engine_client",
702 defaults: ["ue_defaults"],
703
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700704 shared_libs: [
705 "libbinder",
706 "libbinderwrapper",
707 "libbrillo-binder",
708 "libutils",
709 ],
710
711 aidl: {
712 local_include_dirs: ["binder_bindings"],
713 },
714
715 srcs: [
716 ":libupdate_engine_aidl",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700717 "aosp/update_engine_client_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700718 "common/error_code_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700719 "update_status_utils.cc",
720 ],
721}
722
723// libpayload_generator (type: static_library)
724// ========================================================
725// server-side code. This is used for delta_generator and unittests but not
726// for any client code.
727cc_defaults {
728 name: "libpayload_generator_exports",
729 defaults: [
730 "libpayload_consumer_exports",
731 "update_metadata-protos_exports",
Kelvin Zhang446989a2021-12-08 13:49:07 -0800732 "erofs-utils_export_defaults",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700733 ],
734
Tianjie37ae8562020-03-25 15:16:01 -0700735 header_libs: [
736 "bootimg_headers",
737 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700738 static_libs: [
739 "libavb",
740 "libbrotli",
741 "libbsdiff",
742 "libdivsufsort",
743 "libdivsufsort64",
744 "liblzma",
745 "libpayload_consumer",
746 "libpuffdiff",
Tianjiea69cfe22021-08-22 23:28:44 -0700747 "libzucchini",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700748 "libverity_tree",
749 "update_metadata-protos",
Kelvin Zhangeb8703b2020-12-10 14:17:21 -0500750 "libpayload_extent_utils",
Kelvin Zhangb93055f2021-02-03 14:22:35 -0500751 "libcow_size_estimator",
Kelvin Zhang446989a2021-12-08 13:49:07 -0800752 "liberofs",
Kelvin Zhang702ce4c2022-07-14 10:43:22 -0700753 "libselinux",
Kelvin Zhang446989a2021-12-08 13:49:07 -0800754 "lz4diff-protos",
Kelvin Zhang4eae81e2021-12-09 17:07:17 -0800755 "liblz4diff",
Kelvin Zhang27757a22023-02-15 16:58:27 -0800756 "libzstd",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700757 ],
758 shared_libs: [
759 "libbase",
760 "libext2fs",
Kelvin Zhang446989a2021-12-08 13:49:07 -0800761 // LZ4 has to be a shared lib, as we want to override it with
762 // LD_LIBRARY_PRELOAD later
763 "liblz4",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700764 ],
765}
766
767cc_library_static {
David Andersonc1c93052020-08-26 18:22:09 +0000768 name: "libpayload_extent_ranges",
769 defaults: [
770 "ue_defaults",
771 ],
772 host_supported: true,
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400773 recovery_available: true,
David Andersonc1c93052020-08-26 18:22:09 +0000774 srcs: [
775 "payload_generator/extent_ranges.cc",
776 ],
777 static_libs: [
778 "update_metadata-protos",
779 ],
780}
781
782cc_library_static {
Kelvin Zhangb93055f2021-02-03 14:22:35 -0500783 name: "libcow_size_estimator",
784 defaults: [
785 "ue_defaults",
786 "update_metadata-protos_exports"
787 ],
788 host_supported: true,
789 recovery_available: true,
790 srcs: [
791 "payload_generator/cow_size_estimator.cc",
792 ],
793 static_libs: [
794 "update_metadata-protos",
795 "libbase",
796 "libsnapshot_cow",
797 "libcow_operation_convert",
798 ],
799}
800
Kelvin Zhang4eae81e2021-12-09 17:07:17 -0800801cc_defaults {
802 name: "liblz4diff_defaults",
803 static_libs: [
804 "lz4diff-protos",
805 "update_metadata-protos",
806 "libssl",
807 "libbsdiff",
808 "libpuffdiff",
809 ],
810 shared_libs: [
811 "liblz4",
Kelvin Zhang893b3a12021-12-30 12:28:53 -0800812 ],
Kelvin Zhang4eae81e2021-12-09 17:07:17 -0800813}
814
815cc_library_static {
816 name: "liblz4diff",
817 host_supported: true,
818 defaults: ["ue_defaults", "liblz4diff_defaults"],
819 srcs: [
Kelvin Zhang893b3a12021-12-30 12:28:53 -0800820 "lz4diff/lz4diff.cc",
Kelvin Zhang4eae81e2021-12-09 17:07:17 -0800821 "lz4diff/lz4diff_compress.cc",
822 ],
823}
824
825cc_library_static {
826 name: "liblz4patch",
827 host_supported: true,
828 recovery_available: true,
829 defaults: ["ue_defaults"],
830 static_libs: [
831 "lz4diff-protos",
832 "update_metadata-protos",
833 "libssl",
834 "libbspatch",
835 "libpuffpatch",
836 ],
837 shared_libs: [
838 "liblz4",
839 ],
840 srcs: [
841 "lz4diff/lz4patch.cc",
842 "lz4diff/lz4diff_compress.cc",
843 ],
844}
845
Kelvin Zhang35cff4f2021-12-08 16:06:00 -0800846cc_binary_host {
847 name: "lz4diff",
848 defaults: [
849 "ue_defaults",
850 "libpayload_generator_exports",
851 ],
852 static_libs: [
853 "libpayload_generator",
854 "liblz4diff",
855 "liblz4patch",
856 ],
857 srcs: [
858 "lz4diff/lz4diff_main.cc",
859 ],
860}
861
Kelvin Zhangb93055f2021-02-03 14:22:35 -0500862cc_library_static {
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700863 name: "libpayload_generator",
864 defaults: [
865 "ue_defaults",
866 "libpayload_generator_exports",
867 ],
868 host_supported: true,
869
870 srcs: [
Amin Hassani538bd592020-11-04 20:46:08 -0800871 "common/system_state.cc",
872 "download_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700873 "payload_generator/ab_generator.cc",
874 "payload_generator/annotated_operation.cc",
875 "payload_generator/blob_file_writer.cc",
876 "payload_generator/block_mapping.cc",
877 "payload_generator/boot_img_filesystem.cc",
878 "payload_generator/bzip.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700879 "payload_generator/deflate_utils.cc",
880 "payload_generator/delta_diff_generator.cc",
881 "payload_generator/delta_diff_utils.cc",
882 "payload_generator/ext2_filesystem.cc",
Kelvin Zhang446989a2021-12-08 13:49:07 -0800883 "payload_generator/erofs_filesystem.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700884 "payload_generator/extent_ranges.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700885 "payload_generator/full_update_generator.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700886 "payload_generator/mapfile_filesystem.cc",
Tianjiee9156ec2020-08-11 11:13:54 -0700887 "payload_generator/merge_sequence_generator.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700888 "payload_generator/payload_file.cc",
889 "payload_generator/payload_generation_config_android.cc",
890 "payload_generator/payload_generation_config.cc",
Amin Hassani79821002019-05-06 17:40:49 -0700891 "payload_generator/payload_properties.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700892 "payload_generator/payload_signer.cc",
893 "payload_generator/raw_filesystem.cc",
894 "payload_generator/squashfs_filesystem.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700895 "payload_generator/xz_android.cc",
896 ],
897}
898
899// delta_generator (type: executable)
900// ========================================================
901// server-side delta generator.
902cc_binary_host {
903 name: "delta_generator",
904 defaults: [
905 "ue_defaults",
906 "libpayload_generator_exports",
907 "libpayload_consumer_exports",
908 ],
909
910 static_libs: [
911 "libavb_host_sysdeps",
912 "libpayload_consumer",
913 "libpayload_generator",
Kelvin Zhang77cb1c62023-03-31 20:34:52 -0700914 "libgflags",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700915 ],
916
917 srcs: ["payload_generator/generate_delta_main.cc"],
918}
919
920cc_test {
Kelvin Zhangc5803b72021-09-02 09:06:16 -0700921 host_supported: true,
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700922 name: "ue_unittest_delta_generator",
923 defaults: [
924 "ue_defaults",
925 "libpayload_generator_exports",
926 "libpayload_consumer_exports",
927 ],
928
929 static_libs: [
930 "libpayload_consumer",
931 "libpayload_generator",
Kelvin Zhang77cb1c62023-03-31 20:34:52 -0700932 "libgflags",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700933 ],
934
935 srcs: ["payload_generator/generate_delta_main.cc"],
936
937 gtest: false,
938 stem: "delta_generator",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700939}
940
941// test_http_server (type: executable)
942// ========================================================
943// Test HTTP Server.
944cc_test {
945 name: "test_http_server",
946 defaults: ["ue_defaults"],
947 srcs: [
948 "common/http_common.cc",
949 "test_http_server.cc",
950 ],
951
952 gtest: false,
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700953}
954
955// test_subprocess (type: executable)
956// ========================================================
957// Test helper subprocess program.
958cc_test {
959 name: "test_subprocess",
960 defaults: ["ue_defaults"],
961 srcs: ["test_subprocess.cc"],
962
963 gtest: false,
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700964}
965
966// Public keys for unittests.
967// ========================================================
968genrule {
969 name: "ue_unittest_keys",
970 cmd: "openssl rsa -in $(location unittest_key.pem) -pubout -out $(location unittest_key.pub.pem) &&" +
xunchangcda3c032019-03-26 15:41:14 -0700971 "openssl rsa -in $(location unittest_key2.pem) -pubout -out $(location unittest_key2.pub.pem) &&" +
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700972 "openssl rsa -in $(location unittest_key_RSA4096.pem) -pubout -out $(location unittest_key_RSA4096.pub.pem) &&" +
973 "openssl pkey -in $(location unittest_key_EC.pem) -pubout -out $(location unittest_key_EC.pub.pem)",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700974 srcs: [
975 "unittest_key.pem",
976 "unittest_key2.pem",
xunchangcda3c032019-03-26 15:41:14 -0700977 "unittest_key_RSA4096.pem",
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700978 "unittest_key_EC.pem",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700979 ],
980 out: [
981 "unittest_key.pub.pem",
982 "unittest_key2.pub.pem",
xunchangcda3c032019-03-26 15:41:14 -0700983 "unittest_key_RSA4096.pub.pem",
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700984 "unittest_key_EC.pub.pem",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700985 ],
986}
987
988// Sample images for unittests.
989// ========================================================
990// Extract sample image from the compressed sample_images.tar.bz2 file used by
991// the unittests.
992genrule {
993 name: "ue_unittest_disk_imgs",
994 cmd: "tar -jxf $(in) -C $(genDir)/gen disk_ext2_1k.img disk_ext2_4k.img disk_ext2_4k_empty.img disk_ext2_unittest.img",
995 srcs: ["sample_images/sample_images.tar.bz2"],
996 out: [
997 "gen/disk_ext2_1k.img",
998 "gen/disk_ext2_4k.img",
999 "gen/disk_ext2_4k_empty.img",
1000 "gen/disk_ext2_unittest.img",
1001 ],
1002}
1003
Kelvin Zhang759e8b92021-12-21 16:46:58 -08001004genrule {
1005 name: "ue_unittest_erofs_imgs",
Kelvin Zhang893b3a12021-12-30 12:28:53 -08001006 cmd: "$(in) $(location mkfs.erofs) $(location gen/erofs_empty.img) && " +
1007 "$(in) $(location mkfs.erofs) $(location gen/erofs.img) $(location delta_generator) && " +
1008 "$(in) $(location mkfs.erofs) $(location gen/erofs_new.img) $(location delta_generator) lz4hc,7",
Kelvin Zhang759e8b92021-12-21 16:46:58 -08001009 srcs: ["sample_images/generate_test_erofs_images.sh"],
1010 out: [
1011 "gen/erofs.img",
Kelvin Zhang893b3a12021-12-30 12:28:53 -08001012 "gen/erofs_new.img",
Kelvin Zhang759e8b92021-12-21 16:46:58 -08001013 "gen/erofs_empty.img",
1014 ],
1015 tools: [
1016 "mkfs.erofs",
1017 "delta_generator",
1018 ],
1019}
1020
Kelvin Zhangc5803b72021-09-02 09:06:16 -07001021filegroup {
Chih-Hung Hsieh85ad1472022-02-17 17:32:12 -08001022 name: "update_engine_host_unittest_timeout_srcs",
1023 srcs: [
1024 "common/action_processor_unittest.cc",
1025 "common/file_fetcher_unittest.cc",
1026 "payload_generator/delta_diff_utils_unittest.cc",
1027 ],
1028}
1029
1030filegroup {
Kelvin Zhangc5803b72021-09-02 09:06:16 -07001031 name: "update_engine_host_unittest_srcs",
1032 srcs: [
1033 "common/action_pipe_unittest.cc",
1034 "common/action_processor_unittest.cc",
1035 "common/action_unittest.cc",
1036 "common/cow_operation_convert_unittest.cc",
1037 "common/cpu_limiter_unittest.cc",
1038 "common/fake_prefs.cc",
1039 "common/file_fetcher_unittest.cc",
1040 "common/hash_calculator_unittest.cc",
1041 "common/hwid_override_unittest.cc",
1042 "common/metrics_reporter_stub.cc",
1043 "common/mock_http_fetcher.cc",
1044 "common/prefs_unittest.cc",
1045 "common/terminator_unittest.cc",
1046 "common/test_utils.cc",
Kelvin Zhang55624032021-12-20 12:13:24 -08001047 "lz4diff/lz4diff_compress_unittest.cc",
Kelvin Zhang893b3a12021-12-30 12:28:53 -08001048 "lz4diff/lz4diff_unittest.cc",
Kelvin Zhangc5803b72021-09-02 09:06:16 -07001049 "payload_generator/ab_generator_unittest.cc",
1050 "payload_generator/blob_file_writer_unittest.cc",
1051 "payload_generator/block_mapping_unittest.cc",
1052 "payload_generator/boot_img_filesystem_unittest.cc",
1053 "payload_generator/deflate_utils_unittest.cc",
1054 "payload_generator/delta_diff_utils_unittest.cc",
Kelvin Zhang759e8b92021-12-21 16:46:58 -08001055 "payload_generator/erofs_filesystem_unittest.cc",
Kelvin Zhangc5803b72021-09-02 09:06:16 -07001056 "payload_generator/ext2_filesystem_unittest.cc",
1057 "payload_generator/extent_ranges_unittest.cc",
1058 "payload_generator/extent_utils_unittest.cc",
1059 "payload_generator/fake_filesystem.cc",
1060 "payload_generator/full_update_generator_unittest.cc",
1061 "payload_generator/mapfile_filesystem_unittest.cc",
1062 "payload_generator/merge_sequence_generator_unittest.cc",
1063 "payload_generator/payload_file_unittest.cc",
1064 "payload_generator/payload_generation_config_android_unittest.cc",
1065 "payload_generator/payload_generation_config_unittest.cc",
1066 "payload_generator/payload_properties_unittest.cc",
1067 "payload_generator/payload_signer_unittest.cc",
1068 "payload_generator/squashfs_filesystem_unittest.cc",
1069 "payload_generator/zip_unittest.cc",
Kelvin Zhange4bffe62022-03-07 09:08:38 -08001070 "payload_consumer/verity_writer_android_unittest.cc",
1071 "payload_consumer/xz_extent_writer_unittest.cc",
Kelvin Zhangc5803b72021-09-02 09:06:16 -07001072 "testrunner.cc",
1073 ],
1074}
1075
1076cc_test_host {
1077 name: "update_engine_host_unittests",
1078 defaults: [
1079 "ue_defaults",
1080 "libpayload_generator_exports",
1081 ],
1082 strip: {
1083 none: true,
1084 },
1085 cflags: [
1086 "-g3",
1087 ],
Chih-Hung Hsieh85ad1472022-02-17 17:32:12 -08001088 tidy_timeout_srcs: [":update_engine_host_unittest_timeout_srcs"],
Kelvin Zhangc5803b72021-09-02 09:06:16 -07001089 srcs: [":update_engine_host_unittest_srcs"],
1090 data: [
1091 ":ue_unittest_delta_generator",
1092 ":ue_unittest_disk_imgs",
Kelvin Zhang759e8b92021-12-21 16:46:58 -08001093 ":ue_unittest_erofs_imgs",
Kelvin Zhangc5803b72021-09-02 09:06:16 -07001094 ":ue_unittest_keys",
1095 "otacerts.zip",
1096 "unittest_key.pem",
1097 "unittest_key2.pem",
1098 "unittest_key_RSA4096.pem",
1099 "unittest_key_EC.pem",
1100 "update_engine.conf",
Kelvin Zhanga35324f2023-06-28 10:29:16 -07001101 "testdata/cycle_nodes_product.bin",
1102 "testdata/cycle_nodes_product_no_xor.bin",
Kelvin Zhangc5803b72021-09-02 09:06:16 -07001103 ],
1104 static_libs: [
Kelvin Zhangc5803b72021-09-02 09:06:16 -07001105 "libgmock",
1106 "libpayload_generator",
1107 ],
1108}
1109
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001110// update_engine_unittests (type: executable)
1111// ========================================================
1112// Main unittest file.
1113cc_test {
Kelvin Zhang7e5b4052022-03-22 12:17:59 -07001114 name: "update_engine_http_unittests",
1115 defaults: [
1116 "ue_defaults",
1117 "liblz4diff_defaults",
1118 "update_metadata-protos_exports",
1119 ],
1120 require_root: true,
1121 static_libs: [
1122 "libbase",
1123 "libbrillo-test-helpers",
1124 "libchrome_test_helpers",
1125 "libcurl",
1126 "libcutils",
1127 "libdm",
1128 "libgmock",
1129 "libz",
Kelvin Zhang27757a22023-02-15 16:58:27 -08001130 "libzstd",
Kelvin Zhang7e5b4052022-03-22 12:17:59 -07001131 ],
1132 shared_libs: [
1133 "libssl",
1134 "libcrypto",
1135 "libziparchive",
1136 "liblog",
1137 ],
1138
1139 data: [
1140 ":test_http_server",
1141 ":test_subprocess",
1142 ":ue_unittest_keys",
1143 "otacerts.zip",
1144 "unittest_key.pem",
1145 "unittest_key2.pem",
1146 "unittest_key_RSA4096.pem",
1147 "unittest_key_EC.pem",
1148 ],
1149
1150 // We cannot use the default generated AndroidTest.xml because of the use of helper modules
1151 // (i.e. test_http_server, test_subprocess, ue_unittest_delta_generator).
1152 // test_config: "test_config.xml",
1153 test_suites: ["device-tests"],
1154
1155 srcs: [
1156 "aosp/platform_constants_android.cc",
1157 "certificate_checker.cc",
1158 "common/action_processor.cc",
1159 "common/boot_control_stub.cc",
1160 "common/error_code_utils.cc",
1161 "common/file_fetcher.cc",
1162 "common/hash_calculator.cc",
1163 "common/http_fetcher.cc",
1164 "common/multi_range_http_fetcher.cc",
1165 "common/http_common.cc",
1166 "common/subprocess.cc",
1167 "common/test_utils.cc",
1168 "common/utils.cc",
Kelvin Zhang7e5b4052022-03-22 12:17:59 -07001169 "libcurl_http_fetcher.cc",
1170 "payload_consumer/certificate_parser_android.cc",
1171 "payload_consumer/payload_verifier.cc",
1172 "payload_generator/payload_signer.cc",
1173 "update_status_utils.cc",
Kelvin Zhang7e5b4052022-03-22 12:17:59 -07001174 "certificate_checker_unittest.cc",
1175 "common/http_fetcher_unittest.cc",
1176 "common/mock_http_fetcher.cc",
Kelvin Zhang7e5b4052022-03-22 12:17:59 -07001177 "common/subprocess_unittest.cc",
1178 "libcurl_http_fetcher_unittest.cc",
1179 "payload_consumer/certificate_parser_android_unittest.cc",
1180 "update_status_utils_unittest.cc",
1181 ],
1182}
1183
1184// update_engine_unittests (type: executable)
1185// ========================================================
1186// Main unittest file.
1187cc_test {
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001188 name: "update_engine_unittests",
1189 defaults: [
1190 "ue_defaults",
1191 "libpayload_generator_exports",
1192 "libupdate_engine_android_exports",
1193 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001194
1195 static_libs: [
1196 "libpayload_generator",
1197 "libbrillo-test-helpers",
1198 "libgmock",
1199 "libchrome_test_helpers",
1200 "libupdate_engine_android",
Tianjie Xu173e6192019-12-10 10:56:01 -08001201 "libdm",
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001202 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001203
Yifan Hong87ea73f2019-09-12 13:07:37 -07001204 header_libs: [
1205 "libstorage_literals_headers",
1206 ],
1207
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001208 data: [
Tao Bao9456b6f2019-04-29 18:14:58 -07001209 ":ue_unittest_delta_generator",
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001210 ":ue_unittest_disk_imgs",
Kelvin Zhang759e8b92021-12-21 16:46:58 -08001211 ":ue_unittest_erofs_imgs",
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001212 ":ue_unittest_keys",
Tianjie Xu7a78d632019-10-08 16:32:39 -07001213 "otacerts.zip",
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001214 "unittest_key.pem",
1215 "unittest_key2.pem",
xunchangcda3c032019-03-26 15:41:14 -07001216 "unittest_key_RSA4096.pem",
Tianjie Xu7bbe0152019-10-09 18:11:15 -07001217 "unittest_key_EC.pem",
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001218 "update_engine.conf",
Kelvin Zhanga35324f2023-06-28 10:29:16 -07001219 "testdata/cycle_nodes_product.bin",
1220 "testdata/cycle_nodes_product_no_xor.bin",
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001221 ],
1222
Tao Bao9456b6f2019-04-29 18:14:58 -07001223 // We cannot use the default generated AndroidTest.xml because of the use of helper modules
1224 // (i.e. test_http_server, test_subprocess, ue_unittest_delta_generator).
1225 test_config: "test_config.xml",
1226 test_suites: ["device-tests"],
1227
Chih-Hung Hsieh85ad1472022-02-17 17:32:12 -08001228 tidy_timeout_srcs: [
1229 ":update_engine_host_unittest_timeout_srcs",
1230 "aosp/dynamic_partition_control_android_unittest.cc",
1231 "common/http_fetcher_unittest.cc",
1232 "payload_consumer/delta_performer_integration_test.cc",
1233 "payload_consumer/delta_performer_unittest.cc",
1234 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001235 srcs: [
Kelvin Zhangc5803b72021-09-02 09:06:16 -07001236 ":update_engine_host_unittest_srcs",
Mohammad Samiul Islam24a82792021-02-12 16:52:36 +00001237 "aosp/apex_handler_android_unittest.cc",
Kelvin Zhangb4b95c22021-04-05 15:56:26 -04001238 "aosp/cleanup_previous_update_action_unittest.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -07001239 "aosp/dynamic_partition_control_android_unittest.cc",
Kelvin Zhang3fe49642021-10-04 15:35:02 -07001240 "aosp/update_attempter_android_integration_test.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -07001241 "aosp/update_attempter_android_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001242 "common/utils_unittest.cc",
Kelvin Zhang4e93cf12021-09-13 16:03:24 -07001243 "download_action_android_unittest.cc",
Kelvin Zhange47767a2023-05-16 13:00:58 -07001244 "payload_consumer/block_extent_writer_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001245 "payload_consumer/bzip_extent_writer_unittest.cc",
1246 "payload_consumer/cached_file_descriptor_unittest.cc",
Kelvin Zhang46d6c492021-04-26 17:51:25 -04001247 "payload_consumer/cow_writer_file_descriptor_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001248 "payload_consumer/delta_performer_integration_test.cc",
1249 "payload_consumer/delta_performer_unittest.cc",
1250 "payload_consumer/extent_reader_unittest.cc",
1251 "payload_consumer/extent_writer_unittest.cc",
Kelvin Zhangc5803b72021-09-02 09:06:16 -07001252 "payload_consumer/extent_map_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001253 "payload_consumer/fake_file_descriptor.cc",
1254 "payload_consumer/file_descriptor_utils_unittest.cc",
1255 "payload_consumer/file_writer_unittest.cc",
1256 "payload_consumer/filesystem_verifier_action_unittest.cc",
Amin Hassani23795032020-11-24 14:38:55 -08001257 "payload_consumer/install_plan_unittest.cc",
Kelvin Zhang40d96662021-02-24 14:21:29 -05001258 "payload_consumer/install_operation_executor_unittest.cc",
Tianjie99d570d2020-06-04 14:57:19 -07001259 "payload_consumer/partition_update_generator_android_unittest.cc",
Kelvin Zhang4e93cf12021-09-13 16:03:24 -07001260 "payload_consumer/partition_writer_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001261 "payload_consumer/postinstall_runner_action_unittest.cc",
Kelvin Zhang4e93cf12021-09-13 16:03:24 -07001262 "payload_consumer/snapshot_extent_writer_unittest.cc",
1263 "payload_consumer/vabc_partition_writer_unittest.cc",
Kelvin Zhang4e93cf12021-09-13 16:03:24 -07001264 "payload_consumer/xor_extent_writer_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001265 ],
1266}
1267
1268// Brillo update payload generation script
1269// ========================================================
Martin Stjernholm18e9f3c2020-09-08 13:56:59 +01001270sh_binary {
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001271 name: "brillo_update_payload",
1272 device_supported: false,
1273 host_supported: true,
1274
Martin Stjernholm18e9f3c2020-09-08 13:56:59 +01001275 src: "scripts/brillo_update_payload",
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001276 required: [
1277 "delta_generator",
1278 "shflags",
1279 "simg2img",
1280 ],
1281
1282 target: {
1283 darwin: {
1284 enabled: false,
1285 },
1286 },
Colin Cross606913a2017-11-14 13:05:37 -08001287}
Yifan Hongd51738c2020-07-23 17:06:25 -07001288
1289// update_engine header library
1290cc_library_headers {
1291 name: "libupdate_engine_headers",
Yifan Hong309c8a82020-10-06 18:31:08 -07001292
1293 // This header library is available to core and product modules.
Justin Yun6d121de2020-11-11 19:31:57 +09001294 product_available: true,
Yifan Hong309c8a82020-10-06 18:31:08 -07001295
Yifan Hongd51738c2020-07-23 17:06:25 -07001296 export_include_dirs: ["."],
1297 apex_available: [
1298 "com.android.gki.*",
David Anderson5e6dfe32020-09-17 15:50:33 -07001299 "//apex_available:platform",
Yifan Hongd51738c2020-07-23 17:06:25 -07001300 ],
David Andersonc1c93052020-08-26 18:22:09 +00001301 host_supported: true,
David Anderson5e6dfe32020-09-17 15:50:33 -07001302 recovery_available: true,
1303 ramdisk_available: true,
David Andersona4b7ba62023-05-10 21:41:37 -07001304 vendor_ramdisk_available: true,
David Anderson5e6dfe32020-09-17 15:50:33 -07001305
1306 target: {
1307 darwin: {
1308 enabled: false,
1309 },
1310 }
Yifan Hongd51738c2020-07-23 17:06:25 -07001311}
Kelvin Zhangb93055f2021-02-03 14:22:35 -05001312
1313cc_binary_host {
1314 name: "cow_converter",
1315 defaults: [
1316 "ue_defaults",
1317 "libpayload_consumer_exports",
1318 ],
1319 srcs: [
1320 "aosp/cow_converter.cc",
1321 ],
1322 static_libs: [
1323 "liblog",
1324 "libbrotli",
1325 "libbase",
1326 "libcow_operation_convert",
1327 "libcow_size_estimator",
Kelvin Zhang901c7d52022-06-21 09:35:45 -07001328 "libgflags",
Kelvin Zhangb93055f2021-02-03 14:22:35 -05001329 "libpayload_consumer",
1330 "libpayload_extent_ranges",
1331 "libpayload_extent_utils",
1332 "libsnapshot_cow",
1333 "libz",
1334 "update_metadata-protos",
1335 ],
Elliott Hughes88f3c8c2021-04-22 13:47:21 -07001336}
Kelvin Zhang98001b22021-12-08 14:10:11 -08001337
1338cc_library_static {
1339 name: "lz4diff-protos",
1340 host_supported: true,
1341 ramdisk_available: true,
1342 recovery_available: true,
1343
1344 srcs: ["lz4diff/lz4diff.proto"],
1345 cflags: [
1346 "-Wall",
1347 "-Werror",
1348 ],
1349 proto: {
1350 canonical_path_from_root: false,
1351 export_proto_headers: true,
1352 },
1353}
Kelvin Zhang596a3202022-03-07 14:13:42 -08001354
1355cc_binary_host {
1356 name: "ota_extractor",
1357 defaults: [
1358 "ue_defaults",
1359 "libpayload_consumer_exports",
1360 ],
1361 srcs: [
1362 "aosp/ota_extractor.cc",
1363 ],
1364 static_libs: [
1365 "liblog",
1366 "libbrotli",
1367 "libbase",
1368 "libpayload_consumer",
1369 "libpayload_extent_ranges",
1370 "libpayload_extent_utils",
1371 "libz",
1372 "libgflags",
1373 "update_metadata-protos",
1374 ],
1375}
Kelvin Zhang83b594b2023-05-25 13:43:06 -07001376
1377cc_binary_host {
1378 name: "map_file_generator",
1379 defaults: [
1380 "ue_defaults",
1381 "libpayload_generator_exports",
1382 ],
1383 srcs: [
1384 "aosp/map_file_generator.cc",
1385 ],
1386 static_libs: [
1387 "liblog",
1388 "libbase",
1389 "libpayload_generator",
1390 "libpayload_extent_ranges",
1391 "libpayload_extent_utils",
1392 "libgflags",
Kelvin Zhang8bd5c4c2023-06-08 11:21:27 -07001393 "libsparse",
Kelvin Zhang83b594b2023-05-25 13:43:06 -07001394 "update_metadata-protos",
1395 ],
Kelvin Zhangdf9821b2023-06-12 10:04:34 -07001396 required: [
1397 "unsquashfs",
1398 ],
Kelvin Zhang83b594b2023-05-25 13:43:06 -07001399}
Pawan Waghdaa52652023-06-08 23:57:11 +00001400
1401cc_fuzz {
1402 name: "update_engine_service_fuzzer",
1403 defaults: [
1404 "ue_defaults",
1405 "libupdate_engine_android_exports",
1406 "service_fuzzer_defaults",
1407 "fuzzer_disable_leaks",
1408 ],
1409 static_libs: [
1410 "libupdate_engine_android",
1411 "libgflags",
1412 ],
1413 srcs: [
1414 "fuzzers/update_engine_service_fuzzer.cpp",
1415 "aosp/metrics_reporter_android.cc",
1416 ],
1417 fuzz_config: {
1418 triage_assignee: "waghpawan@google.com",
1419 cc: [
1420 "elsk@google.com",
1421 "zhangkelvin@google.com",
1422 ]
1423 },
1424}
Michael Bestas29a5c682023-12-13 18:03:12 +02001425
1426cc_binary_host {
1427 name: "ota_extractor_static",
1428 srcs: [
1429 "aosp/ota_extractor.cc",
1430 ],
1431 static_libs: [
1432 "liblog",
1433 "libbrotli",
1434 "libbase",
1435 "libpayload_consumer",
1436 "libpayload_extent_ranges",
1437 "libpayload_extent_utils",
1438 "libz",
1439 "libgflags",
1440 "update_metadata-protos",
1441 // from ue_defaults shared_libs
1442 "libbrillo",
1443 "libchrome",
1444 // from libpayload_consumer_exports static_libs
1445 "libxz",
1446 "libbz",
1447 "libbspatch",
1448 "libfec_rs",
1449 "libpuffpatch",
1450 "libverity_tree",
1451 "lz4diff-protos",
1452 "liblz4patch",
1453 // from libpayload_consumer_exports shared_libs
1454 "libcrypto",
1455 "libfec",
1456 "liblz4",
1457 "libprotobuf-cpp-lite",
1458 ],
1459 static_executable: true,
1460 stl: "libc++_static",
1461
1462 // from ue_defaults
1463 cflags: [
1464 "-DBASE_VER=576279",
1465 "-DUSE_HWID_OVERRIDE=0",
1466 "-D_FILE_OFFSET_BITS=64",
1467 "-D_POSIX_C_SOURCE=199309L",
1468 "-Wa,--noexecstack",
1469 "-Wall",
1470 "-Werror",
1471 "-Wextra",
1472 "-Wformat=2",
1473 "-Wno-psabi",
1474 "-Wno-unused-parameter",
1475 "-ffunction-sections",
1476 "-fstack-protector-strong",
1477 "-fvisibility=hidden",
1478 "-g3",
1479 ],
1480 cppflags: [
1481 "-Wnon-virtual-dtor",
1482 "-fno-strict-aliasing",
1483 ],
1484 include_dirs: ["system"],
1485 local_include_dirs: ["client_library/include"],
1486 header_libs: ["libgtest_prod_headers"],
1487 ldflags: ["-Wl,--gc-sections"],
1488}