blob: c519280c55c42bcfc20c244e1c7d17dfbf63544a [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",
62 ],
63 cppflags: [
64 "-Wnon-virtual-dtor",
65 "-fno-strict-aliasing",
66 ],
67 include_dirs: ["system"],
68 local_include_dirs: ["client_library/include"],
Elliott Hughes88f3c8c2021-04-22 13:47:21 -070069 header_libs: ["libgtest_prod_headers"],
Dan Willemsenf5a904e2018-10-23 01:02:44 -070070 shared_libs: [
71 "libbrillo-stream",
72 "libbrillo",
73 "libchrome",
74 ],
75 ldflags: ["-Wl,--gc-sections"],
76
77 product_variables: {
78 pdk: {
79 enabled: false,
80 },
81 },
82
83 target: {
Sen Jiangb5f631d2018-12-18 16:59:57 -080084 android: {
85 cflags: [
86 "-DUSE_FEC=1",
87 ],
88 },
89 host: {
90 cflags: [
91 "-DUSE_FEC=0",
92 ],
93 },
Dan Willemsenf5a904e2018-10-23 01:02:44 -070094 darwin: {
95 enabled: false,
96 },
97 },
98}
99
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400100// libcow_operation_convert (type: library)
101// ========================================================
Kelvin Zhangeb8703b2020-12-10 14:17:21 -0500102cc_library_static {
103 name: "libpayload_extent_utils",
104 defaults: [
105 "ue_defaults",
106 ],
107 host_supported: true,
108 recovery_available: true,
109 srcs: [
110 "payload_generator/extent_utils.cc",
111 ],
112 static_libs: [
113 "update_metadata-protos",
114 ],
115}
116
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400117cc_library {
118 name: "libcow_operation_convert",
119 host_supported: true,
120 recovery_available: true,
121 defaults: [
122 "ue_defaults",
123 "update_metadata-protos_exports",
124 ],
125 srcs: [
126 "common/cow_operation_convert.cc",
127 ],
128 static_libs: [
129 "libsnapshot_cow",
130 "update_metadata-protos",
131 "libpayload_extent_ranges",
Kelvin Zhangeb8703b2020-12-10 14:17:21 -0500132 "libpayload_extent_utils",
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400133 "libbrotli",
134 "libz",
135 ],
136}
137
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700138// update_metadata-protos (type: static_library)
139// ========================================================
140// Protobufs.
141cc_defaults {
142 name: "update_metadata-protos_exports",
143
144 shared_libs: ["libprotobuf-cpp-lite"],
145}
146
147cc_library_static {
148 name: "update_metadata-protos",
149 host_supported: true,
Inseob Kim3cce62a2021-06-14 11:55:35 +0900150 ramdisk_available: true,
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700151 recovery_available: true,
152
153 srcs: ["update_engine/update_metadata.proto"],
154 cflags: [
155 "-Wall",
156 "-Werror",
157 ],
158 proto: {
159 canonical_path_from_root: false,
160 export_proto_headers: true,
161 },
162}
163
164// libpayload_consumer (type: static_library)
165// ========================================================
166// The payload application component and common dependencies.
167cc_defaults {
168 name: "libpayload_consumer_exports",
169 defaults: ["update_metadata-protos_exports"],
170
171 static_libs: [
172 "update_metadata-protos",
173 "libxz",
174 "libbz",
175 "libbspatch",
176 "libbrotli",
Tianjie99d570d2020-06-04 14:57:19 -0700177 "libc++fs",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700178 "libfec_rs",
179 "libpuffpatch",
180 "libverity_tree",
Kelvin Zhang94f51cc2020-09-25 11:34:49 -0400181 "libsnapshot_cow",
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400182 "libbrotli",
183 "libz",
184 "libpayload_extent_ranges",
Kelvin Zhangeb8703b2020-12-10 14:17:21 -0500185 "libpayload_extent_utils",
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400186 "libcow_operation_convert",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700187 ],
188 shared_libs: [
189 "libbase",
190 "libcrypto",
Sen Jiangb5f631d2018-12-18 16:59:57 -0800191 "libfec",
Tianjie99d570d2020-06-04 14:57:19 -0700192 "libziparchive",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700193 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700194}
195
196cc_library_static {
197 name: "libpayload_consumer",
198 defaults: [
199 "ue_defaults",
200 "libpayload_consumer_exports",
201 ],
202 host_supported: true,
203 recovery_available: true,
204
205 srcs: [
Amin Hassaniec7bc112020-10-29 16:47:58 -0700206 "aosp/platform_constants_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700207 "common/action_processor.cc",
208 "common/boot_control_stub.cc",
209 "common/clock.cc",
210 "common/constants.cc",
211 "common/cpu_limiter.cc",
Yifan Hongdaac7322019-11-07 10:48:26 -0800212 "common/dynamic_partition_control_stub.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700213 "common/error_code_utils.cc",
214 "common/file_fetcher.cc",
215 "common/hash_calculator.cc",
216 "common/http_common.cc",
217 "common/http_fetcher.cc",
218 "common/hwid_override.cc",
219 "common/multi_range_http_fetcher.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700220 "common/prefs.cc",
221 "common/proxy_resolver.cc",
222 "common/subprocess.cc",
223 "common/terminator.cc",
224 "common/utils.cc",
225 "payload_consumer/bzip_extent_writer.cc",
226 "payload_consumer/cached_file_descriptor.cc",
Tianjie Xu7a78d632019-10-08 16:32:39 -0700227 "payload_consumer/certificate_parser_android.cc",
Kelvin Zhang569c97e2020-10-26 12:12:24 -0400228 "payload_consumer/cow_writer_file_descriptor.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700229 "payload_consumer/delta_performer.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700230 "payload_consumer/extent_reader.cc",
231 "payload_consumer/extent_writer.cc",
232 "payload_consumer/file_descriptor.cc",
233 "payload_consumer/file_descriptor_utils.cc",
234 "payload_consumer/file_writer.cc",
235 "payload_consumer/filesystem_verifier_action.cc",
Kelvin Zhang40d96662021-02-24 14:21:29 -0500236 "payload_consumer/install_operation_executor.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700237 "payload_consumer/install_plan.cc",
238 "payload_consumer/mount_history.cc",
239 "payload_consumer/payload_constants.cc",
240 "payload_consumer/payload_metadata.cc",
241 "payload_consumer/payload_verifier.cc",
Kelvin Zhang50bac652020-09-28 15:51:41 -0400242 "payload_consumer/partition_writer.cc",
Kelvin Zhang94f51cc2020-09-25 11:34:49 -0400243 "payload_consumer/partition_writer_factory_android.cc",
244 "payload_consumer/vabc_partition_writer.cc",
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400245 "payload_consumer/snapshot_extent_writer.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700246 "payload_consumer/postinstall_runner_action.cc",
Kelvin Zhangab3ce602021-02-24 14:46:40 -0500247 "payload_consumer/verified_source_fd.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700248 "payload_consumer/verity_writer_android.cc",
249 "payload_consumer/xz_extent_writer.cc",
250 "payload_consumer/fec_file_descriptor.cc",
Tianjied3865d12020-06-03 15:25:17 -0700251 "payload_consumer/partition_update_generator_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700252 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700253}
254
255// libupdate_engine_boot_control (type: static_library)
256// ========================================================
257// A BootControl class implementation using Android's HIDL boot_control HAL.
258cc_defaults {
259 name: "libupdate_engine_boot_control_exports",
260 defaults: ["update_metadata-protos_exports"],
261
Yifan Hong420db9b2019-07-23 20:50:33 -0700262 static_libs: [
David Andersone7ce8212019-12-16 20:13:19 -0800263 "libcutils",
264 "libfs_mgr_binder",
265 "libgsi",
Yifan Hongdad0af82020-02-19 17:19:49 -0800266 "libpayload_consumer",
Yifan Hong420db9b2019-07-23 20:50:33 -0700267 "libsnapshot",
David Anderson6c190a22020-09-21 17:09:53 -0700268 "libsnapshot_cow",
269 "libz",
Yifan Hong420db9b2019-07-23 20:50:33 -0700270 "update_metadata-protos",
271 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700272 shared_libs: [
273 "libbootloader_message",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700274 "libhidlbase",
275 "liblp",
Yifan Hongd976cc52020-02-25 14:51:42 -0800276 "libstatslog",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700277 "libutils",
278 "android.hardware.boot@1.0",
David Anderson2111d062019-10-15 22:36:27 -0700279 "android.hardware.boot@1.1",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700280 ],
Yifan Hong29692902020-03-26 12:47:05 -0700281 header_libs: [
282 "avb_headers",
283 ],
Yifan Hong420db9b2019-07-23 20:50:33 -0700284 target: {
285 recovery: {
David Andersone7ce8212019-12-16 20:13:19 -0800286 static_libs: [
287 "libfs_mgr",
288 "libsnapshot_nobinder",
289 ],
290 exclude_static_libs: [
291 "libfs_mgr_binder",
292 "libsnapshot",
293 ],
Yifan Hong212d7952020-02-04 11:08:08 -0800294 exclude_shared_libs: [
Yifan Hongd976cc52020-02-25 14:51:42 -0800295 "libstatslog",
Yifan Hong212d7952020-02-04 11:08:08 -0800296 ],
Yifan Hong420db9b2019-07-23 20:50:33 -0700297 },
298 },
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700299}
300
301cc_library_static {
302 name: "libupdate_engine_boot_control",
303 defaults: [
304 "ue_defaults",
305 "libupdate_engine_boot_control_exports",
Yifan Hongdad0af82020-02-19 17:19:49 -0800306 "libpayload_consumer_exports",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700307 ],
308 recovery_available: true,
309
310 srcs: [
Amin Hassaniec7bc112020-10-29 16:47:58 -0700311 "aosp/boot_control_android.cc",
312 "aosp/cleanup_previous_update_action.cc",
313 "aosp/dynamic_partition_control_android.cc",
314 "aosp/dynamic_partition_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700315 ],
316}
317
318// libupdate_engine_android (type: static_library)
319// ========================================================
320// The main daemon static_library used in Android (non-Brillo). This only has a
321// loop to apply payloads provided by the upper layer via a Binder interface.
322cc_defaults {
323 name: "libupdate_engine_android_exports",
324 defaults: [
325 "ue_defaults",
326 "libpayload_consumer_exports",
327 "libupdate_engine_boot_control_exports",
328 ],
329
330 static_libs: [
Tianjie838793d2021-01-14 22:05:13 -0800331 "libavb",
332 "libavb_user",
Yifan Hong126d13e2020-09-21 19:50:06 -0700333 "gkiprops",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700334 "libpayload_consumer",
335 "libupdate_engine_boot_control",
Tianjie838793d2021-01-14 22:05:13 -0800336 "PlatformProperties",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700337 ],
338 shared_libs: [
Mohammad Samiul Islam24a82792021-02-12 16:52:36 +0000339 "apex_aidl_interface-cpp",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700340 "libandroid_net",
341 "libbase",
342 "libbinder",
343 "libbinderwrapper",
344 "libbootloader_message",
345 "libbrillo-binder",
346 "libcurl",
347 "libcutils",
Jeongik Cha95f89e92021-01-26 22:33:11 +0900348 "libupdate_engine_stable-V1-cpp",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700349 "liblog",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700350 "libssl",
Tianjie Xu75cc9f22019-08-02 14:53:38 -0700351 "libstatslog",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700352 "libutils",
353 ],
Nikita Ioffeaedfef32021-04-28 13:54:14 +0100354 whole_static_libs: [
355 "com.android.sysprop.apex",
356 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700357}
358
359cc_library_static {
360 name: "libupdate_engine_android",
361 defaults: [
362 "ue_defaults",
363 "libupdate_engine_android_exports",
364 ],
365
366 // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved
367 // out of the DBus interface.
368 include_dirs: ["external/cros/system_api/dbus"],
369
370 aidl: {
371 local_include_dirs: ["binder_bindings"],
372 export_aidl_headers: true,
373 },
374
375 srcs: [
376 ":libupdate_engine_aidl",
Amin Hassani538bd592020-11-04 20:46:08 -0800377 "common/system_state.cc",
Mohammad Samiul Islam24a82792021-02-12 16:52:36 +0000378 "aosp/apex_handler_android.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700379 "aosp/binder_service_android.cc",
380 "aosp/binder_service_stable_android.cc",
381 "aosp/daemon_android.cc",
382 "aosp/daemon_state_android.cc",
383 "aosp/hardware_android.cc",
384 "aosp/logging_android.cc",
385 "aosp/network_selector_android.cc",
386 "aosp/update_attempter_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700387 "certificate_checker.cc",
Amin Hassani538bd592020-11-04 20:46:08 -0800388 "download_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700389 "libcurl_http_fetcher.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700390 "metrics_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700391 "update_boot_flags_action.cc",
392 "update_status_utils.cc",
393 ],
394}
395
396// update_engine (type: executable)
397// ========================================================
398// update_engine daemon.
399cc_binary {
400 name: "update_engine",
401 defaults: [
402 "ue_defaults",
403 "libupdate_engine_android_exports",
404 ],
405
406 static_libs: ["libupdate_engine_android"],
Tao Bao1e1c86c2019-04-18 10:48:32 -0700407 required: [
408 "cacerts_google",
Tianjie Xube4ea232019-10-15 18:08:31 -0700409 "otacerts",
Tao Bao1e1c86c2019-04-18 10:48:32 -0700410 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700411
Amin Hassaniec7bc112020-10-29 16:47:58 -0700412 srcs: ["main.cc", "aosp/metrics_reporter_android.cc"],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700413 init_rc: ["update_engine.rc"],
414}
415
416// update_engine_sideload (type: executable)
417// ========================================================
418// A binary executable equivalent to update_engine daemon that installs an update
419// from a local file directly instead of running in the background. Used in
420// recovery image.
421cc_binary {
422 name: "update_engine_sideload",
423 defaults: [
424 "ue_defaults",
425 "update_metadata-protos_exports",
426 "libupdate_engine_boot_control_exports",
427 "libpayload_consumer_exports",
428 ],
429 recovery: true,
430
431 cflags: ["-D_UE_SIDELOAD"],
432 // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved
433 // out of the DBus interface.
434 include_dirs: ["external/cros/system_api/dbus"],
Elliott Hughes88f3c8c2021-04-22 13:47:21 -0700435 header_libs: ["libgtest_prod_headers"],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700436
437 srcs: [
Amin Hassaniec7bc112020-10-29 16:47:58 -0700438 "aosp/hardware_android.cc",
439 "aosp/logging_android.cc",
440 "aosp/sideload_main.cc",
441 "aosp/update_attempter_android.cc",
442 "common/metrics_reporter_stub.cc",
443 "common/network_selector_stub.cc",
Amin Hassani538bd592020-11-04 20:46:08 -0800444 "common/system_state.cc",
445 "download_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700446 "metrics_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700447 "update_boot_flags_action.cc",
448 "update_status_utils.cc",
449 ],
450
451 // Use commonly used shared libraries. libprotobuf-cpp-lite.so is filtered out,
452 // as it doesn't look beneficial to be installed separately due to its size. Note
453 // that we explicitly request their recovery variants, so that the expected files
454 // will be used and installed.
455 shared_libs: [
456 "libbase",
457 "liblog",
458 ],
459 static_libs: [
460 "libpayload_consumer",
461 "libupdate_engine_boot_control",
462 "update_metadata-protos",
463
464 // We add the static versions of the shared libraries that are not installed to
465 // recovery image due to size concerns. Need to include all the static library
466 // dependencies of these static libraries.
Yifan Hong126d13e2020-09-21 19:50:06 -0700467 "gkiprops",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700468 "libevent",
469 "libmodpb64",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700470 "libprotobuf-cpp-lite",
471 "libbrillo-stream",
472 "libbrillo",
473 "libchrome",
474 ],
475 target: {
476 recovery: {
477 exclude_shared_libs: [
478 "libprotobuf-cpp-lite",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700479 "libbrillo-stream",
480 "libbrillo",
481 "libchrome",
482 ],
483 },
484 },
485
Tao Bao1e1c86c2019-04-18 10:48:32 -0700486 required: [
Tianjie Xube4ea232019-10-15 18:08:31 -0700487 "otacerts.recovery",
Tao Bao1e1c86c2019-04-18 10:48:32 -0700488 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700489}
490
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700491// update_engine_client (type: executable)
492// ========================================================
493// update_engine console client.
494cc_binary {
495 name: "update_engine_client",
496 defaults: ["ue_defaults"],
497
498 // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved
499 // out of the DBus interface.
500 include_dirs: ["external/cros/system_api/dbus"],
501
502 shared_libs: [
503 "libbinder",
504 "libbinderwrapper",
505 "libbrillo-binder",
506 "libutils",
507 ],
508
509 aidl: {
510 local_include_dirs: ["binder_bindings"],
511 },
512
513 srcs: [
514 ":libupdate_engine_aidl",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700515 "aosp/update_engine_client_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700516 "common/error_code_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700517 "update_status_utils.cc",
518 ],
519}
520
521// libpayload_generator (type: static_library)
522// ========================================================
523// server-side code. This is used for delta_generator and unittests but not
524// for any client code.
525cc_defaults {
526 name: "libpayload_generator_exports",
527 defaults: [
528 "libpayload_consumer_exports",
529 "update_metadata-protos_exports",
530 ],
531
Tianjie37ae8562020-03-25 15:16:01 -0700532 header_libs: [
533 "bootimg_headers",
534 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700535 static_libs: [
536 "libavb",
537 "libbrotli",
538 "libbsdiff",
539 "libdivsufsort",
540 "libdivsufsort64",
541 "liblzma",
542 "libpayload_consumer",
543 "libpuffdiff",
544 "libverity_tree",
545 "update_metadata-protos",
Kelvin Zhangeb8703b2020-12-10 14:17:21 -0500546 "libpayload_extent_utils",
Kelvin Zhangb93055f2021-02-03 14:22:35 -0500547 "libcow_size_estimator",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700548 ],
549 shared_libs: [
550 "libbase",
551 "libext2fs",
552 ],
553}
554
555cc_library_static {
David Andersonc1c93052020-08-26 18:22:09 +0000556 name: "libpayload_extent_ranges",
557 defaults: [
558 "ue_defaults",
559 ],
560 host_supported: true,
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400561 recovery_available: true,
David Andersonc1c93052020-08-26 18:22:09 +0000562 srcs: [
563 "payload_generator/extent_ranges.cc",
564 ],
565 static_libs: [
566 "update_metadata-protos",
567 ],
568}
569
570cc_library_static {
Kelvin Zhangb93055f2021-02-03 14:22:35 -0500571 name: "libcow_size_estimator",
572 defaults: [
573 "ue_defaults",
574 "update_metadata-protos_exports"
575 ],
576 host_supported: true,
577 recovery_available: true,
578 srcs: [
579 "payload_generator/cow_size_estimator.cc",
580 ],
581 static_libs: [
582 "update_metadata-protos",
583 "libbase",
584 "libsnapshot_cow",
585 "libcow_operation_convert",
586 ],
587}
588
589cc_library_static {
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700590 name: "libpayload_generator",
591 defaults: [
592 "ue_defaults",
593 "libpayload_generator_exports",
594 ],
595 host_supported: true,
596
597 srcs: [
Amin Hassani538bd592020-11-04 20:46:08 -0800598 "common/system_state.cc",
599 "download_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700600 "payload_generator/ab_generator.cc",
601 "payload_generator/annotated_operation.cc",
602 "payload_generator/blob_file_writer.cc",
603 "payload_generator/block_mapping.cc",
604 "payload_generator/boot_img_filesystem.cc",
605 "payload_generator/bzip.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700606 "payload_generator/deflate_utils.cc",
607 "payload_generator/delta_diff_generator.cc",
608 "payload_generator/delta_diff_utils.cc",
609 "payload_generator/ext2_filesystem.cc",
610 "payload_generator/extent_ranges.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700611 "payload_generator/full_update_generator.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700612 "payload_generator/mapfile_filesystem.cc",
Tianjiee9156ec2020-08-11 11:13:54 -0700613 "payload_generator/merge_sequence_generator.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700614 "payload_generator/payload_file.cc",
615 "payload_generator/payload_generation_config_android.cc",
616 "payload_generator/payload_generation_config.cc",
Amin Hassani79821002019-05-06 17:40:49 -0700617 "payload_generator/payload_properties.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700618 "payload_generator/payload_signer.cc",
619 "payload_generator/raw_filesystem.cc",
620 "payload_generator/squashfs_filesystem.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700621 "payload_generator/xz_android.cc",
622 ],
623}
624
625// delta_generator (type: executable)
626// ========================================================
627// server-side delta generator.
628cc_binary_host {
629 name: "delta_generator",
630 defaults: [
631 "ue_defaults",
632 "libpayload_generator_exports",
633 "libpayload_consumer_exports",
634 ],
635
636 static_libs: [
637 "libavb_host_sysdeps",
638 "libpayload_consumer",
639 "libpayload_generator",
640 ],
641
642 srcs: ["payload_generator/generate_delta_main.cc"],
643}
644
645cc_test {
646 name: "ue_unittest_delta_generator",
647 defaults: [
648 "ue_defaults",
649 "libpayload_generator_exports",
650 "libpayload_consumer_exports",
651 ],
652
653 static_libs: [
654 "libpayload_consumer",
655 "libpayload_generator",
656 ],
657
658 srcs: ["payload_generator/generate_delta_main.cc"],
659
660 gtest: false,
661 stem: "delta_generator",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700662}
663
664// test_http_server (type: executable)
665// ========================================================
666// Test HTTP Server.
667cc_test {
668 name: "test_http_server",
669 defaults: ["ue_defaults"],
670 srcs: [
671 "common/http_common.cc",
672 "test_http_server.cc",
673 ],
674
675 gtest: false,
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700676}
677
678// test_subprocess (type: executable)
679// ========================================================
680// Test helper subprocess program.
681cc_test {
682 name: "test_subprocess",
683 defaults: ["ue_defaults"],
684 srcs: ["test_subprocess.cc"],
685
686 gtest: false,
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700687}
688
689// Public keys for unittests.
690// ========================================================
691genrule {
692 name: "ue_unittest_keys",
693 cmd: "openssl rsa -in $(location unittest_key.pem) -pubout -out $(location unittest_key.pub.pem) &&" +
xunchangcda3c032019-03-26 15:41:14 -0700694 "openssl rsa -in $(location unittest_key2.pem) -pubout -out $(location unittest_key2.pub.pem) &&" +
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700695 "openssl rsa -in $(location unittest_key_RSA4096.pem) -pubout -out $(location unittest_key_RSA4096.pub.pem) &&" +
696 "openssl pkey -in $(location unittest_key_EC.pem) -pubout -out $(location unittest_key_EC.pub.pem)",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700697 srcs: [
698 "unittest_key.pem",
699 "unittest_key2.pem",
xunchangcda3c032019-03-26 15:41:14 -0700700 "unittest_key_RSA4096.pem",
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700701 "unittest_key_EC.pem",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700702 ],
703 out: [
704 "unittest_key.pub.pem",
705 "unittest_key2.pub.pem",
xunchangcda3c032019-03-26 15:41:14 -0700706 "unittest_key_RSA4096.pub.pem",
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700707 "unittest_key_EC.pub.pem",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700708 ],
709}
710
711// Sample images for unittests.
712// ========================================================
713// Extract sample image from the compressed sample_images.tar.bz2 file used by
714// the unittests.
715genrule {
716 name: "ue_unittest_disk_imgs",
717 cmd: "tar -jxf $(in) -C $(genDir)/gen disk_ext2_1k.img disk_ext2_4k.img disk_ext2_4k_empty.img disk_ext2_unittest.img",
718 srcs: ["sample_images/sample_images.tar.bz2"],
719 out: [
720 "gen/disk_ext2_1k.img",
721 "gen/disk_ext2_4k.img",
722 "gen/disk_ext2_4k_empty.img",
723 "gen/disk_ext2_unittest.img",
724 ],
725}
726
727// update_engine_unittests (type: executable)
728// ========================================================
729// Main unittest file.
730cc_test {
731 name: "update_engine_unittests",
732 defaults: [
733 "ue_defaults",
734 "libpayload_generator_exports",
735 "libupdate_engine_android_exports",
736 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700737
738 static_libs: [
739 "libpayload_generator",
740 "libbrillo-test-helpers",
741 "libgmock",
742 "libchrome_test_helpers",
743 "libupdate_engine_android",
Tianjie Xu173e6192019-12-10 10:56:01 -0800744 "libdm",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700745 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700746
Yifan Hong87ea73f2019-09-12 13:07:37 -0700747 header_libs: [
748 "libstorage_literals_headers",
749 ],
750
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700751 data: [
Tao Bao9456b6f2019-04-29 18:14:58 -0700752 ":test_http_server",
753 ":test_subprocess",
754 ":ue_unittest_delta_generator",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700755 ":ue_unittest_disk_imgs",
756 ":ue_unittest_keys",
Tianjie Xu7a78d632019-10-08 16:32:39 -0700757 "otacerts.zip",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700758 "unittest_key.pem",
759 "unittest_key2.pem",
xunchangcda3c032019-03-26 15:41:14 -0700760 "unittest_key_RSA4096.pem",
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700761 "unittest_key_EC.pem",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700762 "update_engine.conf",
763 ],
764
Tao Bao9456b6f2019-04-29 18:14:58 -0700765 // We cannot use the default generated AndroidTest.xml because of the use of helper modules
766 // (i.e. test_http_server, test_subprocess, ue_unittest_delta_generator).
767 test_config: "test_config.xml",
768 test_suites: ["device-tests"],
769
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700770 srcs: [
Mohammad Samiul Islam24a82792021-02-12 16:52:36 +0000771 "aosp/apex_handler_android_unittest.cc",
Kelvin Zhangb4b95c22021-04-05 15:56:26 -0400772 "aosp/cleanup_previous_update_action_unittest.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700773 "aosp/dynamic_partition_control_android_unittest.cc",
774 "aosp/update_attempter_android_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700775 "certificate_checker_unittest.cc",
776 "common/action_pipe_unittest.cc",
777 "common/action_processor_unittest.cc",
778 "common/action_unittest.cc",
Kelvin Zhangb05e4e22020-09-25 16:16:19 -0400779 "common/cow_operation_convert_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700780 "common/cpu_limiter_unittest.cc",
781 "common/fake_prefs.cc",
782 "common/file_fetcher_unittest.cc",
783 "common/hash_calculator_unittest.cc",
784 "common/http_fetcher_unittest.cc",
785 "common/hwid_override_unittest.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700786 "common/metrics_reporter_stub.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700787 "common/mock_http_fetcher.cc",
788 "common/prefs_unittest.cc",
789 "common/proxy_resolver_unittest.cc",
790 "common/subprocess_unittest.cc",
791 "common/terminator_unittest.cc",
792 "common/test_utils.cc",
793 "common/utils_unittest.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700794 "download_action_android_unittest.cc",
Jae Hoon Kim0ae8fe12019-06-26 14:32:50 -0700795 "libcurl_http_fetcher_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700796 "payload_consumer/bzip_extent_writer_unittest.cc",
797 "payload_consumer/cached_file_descriptor_unittest.cc",
Kelvin Zhang46d6c492021-04-26 17:51:25 -0400798 "payload_consumer/cow_writer_file_descriptor_unittest.cc",
Tianjie Xu7a78d632019-10-08 16:32:39 -0700799 "payload_consumer/certificate_parser_android_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700800 "payload_consumer/delta_performer_integration_test.cc",
801 "payload_consumer/delta_performer_unittest.cc",
Kelvin Zhang9bd519d2020-09-23 12:55:19 -0400802 "payload_consumer/partition_writer_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700803 "payload_consumer/extent_reader_unittest.cc",
804 "payload_consumer/extent_writer_unittest.cc",
Kelvin Zhang9754f172020-09-25 15:22:35 -0400805 "payload_consumer/snapshot_extent_writer_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700806 "payload_consumer/fake_file_descriptor.cc",
807 "payload_consumer/file_descriptor_utils_unittest.cc",
808 "payload_consumer/file_writer_unittest.cc",
809 "payload_consumer/filesystem_verifier_action_unittest.cc",
Amin Hassani23795032020-11-24 14:38:55 -0800810 "payload_consumer/install_plan_unittest.cc",
Kelvin Zhang40d96662021-02-24 14:21:29 -0500811 "payload_consumer/install_operation_executor_unittest.cc",
Tianjie99d570d2020-06-04 14:57:19 -0700812 "payload_consumer/partition_update_generator_android_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700813 "payload_consumer/postinstall_runner_action_unittest.cc",
814 "payload_consumer/verity_writer_android_unittest.cc",
815 "payload_consumer/xz_extent_writer_unittest.cc",
816 "payload_generator/ab_generator_unittest.cc",
817 "payload_generator/blob_file_writer_unittest.cc",
818 "payload_generator/block_mapping_unittest.cc",
819 "payload_generator/boot_img_filesystem_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700820 "payload_generator/deflate_utils_unittest.cc",
821 "payload_generator/delta_diff_utils_unittest.cc",
822 "payload_generator/ext2_filesystem_unittest.cc",
823 "payload_generator/extent_ranges_unittest.cc",
824 "payload_generator/extent_utils_unittest.cc",
825 "payload_generator/fake_filesystem.cc",
826 "payload_generator/full_update_generator_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700827 "payload_generator/mapfile_filesystem_unittest.cc",
Tianjie87af6c02020-08-11 15:06:26 -0700828 "payload_generator/merge_sequence_generator_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700829 "payload_generator/payload_file_unittest.cc",
830 "payload_generator/payload_generation_config_android_unittest.cc",
831 "payload_generator/payload_generation_config_unittest.cc",
Jae Hoon Kim4b6d1262019-06-20 10:41:18 -0700832 "payload_generator/payload_properties_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700833 "payload_generator/payload_signer_unittest.cc",
834 "payload_generator/squashfs_filesystem_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700835 "payload_generator/zip_unittest.cc",
836 "testrunner.cc",
Jae Hoon Kim916af852019-08-01 17:45:30 -0700837 "update_status_utils_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700838 ],
839}
840
841// Brillo update payload generation script
842// ========================================================
Martin Stjernholm18e9f3c2020-09-08 13:56:59 +0100843sh_binary {
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700844 name: "brillo_update_payload",
845 device_supported: false,
846 host_supported: true,
847
Martin Stjernholm18e9f3c2020-09-08 13:56:59 +0100848 src: "scripts/brillo_update_payload",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700849 required: [
850 "delta_generator",
851 "shflags",
852 "simg2img",
853 ],
854
855 target: {
856 darwin: {
857 enabled: false,
858 },
859 },
Colin Cross606913a2017-11-14 13:05:37 -0800860}
Yifan Hongd51738c2020-07-23 17:06:25 -0700861
862// update_engine header library
863cc_library_headers {
864 name: "libupdate_engine_headers",
Yifan Hong309c8a82020-10-06 18:31:08 -0700865
866 // This header library is available to core and product modules.
Justin Yun6d121de2020-11-11 19:31:57 +0900867 product_available: true,
Yifan Hong309c8a82020-10-06 18:31:08 -0700868
Yifan Hongd51738c2020-07-23 17:06:25 -0700869 export_include_dirs: ["."],
870 apex_available: [
871 "com.android.gki.*",
David Anderson5e6dfe32020-09-17 15:50:33 -0700872 "//apex_available:platform",
Yifan Hongd51738c2020-07-23 17:06:25 -0700873 ],
David Andersonc1c93052020-08-26 18:22:09 +0000874 host_supported: true,
David Anderson5e6dfe32020-09-17 15:50:33 -0700875 recovery_available: true,
876 ramdisk_available: true,
877
878 target: {
879 darwin: {
880 enabled: false,
881 },
882 }
Yifan Hongd51738c2020-07-23 17:06:25 -0700883}
Kelvin Zhangb93055f2021-02-03 14:22:35 -0500884
885cc_binary_host {
886 name: "cow_converter",
887 defaults: [
888 "ue_defaults",
889 "libpayload_consumer_exports",
890 ],
891 srcs: [
892 "aosp/cow_converter.cc",
893 ],
894 static_libs: [
895 "liblog",
896 "libbrotli",
897 "libbase",
898 "libcow_operation_convert",
899 "libcow_size_estimator",
900 "libpayload_consumer",
901 "libpayload_extent_ranges",
902 "libpayload_extent_utils",
903 "libsnapshot_cow",
904 "libz",
905 "update_metadata-protos",
906 ],
Elliott Hughes88f3c8c2021-04-22 13:47:21 -0700907}