blob: d74e78f33e4c274e24aa57410b21ae104c430f44 [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,
150 recovery_available: true,
151
152 srcs: ["update_engine/update_metadata.proto"],
153 cflags: [
154 "-Wall",
155 "-Werror",
156 ],
157 proto: {
158 canonical_path_from_root: false,
159 export_proto_headers: true,
160 },
161}
162
163// libpayload_consumer (type: static_library)
164// ========================================================
165// The payload application component and common dependencies.
166cc_defaults {
167 name: "libpayload_consumer_exports",
168 defaults: ["update_metadata-protos_exports"],
169
170 static_libs: [
171 "update_metadata-protos",
172 "libxz",
173 "libbz",
174 "libbspatch",
175 "libbrotli",
Tianjie99d570d2020-06-04 14:57:19 -0700176 "libc++fs",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700177 "libfec_rs",
178 "libpuffpatch",
179 "libverity_tree",
Kelvin Zhang94f51cc2020-09-25 11:34:49 -0400180 "libsnapshot_cow",
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400181 "libbrotli",
182 "libz",
183 "libpayload_extent_ranges",
Kelvin Zhangeb8703b2020-12-10 14:17:21 -0500184 "libpayload_extent_utils",
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400185 "libcow_operation_convert",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700186 ],
187 shared_libs: [
188 "libbase",
189 "libcrypto",
Sen Jiangb5f631d2018-12-18 16:59:57 -0800190 "libfec",
Tianjie99d570d2020-06-04 14:57:19 -0700191 "libziparchive",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700192 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700193}
194
195cc_library_static {
196 name: "libpayload_consumer",
197 defaults: [
198 "ue_defaults",
199 "libpayload_consumer_exports",
200 ],
201 host_supported: true,
202 recovery_available: true,
203
204 srcs: [
Amin Hassaniec7bc112020-10-29 16:47:58 -0700205 "aosp/platform_constants_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700206 "common/action_processor.cc",
207 "common/boot_control_stub.cc",
208 "common/clock.cc",
209 "common/constants.cc",
210 "common/cpu_limiter.cc",
Yifan Hongdaac7322019-11-07 10:48:26 -0800211 "common/dynamic_partition_control_stub.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700212 "common/error_code_utils.cc",
213 "common/file_fetcher.cc",
214 "common/hash_calculator.cc",
215 "common/http_common.cc",
216 "common/http_fetcher.cc",
217 "common/hwid_override.cc",
218 "common/multi_range_http_fetcher.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700219 "common/prefs.cc",
220 "common/proxy_resolver.cc",
221 "common/subprocess.cc",
222 "common/terminator.cc",
223 "common/utils.cc",
224 "payload_consumer/bzip_extent_writer.cc",
225 "payload_consumer/cached_file_descriptor.cc",
Tianjie Xu7a78d632019-10-08 16:32:39 -0700226 "payload_consumer/certificate_parser_android.cc",
Kelvin Zhang569c97e2020-10-26 12:12:24 -0400227 "payload_consumer/cow_writer_file_descriptor.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700228 "payload_consumer/delta_performer.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700229 "payload_consumer/extent_reader.cc",
230 "payload_consumer/extent_writer.cc",
231 "payload_consumer/file_descriptor.cc",
232 "payload_consumer/file_descriptor_utils.cc",
233 "payload_consumer/file_writer.cc",
234 "payload_consumer/filesystem_verifier_action.cc",
235 "payload_consumer/install_plan.cc",
236 "payload_consumer/mount_history.cc",
237 "payload_consumer/payload_constants.cc",
238 "payload_consumer/payload_metadata.cc",
239 "payload_consumer/payload_verifier.cc",
Kelvin Zhang50bac652020-09-28 15:51:41 -0400240 "payload_consumer/partition_writer.cc",
Kelvin Zhang94f51cc2020-09-25 11:34:49 -0400241 "payload_consumer/partition_writer_factory_android.cc",
242 "payload_consumer/vabc_partition_writer.cc",
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400243 "payload_consumer/snapshot_extent_writer.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700244 "payload_consumer/postinstall_runner_action.cc",
245 "payload_consumer/verity_writer_android.cc",
246 "payload_consumer/xz_extent_writer.cc",
247 "payload_consumer/fec_file_descriptor.cc",
Tianjied3865d12020-06-03 15:25:17 -0700248 "payload_consumer/partition_update_generator_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700249 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700250}
251
252// libupdate_engine_boot_control (type: static_library)
253// ========================================================
254// A BootControl class implementation using Android's HIDL boot_control HAL.
255cc_defaults {
256 name: "libupdate_engine_boot_control_exports",
257 defaults: ["update_metadata-protos_exports"],
258
Yifan Hong420db9b2019-07-23 20:50:33 -0700259 static_libs: [
David Andersone7ce8212019-12-16 20:13:19 -0800260 "libcutils",
261 "libfs_mgr_binder",
262 "libgsi",
Yifan Hongdad0af82020-02-19 17:19:49 -0800263 "libpayload_consumer",
Yifan Hong420db9b2019-07-23 20:50:33 -0700264 "libsnapshot",
David Anderson6c190a22020-09-21 17:09:53 -0700265 "libsnapshot_cow",
266 "libz",
Yifan Hong420db9b2019-07-23 20:50:33 -0700267 "update_metadata-protos",
268 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700269 shared_libs: [
270 "libbootloader_message",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700271 "libhidlbase",
272 "liblp",
Yifan Hongd976cc52020-02-25 14:51:42 -0800273 "libstatslog",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700274 "libutils",
275 "android.hardware.boot@1.0",
David Anderson2111d062019-10-15 22:36:27 -0700276 "android.hardware.boot@1.1",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700277 ],
Yifan Hong29692902020-03-26 12:47:05 -0700278 header_libs: [
279 "avb_headers",
280 ],
Yifan Hong420db9b2019-07-23 20:50:33 -0700281 target: {
282 recovery: {
David Andersone7ce8212019-12-16 20:13:19 -0800283 static_libs: [
284 "libfs_mgr",
285 "libsnapshot_nobinder",
286 ],
287 exclude_static_libs: [
288 "libfs_mgr_binder",
289 "libsnapshot",
290 ],
Yifan Hong212d7952020-02-04 11:08:08 -0800291 exclude_shared_libs: [
Yifan Hongd976cc52020-02-25 14:51:42 -0800292 "libstatslog",
Yifan Hong212d7952020-02-04 11:08:08 -0800293 ],
Yifan Hong420db9b2019-07-23 20:50:33 -0700294 },
295 },
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700296}
297
298cc_library_static {
299 name: "libupdate_engine_boot_control",
300 defaults: [
301 "ue_defaults",
302 "libupdate_engine_boot_control_exports",
Yifan Hongdad0af82020-02-19 17:19:49 -0800303 "libpayload_consumer_exports",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700304 ],
305 recovery_available: true,
306
307 srcs: [
Amin Hassaniec7bc112020-10-29 16:47:58 -0700308 "aosp/boot_control_android.cc",
309 "aosp/cleanup_previous_update_action.cc",
310 "aosp/dynamic_partition_control_android.cc",
311 "aosp/dynamic_partition_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700312 ],
313}
314
315// libupdate_engine_android (type: static_library)
316// ========================================================
317// The main daemon static_library used in Android (non-Brillo). This only has a
318// loop to apply payloads provided by the upper layer via a Binder interface.
319cc_defaults {
320 name: "libupdate_engine_android_exports",
321 defaults: [
322 "ue_defaults",
323 "libpayload_consumer_exports",
324 "libupdate_engine_boot_control_exports",
325 ],
326
327 static_libs: [
Tianjie838793d2021-01-14 22:05:13 -0800328 "libavb",
329 "libavb_user",
Yifan Hong126d13e2020-09-21 19:50:06 -0700330 "gkiprops",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700331 "libpayload_consumer",
332 "libupdate_engine_boot_control",
Tianjie838793d2021-01-14 22:05:13 -0800333 "PlatformProperties",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700334 ],
335 shared_libs: [
Mohammad Samiul Islam24a82792021-02-12 16:52:36 +0000336 "apex_aidl_interface-cpp",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700337 "libandroid_net",
338 "libbase",
339 "libbinder",
340 "libbinderwrapper",
341 "libbootloader_message",
342 "libbrillo-binder",
343 "libcurl",
344 "libcutils",
Jeongik Cha95f89e92021-01-26 22:33:11 +0900345 "libupdate_engine_stable-V1-cpp",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700346 "liblog",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700347 "libssl",
Tianjie Xu75cc9f22019-08-02 14:53:38 -0700348 "libstatslog",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700349 "libutils",
350 ],
Nikita Ioffeaedfef32021-04-28 13:54:14 +0100351 whole_static_libs: [
352 "com.android.sysprop.apex",
353 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700354}
355
356cc_library_static {
357 name: "libupdate_engine_android",
358 defaults: [
359 "ue_defaults",
360 "libupdate_engine_android_exports",
361 ],
362
363 // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved
364 // out of the DBus interface.
365 include_dirs: ["external/cros/system_api/dbus"],
366
367 aidl: {
368 local_include_dirs: ["binder_bindings"],
369 export_aidl_headers: true,
370 },
371
372 srcs: [
373 ":libupdate_engine_aidl",
Amin Hassani538bd592020-11-04 20:46:08 -0800374 "common/system_state.cc",
Mohammad Samiul Islam24a82792021-02-12 16:52:36 +0000375 "aosp/apex_handler_android.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700376 "aosp/binder_service_android.cc",
377 "aosp/binder_service_stable_android.cc",
378 "aosp/daemon_android.cc",
379 "aosp/daemon_state_android.cc",
380 "aosp/hardware_android.cc",
381 "aosp/logging_android.cc",
382 "aosp/network_selector_android.cc",
383 "aosp/update_attempter_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700384 "certificate_checker.cc",
Amin Hassani538bd592020-11-04 20:46:08 -0800385 "download_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700386 "libcurl_http_fetcher.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700387 "metrics_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700388 "update_boot_flags_action.cc",
389 "update_status_utils.cc",
390 ],
391}
392
393// update_engine (type: executable)
394// ========================================================
395// update_engine daemon.
396cc_binary {
397 name: "update_engine",
398 defaults: [
399 "ue_defaults",
400 "libupdate_engine_android_exports",
401 ],
402
403 static_libs: ["libupdate_engine_android"],
Tao Bao1e1c86c2019-04-18 10:48:32 -0700404 required: [
405 "cacerts_google",
Tianjie Xube4ea232019-10-15 18:08:31 -0700406 "otacerts",
Tao Bao1e1c86c2019-04-18 10:48:32 -0700407 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700408
Amin Hassaniec7bc112020-10-29 16:47:58 -0700409 srcs: ["main.cc", "aosp/metrics_reporter_android.cc"],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700410 init_rc: ["update_engine.rc"],
411}
412
413// update_engine_sideload (type: executable)
414// ========================================================
415// A binary executable equivalent to update_engine daemon that installs an update
416// from a local file directly instead of running in the background. Used in
417// recovery image.
418cc_binary {
419 name: "update_engine_sideload",
420 defaults: [
421 "ue_defaults",
422 "update_metadata-protos_exports",
423 "libupdate_engine_boot_control_exports",
424 "libpayload_consumer_exports",
425 ],
426 recovery: true,
427
428 cflags: ["-D_UE_SIDELOAD"],
429 // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved
430 // out of the DBus interface.
431 include_dirs: ["external/cros/system_api/dbus"],
Elliott Hughes88f3c8c2021-04-22 13:47:21 -0700432 header_libs: ["libgtest_prod_headers"],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700433
434 srcs: [
Amin Hassaniec7bc112020-10-29 16:47:58 -0700435 "aosp/hardware_android.cc",
436 "aosp/logging_android.cc",
437 "aosp/sideload_main.cc",
438 "aosp/update_attempter_android.cc",
439 "common/metrics_reporter_stub.cc",
440 "common/network_selector_stub.cc",
Amin Hassani538bd592020-11-04 20:46:08 -0800441 "common/system_state.cc",
442 "download_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700443 "metrics_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700444 "update_boot_flags_action.cc",
445 "update_status_utils.cc",
446 ],
447
448 // Use commonly used shared libraries. libprotobuf-cpp-lite.so is filtered out,
449 // as it doesn't look beneficial to be installed separately due to its size. Note
450 // that we explicitly request their recovery variants, so that the expected files
451 // will be used and installed.
452 shared_libs: [
453 "libbase",
454 "liblog",
455 ],
456 static_libs: [
457 "libpayload_consumer",
458 "libupdate_engine_boot_control",
459 "update_metadata-protos",
460
461 // We add the static versions of the shared libraries that are not installed to
462 // recovery image due to size concerns. Need to include all the static library
463 // dependencies of these static libraries.
Yifan Hong126d13e2020-09-21 19:50:06 -0700464 "gkiprops",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700465 "libevent",
466 "libmodpb64",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700467 "libprotobuf-cpp-lite",
468 "libbrillo-stream",
469 "libbrillo",
470 "libchrome",
471 ],
472 target: {
473 recovery: {
474 exclude_shared_libs: [
475 "libprotobuf-cpp-lite",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700476 "libbrillo-stream",
477 "libbrillo",
478 "libchrome",
479 ],
480 },
481 },
482
Tao Bao1e1c86c2019-04-18 10:48:32 -0700483 required: [
Tianjie Xube4ea232019-10-15 18:08:31 -0700484 "otacerts.recovery",
Tao Bao1e1c86c2019-04-18 10:48:32 -0700485 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700486}
487
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700488// update_engine_client (type: executable)
489// ========================================================
490// update_engine console client.
491cc_binary {
492 name: "update_engine_client",
493 defaults: ["ue_defaults"],
494
495 // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved
496 // out of the DBus interface.
497 include_dirs: ["external/cros/system_api/dbus"],
498
499 shared_libs: [
500 "libbinder",
501 "libbinderwrapper",
502 "libbrillo-binder",
503 "libutils",
504 ],
505
506 aidl: {
507 local_include_dirs: ["binder_bindings"],
508 },
509
510 srcs: [
511 ":libupdate_engine_aidl",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700512 "aosp/update_engine_client_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700513 "common/error_code_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700514 "update_status_utils.cc",
515 ],
516}
517
518// libpayload_generator (type: static_library)
519// ========================================================
520// server-side code. This is used for delta_generator and unittests but not
521// for any client code.
522cc_defaults {
523 name: "libpayload_generator_exports",
524 defaults: [
525 "libpayload_consumer_exports",
526 "update_metadata-protos_exports",
527 ],
528
Tianjie37ae8562020-03-25 15:16:01 -0700529 header_libs: [
530 "bootimg_headers",
531 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700532 static_libs: [
533 "libavb",
534 "libbrotli",
535 "libbsdiff",
536 "libdivsufsort",
537 "libdivsufsort64",
538 "liblzma",
539 "libpayload_consumer",
540 "libpuffdiff",
541 "libverity_tree",
542 "update_metadata-protos",
Kelvin Zhangeb8703b2020-12-10 14:17:21 -0500543 "libpayload_extent_utils",
Kelvin Zhangb93055f2021-02-03 14:22:35 -0500544 "libcow_size_estimator",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700545 ],
546 shared_libs: [
547 "libbase",
548 "libext2fs",
549 ],
550}
551
552cc_library_static {
David Andersonc1c93052020-08-26 18:22:09 +0000553 name: "libpayload_extent_ranges",
554 defaults: [
555 "ue_defaults",
556 ],
557 host_supported: true,
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400558 recovery_available: true,
David Andersonc1c93052020-08-26 18:22:09 +0000559 srcs: [
560 "payload_generator/extent_ranges.cc",
561 ],
562 static_libs: [
563 "update_metadata-protos",
564 ],
565}
566
567cc_library_static {
Kelvin Zhangb93055f2021-02-03 14:22:35 -0500568 name: "libcow_size_estimator",
569 defaults: [
570 "ue_defaults",
571 "update_metadata-protos_exports"
572 ],
573 host_supported: true,
574 recovery_available: true,
575 srcs: [
576 "payload_generator/cow_size_estimator.cc",
577 ],
578 static_libs: [
579 "update_metadata-protos",
580 "libbase",
581 "libsnapshot_cow",
582 "libcow_operation_convert",
583 ],
584}
585
586cc_library_static {
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700587 name: "libpayload_generator",
588 defaults: [
589 "ue_defaults",
590 "libpayload_generator_exports",
591 ],
592 host_supported: true,
593
594 srcs: [
Amin Hassani538bd592020-11-04 20:46:08 -0800595 "common/system_state.cc",
596 "download_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700597 "payload_generator/ab_generator.cc",
598 "payload_generator/annotated_operation.cc",
599 "payload_generator/blob_file_writer.cc",
600 "payload_generator/block_mapping.cc",
601 "payload_generator/boot_img_filesystem.cc",
602 "payload_generator/bzip.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700603 "payload_generator/deflate_utils.cc",
604 "payload_generator/delta_diff_generator.cc",
605 "payload_generator/delta_diff_utils.cc",
606 "payload_generator/ext2_filesystem.cc",
607 "payload_generator/extent_ranges.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700608 "payload_generator/full_update_generator.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700609 "payload_generator/mapfile_filesystem.cc",
Tianjiee9156ec2020-08-11 11:13:54 -0700610 "payload_generator/merge_sequence_generator.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700611 "payload_generator/payload_file.cc",
612 "payload_generator/payload_generation_config_android.cc",
613 "payload_generator/payload_generation_config.cc",
Amin Hassani79821002019-05-06 17:40:49 -0700614 "payload_generator/payload_properties.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700615 "payload_generator/payload_signer.cc",
616 "payload_generator/raw_filesystem.cc",
617 "payload_generator/squashfs_filesystem.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700618 "payload_generator/xz_android.cc",
619 ],
620}
621
622// delta_generator (type: executable)
623// ========================================================
624// server-side delta generator.
625cc_binary_host {
626 name: "delta_generator",
627 defaults: [
628 "ue_defaults",
629 "libpayload_generator_exports",
630 "libpayload_consumer_exports",
631 ],
632
633 static_libs: [
634 "libavb_host_sysdeps",
635 "libpayload_consumer",
636 "libpayload_generator",
637 ],
638
639 srcs: ["payload_generator/generate_delta_main.cc"],
640}
641
642cc_test {
643 name: "ue_unittest_delta_generator",
644 defaults: [
645 "ue_defaults",
646 "libpayload_generator_exports",
647 "libpayload_consumer_exports",
648 ],
649
650 static_libs: [
651 "libpayload_consumer",
652 "libpayload_generator",
653 ],
654
655 srcs: ["payload_generator/generate_delta_main.cc"],
656
657 gtest: false,
658 stem: "delta_generator",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700659}
660
661// test_http_server (type: executable)
662// ========================================================
663// Test HTTP Server.
664cc_test {
665 name: "test_http_server",
666 defaults: ["ue_defaults"],
667 srcs: [
668 "common/http_common.cc",
669 "test_http_server.cc",
670 ],
671
672 gtest: false,
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700673}
674
675// test_subprocess (type: executable)
676// ========================================================
677// Test helper subprocess program.
678cc_test {
679 name: "test_subprocess",
680 defaults: ["ue_defaults"],
681 srcs: ["test_subprocess.cc"],
682
683 gtest: false,
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700684}
685
686// Public keys for unittests.
687// ========================================================
688genrule {
689 name: "ue_unittest_keys",
690 cmd: "openssl rsa -in $(location unittest_key.pem) -pubout -out $(location unittest_key.pub.pem) &&" +
xunchangcda3c032019-03-26 15:41:14 -0700691 "openssl rsa -in $(location unittest_key2.pem) -pubout -out $(location unittest_key2.pub.pem) &&" +
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700692 "openssl rsa -in $(location unittest_key_RSA4096.pem) -pubout -out $(location unittest_key_RSA4096.pub.pem) &&" +
693 "openssl pkey -in $(location unittest_key_EC.pem) -pubout -out $(location unittest_key_EC.pub.pem)",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700694 srcs: [
695 "unittest_key.pem",
696 "unittest_key2.pem",
xunchangcda3c032019-03-26 15:41:14 -0700697 "unittest_key_RSA4096.pem",
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700698 "unittest_key_EC.pem",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700699 ],
700 out: [
701 "unittest_key.pub.pem",
702 "unittest_key2.pub.pem",
xunchangcda3c032019-03-26 15:41:14 -0700703 "unittest_key_RSA4096.pub.pem",
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700704 "unittest_key_EC.pub.pem",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700705 ],
706}
707
708// Sample images for unittests.
709// ========================================================
710// Extract sample image from the compressed sample_images.tar.bz2 file used by
711// the unittests.
712genrule {
713 name: "ue_unittest_disk_imgs",
714 cmd: "tar -jxf $(in) -C $(genDir)/gen disk_ext2_1k.img disk_ext2_4k.img disk_ext2_4k_empty.img disk_ext2_unittest.img",
715 srcs: ["sample_images/sample_images.tar.bz2"],
716 out: [
717 "gen/disk_ext2_1k.img",
718 "gen/disk_ext2_4k.img",
719 "gen/disk_ext2_4k_empty.img",
720 "gen/disk_ext2_unittest.img",
721 ],
722}
723
724// update_engine_unittests (type: executable)
725// ========================================================
726// Main unittest file.
727cc_test {
728 name: "update_engine_unittests",
729 defaults: [
730 "ue_defaults",
731 "libpayload_generator_exports",
732 "libupdate_engine_android_exports",
733 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700734
735 static_libs: [
736 "libpayload_generator",
737 "libbrillo-test-helpers",
738 "libgmock",
739 "libchrome_test_helpers",
740 "libupdate_engine_android",
Tianjie Xu173e6192019-12-10 10:56:01 -0800741 "libdm",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700742 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700743
Yifan Hong87ea73f2019-09-12 13:07:37 -0700744 header_libs: [
745 "libstorage_literals_headers",
746 ],
747
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700748 data: [
Tao Bao9456b6f2019-04-29 18:14:58 -0700749 ":test_http_server",
750 ":test_subprocess",
751 ":ue_unittest_delta_generator",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700752 ":ue_unittest_disk_imgs",
753 ":ue_unittest_keys",
Tianjie Xu7a78d632019-10-08 16:32:39 -0700754 "otacerts.zip",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700755 "unittest_key.pem",
756 "unittest_key2.pem",
xunchangcda3c032019-03-26 15:41:14 -0700757 "unittest_key_RSA4096.pem",
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700758 "unittest_key_EC.pem",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700759 "update_engine.conf",
760 ],
761
Tao Bao9456b6f2019-04-29 18:14:58 -0700762 // We cannot use the default generated AndroidTest.xml because of the use of helper modules
763 // (i.e. test_http_server, test_subprocess, ue_unittest_delta_generator).
764 test_config: "test_config.xml",
765 test_suites: ["device-tests"],
766
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700767 srcs: [
Mohammad Samiul Islam24a82792021-02-12 16:52:36 +0000768 "aosp/apex_handler_android_unittest.cc",
Kelvin Zhangb4b95c22021-04-05 15:56:26 -0400769 "aosp/cleanup_previous_update_action_unittest.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700770 "aosp/dynamic_partition_control_android_unittest.cc",
771 "aosp/update_attempter_android_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700772 "certificate_checker_unittest.cc",
773 "common/action_pipe_unittest.cc",
774 "common/action_processor_unittest.cc",
775 "common/action_unittest.cc",
Kelvin Zhangb05e4e22020-09-25 16:16:19 -0400776 "common/cow_operation_convert_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700777 "common/cpu_limiter_unittest.cc",
778 "common/fake_prefs.cc",
779 "common/file_fetcher_unittest.cc",
780 "common/hash_calculator_unittest.cc",
781 "common/http_fetcher_unittest.cc",
782 "common/hwid_override_unittest.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700783 "common/metrics_reporter_stub.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700784 "common/mock_http_fetcher.cc",
785 "common/prefs_unittest.cc",
786 "common/proxy_resolver_unittest.cc",
787 "common/subprocess_unittest.cc",
788 "common/terminator_unittest.cc",
789 "common/test_utils.cc",
790 "common/utils_unittest.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700791 "download_action_android_unittest.cc",
Jae Hoon Kim0ae8fe12019-06-26 14:32:50 -0700792 "libcurl_http_fetcher_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700793 "payload_consumer/bzip_extent_writer_unittest.cc",
794 "payload_consumer/cached_file_descriptor_unittest.cc",
Kelvin Zhang46d6c492021-04-26 17:51:25 -0400795 "payload_consumer/cow_writer_file_descriptor_unittest.cc",
Tianjie Xu7a78d632019-10-08 16:32:39 -0700796 "payload_consumer/certificate_parser_android_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700797 "payload_consumer/delta_performer_integration_test.cc",
798 "payload_consumer/delta_performer_unittest.cc",
Kelvin Zhang9bd519d2020-09-23 12:55:19 -0400799 "payload_consumer/partition_writer_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700800 "payload_consumer/extent_reader_unittest.cc",
801 "payload_consumer/extent_writer_unittest.cc",
Kelvin Zhang9754f172020-09-25 15:22:35 -0400802 "payload_consumer/snapshot_extent_writer_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700803 "payload_consumer/fake_file_descriptor.cc",
804 "payload_consumer/file_descriptor_utils_unittest.cc",
805 "payload_consumer/file_writer_unittest.cc",
806 "payload_consumer/filesystem_verifier_action_unittest.cc",
Amin Hassani23795032020-11-24 14:38:55 -0800807 "payload_consumer/install_plan_unittest.cc",
Tianjie99d570d2020-06-04 14:57:19 -0700808 "payload_consumer/partition_update_generator_android_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700809 "payload_consumer/postinstall_runner_action_unittest.cc",
810 "payload_consumer/verity_writer_android_unittest.cc",
811 "payload_consumer/xz_extent_writer_unittest.cc",
812 "payload_generator/ab_generator_unittest.cc",
813 "payload_generator/blob_file_writer_unittest.cc",
814 "payload_generator/block_mapping_unittest.cc",
815 "payload_generator/boot_img_filesystem_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700816 "payload_generator/deflate_utils_unittest.cc",
817 "payload_generator/delta_diff_utils_unittest.cc",
818 "payload_generator/ext2_filesystem_unittest.cc",
819 "payload_generator/extent_ranges_unittest.cc",
820 "payload_generator/extent_utils_unittest.cc",
821 "payload_generator/fake_filesystem.cc",
822 "payload_generator/full_update_generator_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700823 "payload_generator/mapfile_filesystem_unittest.cc",
Tianjie87af6c02020-08-11 15:06:26 -0700824 "payload_generator/merge_sequence_generator_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700825 "payload_generator/payload_file_unittest.cc",
826 "payload_generator/payload_generation_config_android_unittest.cc",
827 "payload_generator/payload_generation_config_unittest.cc",
Jae Hoon Kim4b6d1262019-06-20 10:41:18 -0700828 "payload_generator/payload_properties_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700829 "payload_generator/payload_signer_unittest.cc",
830 "payload_generator/squashfs_filesystem_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700831 "payload_generator/zip_unittest.cc",
832 "testrunner.cc",
Jae Hoon Kim916af852019-08-01 17:45:30 -0700833 "update_status_utils_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700834 ],
835}
836
837// Brillo update payload generation script
838// ========================================================
Martin Stjernholm18e9f3c2020-09-08 13:56:59 +0100839sh_binary {
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700840 name: "brillo_update_payload",
841 device_supported: false,
842 host_supported: true,
843
Martin Stjernholm18e9f3c2020-09-08 13:56:59 +0100844 src: "scripts/brillo_update_payload",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700845 required: [
846 "delta_generator",
847 "shflags",
848 "simg2img",
849 ],
850
851 target: {
852 darwin: {
853 enabled: false,
854 },
855 },
Colin Cross606913a2017-11-14 13:05:37 -0800856}
Yifan Hongd51738c2020-07-23 17:06:25 -0700857
858// update_engine header library
859cc_library_headers {
860 name: "libupdate_engine_headers",
Yifan Hong309c8a82020-10-06 18:31:08 -0700861
862 // This header library is available to core and product modules.
Justin Yun6d121de2020-11-11 19:31:57 +0900863 product_available: true,
Yifan Hong309c8a82020-10-06 18:31:08 -0700864
Yifan Hongd51738c2020-07-23 17:06:25 -0700865 export_include_dirs: ["."],
866 apex_available: [
867 "com.android.gki.*",
David Anderson5e6dfe32020-09-17 15:50:33 -0700868 "//apex_available:platform",
Yifan Hongd51738c2020-07-23 17:06:25 -0700869 ],
David Andersonc1c93052020-08-26 18:22:09 +0000870 host_supported: true,
David Anderson5e6dfe32020-09-17 15:50:33 -0700871 recovery_available: true,
872 ramdisk_available: true,
873
874 target: {
875 darwin: {
876 enabled: false,
877 },
878 }
Yifan Hongd51738c2020-07-23 17:06:25 -0700879}
Kelvin Zhangb93055f2021-02-03 14:22:35 -0500880
881cc_binary_host {
882 name: "cow_converter",
883 defaults: [
884 "ue_defaults",
885 "libpayload_consumer_exports",
886 ],
887 srcs: [
888 "aosp/cow_converter.cc",
889 ],
890 static_libs: [
891 "liblog",
892 "libbrotli",
893 "libbase",
894 "libcow_operation_convert",
895 "libcow_size_estimator",
896 "libpayload_consumer",
897 "libpayload_extent_ranges",
898 "libpayload_extent_utils",
899 "libsnapshot_cow",
900 "libz",
901 "update_metadata-protos",
902 ],
Elliott Hughes88f3c8c2021-04-22 13:47:21 -0700903}