blob: f95f2076925412cbbbbc54e7477c4fb8ab80ecc7 [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
78 product_variables: {
79 pdk: {
80 enabled: false,
81 },
82 },
83
84 target: {
Sen Jiangb5f631d2018-12-18 16:59:57 -080085 android: {
86 cflags: [
87 "-DUSE_FEC=1",
88 ],
89 },
90 host: {
91 cflags: [
92 "-DUSE_FEC=0",
93 ],
94 },
Dan Willemsenf5a904e2018-10-23 01:02:44 -070095 darwin: {
96 enabled: false,
97 },
98 },
99}
100
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400101// libcow_operation_convert (type: library)
102// ========================================================
Kelvin Zhangeb8703b2020-12-10 14:17:21 -0500103cc_library_static {
104 name: "libpayload_extent_utils",
105 defaults: [
106 "ue_defaults",
107 ],
108 host_supported: true,
109 recovery_available: true,
110 srcs: [
111 "payload_generator/extent_utils.cc",
112 ],
113 static_libs: [
114 "update_metadata-protos",
115 ],
116}
117
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400118cc_library {
119 name: "libcow_operation_convert",
120 host_supported: true,
121 recovery_available: true,
122 defaults: [
123 "ue_defaults",
124 "update_metadata-protos_exports",
125 ],
126 srcs: [
127 "common/cow_operation_convert.cc",
128 ],
129 static_libs: [
130 "libsnapshot_cow",
131 "update_metadata-protos",
132 "libpayload_extent_ranges",
Kelvin Zhangeb8703b2020-12-10 14:17:21 -0500133 "libpayload_extent_utils",
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400134 "libbrotli",
135 "libz",
136 ],
137}
138
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700139// update_metadata-protos (type: static_library)
140// ========================================================
141// Protobufs.
142cc_defaults {
143 name: "update_metadata-protos_exports",
144
145 shared_libs: ["libprotobuf-cpp-lite"],
146}
147
148cc_library_static {
149 name: "update_metadata-protos",
150 host_supported: true,
Inseob Kim3cce62a2021-06-14 11:55:35 +0900151 ramdisk_available: true,
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700152 recovery_available: true,
153
154 srcs: ["update_engine/update_metadata.proto"],
155 cflags: [
156 "-Wall",
157 "-Werror",
158 ],
159 proto: {
160 canonical_path_from_root: false,
161 export_proto_headers: true,
162 },
163}
164
165// libpayload_consumer (type: static_library)
166// ========================================================
167// The payload application component and common dependencies.
168cc_defaults {
169 name: "libpayload_consumer_exports",
170 defaults: ["update_metadata-protos_exports"],
171
172 static_libs: [
173 "update_metadata-protos",
174 "libxz",
175 "libbz",
176 "libbspatch",
177 "libbrotli",
Tianjie99d570d2020-06-04 14:57:19 -0700178 "libc++fs",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700179 "libfec_rs",
180 "libpuffpatch",
181 "libverity_tree",
Kelvin Zhang94f51cc2020-09-25 11:34:49 -0400182 "libsnapshot_cow",
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400183 "libbrotli",
184 "libz",
185 "libpayload_extent_ranges",
Kelvin Zhangeb8703b2020-12-10 14:17:21 -0500186 "libpayload_extent_utils",
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400187 "libcow_operation_convert",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700188 ],
189 shared_libs: [
190 "libbase",
191 "libcrypto",
Sen Jiangb5f631d2018-12-18 16:59:57 -0800192 "libfec",
Tianjie99d570d2020-06-04 14:57:19 -0700193 "libziparchive",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700194 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700195}
196
197cc_library_static {
198 name: "libpayload_consumer",
199 defaults: [
200 "ue_defaults",
201 "libpayload_consumer_exports",
202 ],
203 host_supported: true,
204 recovery_available: true,
205
206 srcs: [
Amin Hassaniec7bc112020-10-29 16:47:58 -0700207 "aosp/platform_constants_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700208 "common/action_processor.cc",
209 "common/boot_control_stub.cc",
210 "common/clock.cc",
211 "common/constants.cc",
212 "common/cpu_limiter.cc",
Yifan Hongdaac7322019-11-07 10:48:26 -0800213 "common/dynamic_partition_control_stub.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700214 "common/error_code_utils.cc",
215 "common/file_fetcher.cc",
216 "common/hash_calculator.cc",
217 "common/http_common.cc",
218 "common/http_fetcher.cc",
219 "common/hwid_override.cc",
220 "common/multi_range_http_fetcher.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700221 "common/prefs.cc",
222 "common/proxy_resolver.cc",
223 "common/subprocess.cc",
224 "common/terminator.cc",
225 "common/utils.cc",
226 "payload_consumer/bzip_extent_writer.cc",
227 "payload_consumer/cached_file_descriptor.cc",
Tianjie Xu7a78d632019-10-08 16:32:39 -0700228 "payload_consumer/certificate_parser_android.cc",
Kelvin Zhang569c97e2020-10-26 12:12:24 -0400229 "payload_consumer/cow_writer_file_descriptor.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700230 "payload_consumer/delta_performer.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700231 "payload_consumer/extent_reader.cc",
232 "payload_consumer/extent_writer.cc",
233 "payload_consumer/file_descriptor.cc",
234 "payload_consumer/file_descriptor_utils.cc",
235 "payload_consumer/file_writer.cc",
236 "payload_consumer/filesystem_verifier_action.cc",
Kelvin Zhang40d96662021-02-24 14:21:29 -0500237 "payload_consumer/install_operation_executor.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700238 "payload_consumer/install_plan.cc",
239 "payload_consumer/mount_history.cc",
240 "payload_consumer/payload_constants.cc",
241 "payload_consumer/payload_metadata.cc",
242 "payload_consumer/payload_verifier.cc",
Kelvin Zhang50bac652020-09-28 15:51:41 -0400243 "payload_consumer/partition_writer.cc",
Kelvin Zhang94f51cc2020-09-25 11:34:49 -0400244 "payload_consumer/partition_writer_factory_android.cc",
245 "payload_consumer/vabc_partition_writer.cc",
Kelvin Zhang4bb49202021-07-08 21:39:05 -0400246 "payload_consumer/xor_extent_writer.cc",
Kelvin Zhangb1706762021-06-25 15:05:22 -0400247 "payload_consumer/block_extent_writer.cc",
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400248 "payload_consumer/snapshot_extent_writer.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700249 "payload_consumer/postinstall_runner_action.cc",
Kelvin Zhangab3ce602021-02-24 14:46:40 -0500250 "payload_consumer/verified_source_fd.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700251 "payload_consumer/verity_writer_android.cc",
252 "payload_consumer/xz_extent_writer.cc",
253 "payload_consumer/fec_file_descriptor.cc",
Tianjied3865d12020-06-03 15:25:17 -0700254 "payload_consumer/partition_update_generator_android.cc",
Kelvin Zhangc5803b72021-09-02 09:06:16 -0700255 "update_status_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700256 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700257}
258
259// libupdate_engine_boot_control (type: static_library)
260// ========================================================
261// A BootControl class implementation using Android's HIDL boot_control HAL.
262cc_defaults {
263 name: "libupdate_engine_boot_control_exports",
264 defaults: ["update_metadata-protos_exports"],
265
Yifan Hong420db9b2019-07-23 20:50:33 -0700266 static_libs: [
David Andersone7ce8212019-12-16 20:13:19 -0800267 "libcutils",
268 "libfs_mgr_binder",
269 "libgsi",
Yifan Hongdad0af82020-02-19 17:19:49 -0800270 "libpayload_consumer",
Yifan Hong420db9b2019-07-23 20:50:33 -0700271 "libsnapshot",
David Anderson6c190a22020-09-21 17:09:53 -0700272 "libsnapshot_cow",
273 "libz",
Yifan Hong420db9b2019-07-23 20:50:33 -0700274 "update_metadata-protos",
275 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700276 shared_libs: [
277 "libbootloader_message",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700278 "libhidlbase",
279 "liblp",
Yifan Hongd976cc52020-02-25 14:51:42 -0800280 "libstatslog",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700281 "libutils",
282 "android.hardware.boot@1.0",
David Anderson2111d062019-10-15 22:36:27 -0700283 "android.hardware.boot@1.1",
Kelvin Zhangcb419e62021-06-16 13:56:47 -0400284 "android.hardware.boot@1.2",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700285 ],
Yifan Hong29692902020-03-26 12:47:05 -0700286 header_libs: [
287 "avb_headers",
288 ],
Yifan Hong420db9b2019-07-23 20:50:33 -0700289 target: {
290 recovery: {
David Andersone7ce8212019-12-16 20:13:19 -0800291 static_libs: [
292 "libfs_mgr",
293 "libsnapshot_nobinder",
294 ],
295 exclude_static_libs: [
296 "libfs_mgr_binder",
297 "libsnapshot",
298 ],
Yifan Hong212d7952020-02-04 11:08:08 -0800299 exclude_shared_libs: [
Yifan Hongd976cc52020-02-25 14:51:42 -0800300 "libstatslog",
Yifan Hong212d7952020-02-04 11:08:08 -0800301 ],
Yifan Hong420db9b2019-07-23 20:50:33 -0700302 },
303 },
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700304}
305
306cc_library_static {
307 name: "libupdate_engine_boot_control",
308 defaults: [
309 "ue_defaults",
310 "libupdate_engine_boot_control_exports",
Yifan Hongdad0af82020-02-19 17:19:49 -0800311 "libpayload_consumer_exports",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700312 ],
313 recovery_available: true,
314
315 srcs: [
Amin Hassaniec7bc112020-10-29 16:47:58 -0700316 "aosp/boot_control_android.cc",
317 "aosp/cleanup_previous_update_action.cc",
318 "aosp/dynamic_partition_control_android.cc",
319 "aosp/dynamic_partition_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700320 ],
321}
322
323// libupdate_engine_android (type: static_library)
324// ========================================================
325// The main daemon static_library used in Android (non-Brillo). This only has a
326// loop to apply payloads provided by the upper layer via a Binder interface.
327cc_defaults {
328 name: "libupdate_engine_android_exports",
329 defaults: [
330 "ue_defaults",
331 "libpayload_consumer_exports",
332 "libupdate_engine_boot_control_exports",
333 ],
334
335 static_libs: [
Tianjie838793d2021-01-14 22:05:13 -0800336 "libavb",
337 "libavb_user",
Yifan Hong126d13e2020-09-21 19:50:06 -0700338 "gkiprops",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700339 "libpayload_consumer",
340 "libupdate_engine_boot_control",
Tianjie838793d2021-01-14 22:05:13 -0800341 "PlatformProperties",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700342 ],
343 shared_libs: [
Mohammad Samiul Islam24a82792021-02-12 16:52:36 +0000344 "apex_aidl_interface-cpp",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700345 "libandroid_net",
346 "libbase",
347 "libbinder",
348 "libbinderwrapper",
349 "libbootloader_message",
350 "libbrillo-binder",
351 "libcurl",
352 "libcutils",
Jeongik Cha95f89e92021-01-26 22:33:11 +0900353 "libupdate_engine_stable-V1-cpp",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700354 "liblog",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700355 "libssl",
Tianjie Xu75cc9f22019-08-02 14:53:38 -0700356 "libstatslog",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700357 "libutils",
358 ],
Nikita Ioffeaedfef32021-04-28 13:54:14 +0100359 whole_static_libs: [
360 "com.android.sysprop.apex",
361 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700362}
363
364cc_library_static {
365 name: "libupdate_engine_android",
366 defaults: [
367 "ue_defaults",
368 "libupdate_engine_android_exports",
369 ],
370
371 // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved
372 // out of the DBus interface.
373 include_dirs: ["external/cros/system_api/dbus"],
374
375 aidl: {
376 local_include_dirs: ["binder_bindings"],
377 export_aidl_headers: true,
378 },
379
380 srcs: [
381 ":libupdate_engine_aidl",
Amin Hassani538bd592020-11-04 20:46:08 -0800382 "common/system_state.cc",
Mohammad Samiul Islam24a82792021-02-12 16:52:36 +0000383 "aosp/apex_handler_android.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700384 "aosp/binder_service_android.cc",
385 "aosp/binder_service_stable_android.cc",
386 "aosp/daemon_android.cc",
387 "aosp/daemon_state_android.cc",
388 "aosp/hardware_android.cc",
389 "aosp/logging_android.cc",
390 "aosp/network_selector_android.cc",
391 "aosp/update_attempter_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700392 "certificate_checker.cc",
Amin Hassani538bd592020-11-04 20:46:08 -0800393 "download_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700394 "libcurl_http_fetcher.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700395 "metrics_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700396 "update_boot_flags_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700397 ],
398}
399
400// update_engine (type: executable)
401// ========================================================
402// update_engine daemon.
403cc_binary {
404 name: "update_engine",
405 defaults: [
406 "ue_defaults",
407 "libupdate_engine_android_exports",
408 ],
409
410 static_libs: ["libupdate_engine_android"],
Tao Bao1e1c86c2019-04-18 10:48:32 -0700411 required: [
412 "cacerts_google",
Tianjie Xube4ea232019-10-15 18:08:31 -0700413 "otacerts",
Tao Bao1e1c86c2019-04-18 10:48:32 -0700414 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700415
Amin Hassaniec7bc112020-10-29 16:47:58 -0700416 srcs: ["main.cc", "aosp/metrics_reporter_android.cc"],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700417 init_rc: ["update_engine.rc"],
418}
419
420// update_engine_sideload (type: executable)
421// ========================================================
422// A binary executable equivalent to update_engine daemon that installs an update
423// from a local file directly instead of running in the background. Used in
424// recovery image.
425cc_binary {
426 name: "update_engine_sideload",
427 defaults: [
428 "ue_defaults",
429 "update_metadata-protos_exports",
430 "libupdate_engine_boot_control_exports",
431 "libpayload_consumer_exports",
432 ],
433 recovery: true,
434
435 cflags: ["-D_UE_SIDELOAD"],
436 // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved
437 // out of the DBus interface.
438 include_dirs: ["external/cros/system_api/dbus"],
Elliott Hughes88f3c8c2021-04-22 13:47:21 -0700439 header_libs: ["libgtest_prod_headers"],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700440
441 srcs: [
Amin Hassaniec7bc112020-10-29 16:47:58 -0700442 "aosp/hardware_android.cc",
443 "aosp/logging_android.cc",
444 "aosp/sideload_main.cc",
445 "aosp/update_attempter_android.cc",
446 "common/metrics_reporter_stub.cc",
447 "common/network_selector_stub.cc",
Amin Hassani538bd592020-11-04 20:46:08 -0800448 "common/system_state.cc",
449 "download_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700450 "metrics_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700451 "update_boot_flags_action.cc",
452 "update_status_utils.cc",
453 ],
454
455 // Use commonly used shared libraries. libprotobuf-cpp-lite.so is filtered out,
456 // as it doesn't look beneficial to be installed separately due to its size. Note
457 // that we explicitly request their recovery variants, so that the expected files
458 // will be used and installed.
459 shared_libs: [
460 "libbase",
461 "liblog",
462 ],
463 static_libs: [
464 "libpayload_consumer",
465 "libupdate_engine_boot_control",
466 "update_metadata-protos",
467
468 // We add the static versions of the shared libraries that are not installed to
469 // recovery image due to size concerns. Need to include all the static library
470 // dependencies of these static libraries.
Yifan Hong126d13e2020-09-21 19:50:06 -0700471 "gkiprops",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700472 "libevent",
473 "libmodpb64",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700474 "libprotobuf-cpp-lite",
475 "libbrillo-stream",
476 "libbrillo",
477 "libchrome",
478 ],
479 target: {
480 recovery: {
481 exclude_shared_libs: [
482 "libprotobuf-cpp-lite",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700483 "libbrillo-stream",
484 "libbrillo",
485 "libchrome",
486 ],
487 },
488 },
489
Tao Bao1e1c86c2019-04-18 10:48:32 -0700490 required: [
Tianjie Xube4ea232019-10-15 18:08:31 -0700491 "otacerts.recovery",
Tao Bao1e1c86c2019-04-18 10:48:32 -0700492 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700493}
494
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700495// update_engine_client (type: executable)
496// ========================================================
497// update_engine console client.
498cc_binary {
499 name: "update_engine_client",
500 defaults: ["ue_defaults"],
501
502 // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved
503 // out of the DBus interface.
504 include_dirs: ["external/cros/system_api/dbus"],
505
506 shared_libs: [
507 "libbinder",
508 "libbinderwrapper",
509 "libbrillo-binder",
510 "libutils",
511 ],
512
513 aidl: {
514 local_include_dirs: ["binder_bindings"],
515 },
516
517 srcs: [
518 ":libupdate_engine_aidl",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700519 "aosp/update_engine_client_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700520 "common/error_code_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700521 "update_status_utils.cc",
522 ],
523}
524
525// libpayload_generator (type: static_library)
526// ========================================================
527// server-side code. This is used for delta_generator and unittests but not
528// for any client code.
529cc_defaults {
530 name: "libpayload_generator_exports",
531 defaults: [
532 "libpayload_consumer_exports",
533 "update_metadata-protos_exports",
534 ],
535
Tianjie37ae8562020-03-25 15:16:01 -0700536 header_libs: [
537 "bootimg_headers",
538 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700539 static_libs: [
540 "libavb",
541 "libbrotli",
542 "libbsdiff",
543 "libdivsufsort",
544 "libdivsufsort64",
545 "liblzma",
546 "libpayload_consumer",
547 "libpuffdiff",
Tianjiea69cfe22021-08-22 23:28:44 -0700548 "libzucchini",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700549 "libverity_tree",
550 "update_metadata-protos",
Kelvin Zhangeb8703b2020-12-10 14:17:21 -0500551 "libpayload_extent_utils",
Kelvin Zhangb93055f2021-02-03 14:22:35 -0500552 "libcow_size_estimator",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700553 ],
554 shared_libs: [
555 "libbase",
556 "libext2fs",
557 ],
558}
559
560cc_library_static {
David Andersonc1c93052020-08-26 18:22:09 +0000561 name: "libpayload_extent_ranges",
562 defaults: [
563 "ue_defaults",
564 ],
565 host_supported: true,
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400566 recovery_available: true,
David Andersonc1c93052020-08-26 18:22:09 +0000567 srcs: [
568 "payload_generator/extent_ranges.cc",
569 ],
570 static_libs: [
571 "update_metadata-protos",
572 ],
573}
574
575cc_library_static {
Kelvin Zhangb93055f2021-02-03 14:22:35 -0500576 name: "libcow_size_estimator",
577 defaults: [
578 "ue_defaults",
579 "update_metadata-protos_exports"
580 ],
581 host_supported: true,
582 recovery_available: true,
583 srcs: [
584 "payload_generator/cow_size_estimator.cc",
585 ],
586 static_libs: [
587 "update_metadata-protos",
588 "libbase",
589 "libsnapshot_cow",
590 "libcow_operation_convert",
591 ],
592}
593
594cc_library_static {
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700595 name: "libpayload_generator",
596 defaults: [
597 "ue_defaults",
598 "libpayload_generator_exports",
599 ],
600 host_supported: true,
601
602 srcs: [
Amin Hassani538bd592020-11-04 20:46:08 -0800603 "common/system_state.cc",
604 "download_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700605 "payload_generator/ab_generator.cc",
606 "payload_generator/annotated_operation.cc",
607 "payload_generator/blob_file_writer.cc",
608 "payload_generator/block_mapping.cc",
609 "payload_generator/boot_img_filesystem.cc",
610 "payload_generator/bzip.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700611 "payload_generator/deflate_utils.cc",
612 "payload_generator/delta_diff_generator.cc",
613 "payload_generator/delta_diff_utils.cc",
614 "payload_generator/ext2_filesystem.cc",
615 "payload_generator/extent_ranges.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700616 "payload_generator/full_update_generator.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700617 "payload_generator/mapfile_filesystem.cc",
Tianjiee9156ec2020-08-11 11:13:54 -0700618 "payload_generator/merge_sequence_generator.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700619 "payload_generator/payload_file.cc",
620 "payload_generator/payload_generation_config_android.cc",
621 "payload_generator/payload_generation_config.cc",
Amin Hassani79821002019-05-06 17:40:49 -0700622 "payload_generator/payload_properties.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700623 "payload_generator/payload_signer.cc",
624 "payload_generator/raw_filesystem.cc",
625 "payload_generator/squashfs_filesystem.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700626 "payload_generator/xz_android.cc",
627 ],
628}
629
630// delta_generator (type: executable)
631// ========================================================
632// server-side delta generator.
633cc_binary_host {
634 name: "delta_generator",
635 defaults: [
636 "ue_defaults",
637 "libpayload_generator_exports",
638 "libpayload_consumer_exports",
639 ],
640
641 static_libs: [
642 "libavb_host_sysdeps",
643 "libpayload_consumer",
644 "libpayload_generator",
645 ],
646
647 srcs: ["payload_generator/generate_delta_main.cc"],
648}
649
650cc_test {
Kelvin Zhangc5803b72021-09-02 09:06:16 -0700651 host_supported: true,
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700652 name: "ue_unittest_delta_generator",
653 defaults: [
654 "ue_defaults",
655 "libpayload_generator_exports",
656 "libpayload_consumer_exports",
657 ],
658
659 static_libs: [
660 "libpayload_consumer",
661 "libpayload_generator",
662 ],
663
664 srcs: ["payload_generator/generate_delta_main.cc"],
665
666 gtest: false,
667 stem: "delta_generator",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700668}
669
670// test_http_server (type: executable)
671// ========================================================
672// Test HTTP Server.
673cc_test {
674 name: "test_http_server",
675 defaults: ["ue_defaults"],
676 srcs: [
677 "common/http_common.cc",
678 "test_http_server.cc",
679 ],
680
681 gtest: false,
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700682}
683
684// test_subprocess (type: executable)
685// ========================================================
686// Test helper subprocess program.
687cc_test {
688 name: "test_subprocess",
689 defaults: ["ue_defaults"],
690 srcs: ["test_subprocess.cc"],
691
692 gtest: false,
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700693}
694
695// Public keys for unittests.
696// ========================================================
697genrule {
698 name: "ue_unittest_keys",
699 cmd: "openssl rsa -in $(location unittest_key.pem) -pubout -out $(location unittest_key.pub.pem) &&" +
xunchangcda3c032019-03-26 15:41:14 -0700700 "openssl rsa -in $(location unittest_key2.pem) -pubout -out $(location unittest_key2.pub.pem) &&" +
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700701 "openssl rsa -in $(location unittest_key_RSA4096.pem) -pubout -out $(location unittest_key_RSA4096.pub.pem) &&" +
702 "openssl pkey -in $(location unittest_key_EC.pem) -pubout -out $(location unittest_key_EC.pub.pem)",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700703 srcs: [
704 "unittest_key.pem",
705 "unittest_key2.pem",
xunchangcda3c032019-03-26 15:41:14 -0700706 "unittest_key_RSA4096.pem",
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700707 "unittest_key_EC.pem",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700708 ],
709 out: [
710 "unittest_key.pub.pem",
711 "unittest_key2.pub.pem",
xunchangcda3c032019-03-26 15:41:14 -0700712 "unittest_key_RSA4096.pub.pem",
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700713 "unittest_key_EC.pub.pem",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700714 ],
715}
716
717// Sample images for unittests.
718// ========================================================
719// Extract sample image from the compressed sample_images.tar.bz2 file used by
720// the unittests.
721genrule {
722 name: "ue_unittest_disk_imgs",
723 cmd: "tar -jxf $(in) -C $(genDir)/gen disk_ext2_1k.img disk_ext2_4k.img disk_ext2_4k_empty.img disk_ext2_unittest.img",
724 srcs: ["sample_images/sample_images.tar.bz2"],
725 out: [
726 "gen/disk_ext2_1k.img",
727 "gen/disk_ext2_4k.img",
728 "gen/disk_ext2_4k_empty.img",
729 "gen/disk_ext2_unittest.img",
730 ],
731}
732
Kelvin Zhangc5803b72021-09-02 09:06:16 -0700733filegroup {
734 name: "update_engine_host_unittest_srcs",
735 srcs: [
736 "common/action_pipe_unittest.cc",
737 "common/action_processor_unittest.cc",
738 "common/action_unittest.cc",
739 "common/cow_operation_convert_unittest.cc",
740 "common/cpu_limiter_unittest.cc",
741 "common/fake_prefs.cc",
742 "common/file_fetcher_unittest.cc",
743 "common/hash_calculator_unittest.cc",
744 "common/hwid_override_unittest.cc",
745 "common/metrics_reporter_stub.cc",
746 "common/mock_http_fetcher.cc",
747 "common/prefs_unittest.cc",
748 "common/terminator_unittest.cc",
749 "common/test_utils.cc",
750 "payload_generator/ab_generator_unittest.cc",
751 "payload_generator/blob_file_writer_unittest.cc",
752 "payload_generator/block_mapping_unittest.cc",
753 "payload_generator/boot_img_filesystem_unittest.cc",
754 "payload_generator/deflate_utils_unittest.cc",
755 "payload_generator/delta_diff_utils_unittest.cc",
756 "payload_generator/ext2_filesystem_unittest.cc",
757 "payload_generator/extent_ranges_unittest.cc",
758 "payload_generator/extent_utils_unittest.cc",
759 "payload_generator/fake_filesystem.cc",
760 "payload_generator/full_update_generator_unittest.cc",
761 "payload_generator/mapfile_filesystem_unittest.cc",
762 "payload_generator/merge_sequence_generator_unittest.cc",
763 "payload_generator/payload_file_unittest.cc",
764 "payload_generator/payload_generation_config_android_unittest.cc",
765 "payload_generator/payload_generation_config_unittest.cc",
766 "payload_generator/payload_properties_unittest.cc",
767 "payload_generator/payload_signer_unittest.cc",
768 "payload_generator/squashfs_filesystem_unittest.cc",
769 "payload_generator/zip_unittest.cc",
770 "testrunner.cc",
771 ],
772}
773
774cc_test_host {
775 name: "update_engine_host_unittests",
776 defaults: [
777 "ue_defaults",
778 "libpayload_generator_exports",
779 ],
780 strip: {
781 none: true,
782 },
783 cflags: [
784 "-g3",
785 ],
786 srcs: [":update_engine_host_unittest_srcs"],
787 data: [
788 ":ue_unittest_delta_generator",
789 ":ue_unittest_disk_imgs",
790 ":ue_unittest_keys",
791 "otacerts.zip",
792 "unittest_key.pem",
793 "unittest_key2.pem",
794 "unittest_key_RSA4096.pem",
795 "unittest_key_EC.pem",
796 "update_engine.conf",
797 ],
798 static_libs: [
799 "libcurl",
800 "libgmock",
801 "libpayload_generator",
802 ],
803}
804
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700805// update_engine_unittests (type: executable)
806// ========================================================
807// Main unittest file.
808cc_test {
809 name: "update_engine_unittests",
810 defaults: [
811 "ue_defaults",
812 "libpayload_generator_exports",
813 "libupdate_engine_android_exports",
814 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700815
816 static_libs: [
817 "libpayload_generator",
818 "libbrillo-test-helpers",
819 "libgmock",
820 "libchrome_test_helpers",
821 "libupdate_engine_android",
Tianjie Xu173e6192019-12-10 10:56:01 -0800822 "libdm",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700823 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700824
Yifan Hong87ea73f2019-09-12 13:07:37 -0700825 header_libs: [
826 "libstorage_literals_headers",
827 ],
828
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700829 data: [
Tao Bao9456b6f2019-04-29 18:14:58 -0700830 ":test_http_server",
831 ":test_subprocess",
832 ":ue_unittest_delta_generator",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700833 ":ue_unittest_disk_imgs",
834 ":ue_unittest_keys",
Tianjie Xu7a78d632019-10-08 16:32:39 -0700835 "otacerts.zip",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700836 "unittest_key.pem",
837 "unittest_key2.pem",
xunchangcda3c032019-03-26 15:41:14 -0700838 "unittest_key_RSA4096.pem",
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700839 "unittest_key_EC.pem",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700840 "update_engine.conf",
841 ],
842
Tao Bao9456b6f2019-04-29 18:14:58 -0700843 // We cannot use the default generated AndroidTest.xml because of the use of helper modules
844 // (i.e. test_http_server, test_subprocess, ue_unittest_delta_generator).
845 test_config: "test_config.xml",
846 test_suites: ["device-tests"],
847
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700848 srcs: [
Kelvin Zhangc5803b72021-09-02 09:06:16 -0700849 ":update_engine_host_unittest_srcs",
Mohammad Samiul Islam24a82792021-02-12 16:52:36 +0000850 "aosp/apex_handler_android_unittest.cc",
Kelvin Zhangb4b95c22021-04-05 15:56:26 -0400851 "aosp/cleanup_previous_update_action_unittest.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700852 "aosp/dynamic_partition_control_android_unittest.cc",
853 "aosp/update_attempter_android_unittest.cc",
Kelvin Zhangc5803b72021-09-02 09:06:16 -0700854 "download_action_android_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700855 "certificate_checker_unittest.cc",
Kelvin Zhangc5803b72021-09-02 09:06:16 -0700856 "libcurl_http_fetcher_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700857 "common/http_fetcher_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700858 "common/proxy_resolver_unittest.cc",
859 "common/subprocess_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700860 "common/utils_unittest.cc",
861 "payload_consumer/bzip_extent_writer_unittest.cc",
862 "payload_consumer/cached_file_descriptor_unittest.cc",
Kelvin Zhang46d6c492021-04-26 17:51:25 -0400863 "payload_consumer/cow_writer_file_descriptor_unittest.cc",
Tianjie Xu7a78d632019-10-08 16:32:39 -0700864 "payload_consumer/certificate_parser_android_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700865 "payload_consumer/delta_performer_integration_test.cc",
866 "payload_consumer/delta_performer_unittest.cc",
Kelvin Zhang9bd519d2020-09-23 12:55:19 -0400867 "payload_consumer/partition_writer_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700868 "payload_consumer/extent_reader_unittest.cc",
869 "payload_consumer/extent_writer_unittest.cc",
Kelvin Zhang9754f172020-09-25 15:22:35 -0400870 "payload_consumer/snapshot_extent_writer_unittest.cc",
Kelvin Zhang4bb49202021-07-08 21:39:05 -0400871 "payload_consumer/xor_extent_writer_unittest.cc",
Kelvin Zhang76f10b82021-06-25 18:45:46 -0400872 "payload_consumer/vabc_partition_writer_unittest.cc",
Kelvin Zhangc5803b72021-09-02 09:06:16 -0700873 "payload_consumer/extent_map_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700874 "payload_consumer/fake_file_descriptor.cc",
875 "payload_consumer/file_descriptor_utils_unittest.cc",
876 "payload_consumer/file_writer_unittest.cc",
877 "payload_consumer/filesystem_verifier_action_unittest.cc",
Amin Hassani23795032020-11-24 14:38:55 -0800878 "payload_consumer/install_plan_unittest.cc",
Kelvin Zhang40d96662021-02-24 14:21:29 -0500879 "payload_consumer/install_operation_executor_unittest.cc",
Tianjie99d570d2020-06-04 14:57:19 -0700880 "payload_consumer/partition_update_generator_android_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700881 "payload_consumer/postinstall_runner_action_unittest.cc",
882 "payload_consumer/verity_writer_android_unittest.cc",
883 "payload_consumer/xz_extent_writer_unittest.cc",
Jae Hoon Kim916af852019-08-01 17:45:30 -0700884 "update_status_utils_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700885 ],
886}
887
888// Brillo update payload generation script
889// ========================================================
Martin Stjernholm18e9f3c2020-09-08 13:56:59 +0100890sh_binary {
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700891 name: "brillo_update_payload",
892 device_supported: false,
893 host_supported: true,
894
Martin Stjernholm18e9f3c2020-09-08 13:56:59 +0100895 src: "scripts/brillo_update_payload",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700896 required: [
897 "delta_generator",
898 "shflags",
899 "simg2img",
900 ],
901
902 target: {
903 darwin: {
904 enabled: false,
905 },
906 },
Colin Cross606913a2017-11-14 13:05:37 -0800907}
Yifan Hongd51738c2020-07-23 17:06:25 -0700908
909// update_engine header library
910cc_library_headers {
911 name: "libupdate_engine_headers",
Yifan Hong309c8a82020-10-06 18:31:08 -0700912
913 // This header library is available to core and product modules.
Justin Yun6d121de2020-11-11 19:31:57 +0900914 product_available: true,
Yifan Hong309c8a82020-10-06 18:31:08 -0700915
Yifan Hongd51738c2020-07-23 17:06:25 -0700916 export_include_dirs: ["."],
917 apex_available: [
918 "com.android.gki.*",
David Anderson5e6dfe32020-09-17 15:50:33 -0700919 "//apex_available:platform",
Yifan Hongd51738c2020-07-23 17:06:25 -0700920 ],
David Andersonc1c93052020-08-26 18:22:09 +0000921 host_supported: true,
David Anderson5e6dfe32020-09-17 15:50:33 -0700922 recovery_available: true,
923 ramdisk_available: true,
924
925 target: {
926 darwin: {
927 enabled: false,
928 },
929 }
Yifan Hongd51738c2020-07-23 17:06:25 -0700930}
Kelvin Zhangb93055f2021-02-03 14:22:35 -0500931
932cc_binary_host {
933 name: "cow_converter",
934 defaults: [
935 "ue_defaults",
936 "libpayload_consumer_exports",
937 ],
938 srcs: [
939 "aosp/cow_converter.cc",
940 ],
941 static_libs: [
942 "liblog",
943 "libbrotli",
944 "libbase",
945 "libcow_operation_convert",
946 "libcow_size_estimator",
947 "libpayload_consumer",
948 "libpayload_extent_ranges",
949 "libpayload_extent_utils",
950 "libsnapshot_cow",
951 "libz",
952 "update_metadata-protos",
953 ],
Elliott Hughes88f3c8c2021-04-22 13:47:21 -0700954}