blob: 81565e9ee35760b1e0f9813fb527098e93184b92 [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",
Kelvin Zhang55624032021-12-20 12:13:24 -0800188 "lz4diff-protos",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700189 ],
190 shared_libs: [
191 "libbase",
192 "libcrypto",
Sen Jiangb5f631d2018-12-18 16:59:57 -0800193 "libfec",
Tianjie99d570d2020-06-04 14:57:19 -0700194 "libziparchive",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700195 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700196}
197
198cc_library_static {
199 name: "libpayload_consumer",
200 defaults: [
201 "ue_defaults",
202 "libpayload_consumer_exports",
203 ],
204 host_supported: true,
205 recovery_available: true,
206
207 srcs: [
Amin Hassaniec7bc112020-10-29 16:47:58 -0700208 "aosp/platform_constants_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700209 "common/action_processor.cc",
210 "common/boot_control_stub.cc",
211 "common/clock.cc",
212 "common/constants.cc",
213 "common/cpu_limiter.cc",
Yifan Hongdaac7322019-11-07 10:48:26 -0800214 "common/dynamic_partition_control_stub.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700215 "common/error_code_utils.cc",
216 "common/file_fetcher.cc",
217 "common/hash_calculator.cc",
218 "common/http_common.cc",
219 "common/http_fetcher.cc",
220 "common/hwid_override.cc",
221 "common/multi_range_http_fetcher.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700222 "common/prefs.cc",
223 "common/proxy_resolver.cc",
224 "common/subprocess.cc",
225 "common/terminator.cc",
226 "common/utils.cc",
227 "payload_consumer/bzip_extent_writer.cc",
228 "payload_consumer/cached_file_descriptor.cc",
Tianjie Xu7a78d632019-10-08 16:32:39 -0700229 "payload_consumer/certificate_parser_android.cc",
Kelvin Zhang569c97e2020-10-26 12:12:24 -0400230 "payload_consumer/cow_writer_file_descriptor.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700231 "payload_consumer/delta_performer.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700232 "payload_consumer/extent_reader.cc",
233 "payload_consumer/extent_writer.cc",
234 "payload_consumer/file_descriptor.cc",
235 "payload_consumer/file_descriptor_utils.cc",
236 "payload_consumer/file_writer.cc",
237 "payload_consumer/filesystem_verifier_action.cc",
Kelvin Zhang40d96662021-02-24 14:21:29 -0500238 "payload_consumer/install_operation_executor.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700239 "payload_consumer/install_plan.cc",
240 "payload_consumer/mount_history.cc",
241 "payload_consumer/payload_constants.cc",
242 "payload_consumer/payload_metadata.cc",
243 "payload_consumer/payload_verifier.cc",
Kelvin Zhang50bac652020-09-28 15:51:41 -0400244 "payload_consumer/partition_writer.cc",
Kelvin Zhang94f51cc2020-09-25 11:34:49 -0400245 "payload_consumer/partition_writer_factory_android.cc",
246 "payload_consumer/vabc_partition_writer.cc",
Kelvin Zhang4bb49202021-07-08 21:39:05 -0400247 "payload_consumer/xor_extent_writer.cc",
Kelvin Zhangb1706762021-06-25 15:05:22 -0400248 "payload_consumer/block_extent_writer.cc",
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400249 "payload_consumer/snapshot_extent_writer.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700250 "payload_consumer/postinstall_runner_action.cc",
Kelvin Zhangab3ce602021-02-24 14:46:40 -0500251 "payload_consumer/verified_source_fd.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700252 "payload_consumer/verity_writer_android.cc",
253 "payload_consumer/xz_extent_writer.cc",
254 "payload_consumer/fec_file_descriptor.cc",
Tianjied3865d12020-06-03 15:25:17 -0700255 "payload_consumer/partition_update_generator_android.cc",
Kelvin Zhangc5803b72021-09-02 09:06:16 -0700256 "update_status_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700257 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700258}
259
260// libupdate_engine_boot_control (type: static_library)
261// ========================================================
262// A BootControl class implementation using Android's HIDL boot_control HAL.
263cc_defaults {
264 name: "libupdate_engine_boot_control_exports",
265 defaults: ["update_metadata-protos_exports"],
266
Yifan Hong420db9b2019-07-23 20:50:33 -0700267 static_libs: [
David Andersone7ce8212019-12-16 20:13:19 -0800268 "libcutils",
269 "libfs_mgr_binder",
270 "libgsi",
Yifan Hongdad0af82020-02-19 17:19:49 -0800271 "libpayload_consumer",
Yifan Hong420db9b2019-07-23 20:50:33 -0700272 "libsnapshot",
David Anderson6c190a22020-09-21 17:09:53 -0700273 "libsnapshot_cow",
274 "libz",
Yifan Hong420db9b2019-07-23 20:50:33 -0700275 "update_metadata-protos",
276 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700277 shared_libs: [
278 "libbootloader_message",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700279 "libhidlbase",
280 "liblp",
Yifan Hongd976cc52020-02-25 14:51:42 -0800281 "libstatslog",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700282 "libutils",
283 "android.hardware.boot@1.0",
David Anderson2111d062019-10-15 22:36:27 -0700284 "android.hardware.boot@1.1",
Kelvin Zhangcb419e62021-06-16 13:56:47 -0400285 "android.hardware.boot@1.2",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700286 ],
Yifan Hong29692902020-03-26 12:47:05 -0700287 header_libs: [
288 "avb_headers",
289 ],
Yifan Hong420db9b2019-07-23 20:50:33 -0700290 target: {
291 recovery: {
David Andersone7ce8212019-12-16 20:13:19 -0800292 static_libs: [
293 "libfs_mgr",
294 "libsnapshot_nobinder",
295 ],
296 exclude_static_libs: [
297 "libfs_mgr_binder",
298 "libsnapshot",
299 ],
Yifan Hong212d7952020-02-04 11:08:08 -0800300 exclude_shared_libs: [
Yifan Hongd976cc52020-02-25 14:51:42 -0800301 "libstatslog",
Yifan Hong212d7952020-02-04 11:08:08 -0800302 ],
Yifan Hong420db9b2019-07-23 20:50:33 -0700303 },
304 },
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700305}
306
307cc_library_static {
308 name: "libupdate_engine_boot_control",
309 defaults: [
310 "ue_defaults",
311 "libupdate_engine_boot_control_exports",
Yifan Hongdad0af82020-02-19 17:19:49 -0800312 "libpayload_consumer_exports",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700313 ],
314 recovery_available: true,
315
316 srcs: [
Amin Hassaniec7bc112020-10-29 16:47:58 -0700317 "aosp/boot_control_android.cc",
318 "aosp/cleanup_previous_update_action.cc",
319 "aosp/dynamic_partition_control_android.cc",
320 "aosp/dynamic_partition_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700321 ],
322}
323
324// libupdate_engine_android (type: static_library)
325// ========================================================
326// The main daemon static_library used in Android (non-Brillo). This only has a
327// loop to apply payloads provided by the upper layer via a Binder interface.
328cc_defaults {
329 name: "libupdate_engine_android_exports",
330 defaults: [
331 "ue_defaults",
332 "libpayload_consumer_exports",
333 "libupdate_engine_boot_control_exports",
334 ],
335
336 static_libs: [
Tianjie838793d2021-01-14 22:05:13 -0800337 "libavb",
338 "libavb_user",
Yifan Hong126d13e2020-09-21 19:50:06 -0700339 "gkiprops",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700340 "libpayload_consumer",
341 "libupdate_engine_boot_control",
Tianjie838793d2021-01-14 22:05:13 -0800342 "PlatformProperties",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700343 ],
344 shared_libs: [
Mohammad Samiul Islam24a82792021-02-12 16:52:36 +0000345 "apex_aidl_interface-cpp",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700346 "libandroid_net",
347 "libbase",
348 "libbinder",
349 "libbinderwrapper",
350 "libbootloader_message",
351 "libbrillo-binder",
352 "libcurl",
353 "libcutils",
Jeongik Cha95f89e92021-01-26 22:33:11 +0900354 "libupdate_engine_stable-V1-cpp",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700355 "liblog",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700356 "libssl",
Tianjie Xu75cc9f22019-08-02 14:53:38 -0700357 "libstatslog",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700358 "libutils",
359 ],
Nikita Ioffeaedfef32021-04-28 13:54:14 +0100360 whole_static_libs: [
361 "com.android.sysprop.apex",
362 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700363}
364
365cc_library_static {
366 name: "libupdate_engine_android",
367 defaults: [
368 "ue_defaults",
369 "libupdate_engine_android_exports",
370 ],
371
372 // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved
373 // out of the DBus interface.
374 include_dirs: ["external/cros/system_api/dbus"],
375
376 aidl: {
377 local_include_dirs: ["binder_bindings"],
378 export_aidl_headers: true,
379 },
380
381 srcs: [
382 ":libupdate_engine_aidl",
Amin Hassani538bd592020-11-04 20:46:08 -0800383 "common/system_state.cc",
Mohammad Samiul Islam24a82792021-02-12 16:52:36 +0000384 "aosp/apex_handler_android.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700385 "aosp/binder_service_android.cc",
386 "aosp/binder_service_stable_android.cc",
387 "aosp/daemon_android.cc",
388 "aosp/daemon_state_android.cc",
389 "aosp/hardware_android.cc",
390 "aosp/logging_android.cc",
391 "aosp/network_selector_android.cc",
392 "aosp/update_attempter_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700393 "certificate_checker.cc",
Amin Hassani538bd592020-11-04 20:46:08 -0800394 "download_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700395 "libcurl_http_fetcher.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700396 "metrics_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700397 "update_boot_flags_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700398 ],
399}
400
401// update_engine (type: executable)
402// ========================================================
403// update_engine daemon.
404cc_binary {
405 name: "update_engine",
406 defaults: [
407 "ue_defaults",
408 "libupdate_engine_android_exports",
409 ],
410
411 static_libs: ["libupdate_engine_android"],
Tao Bao1e1c86c2019-04-18 10:48:32 -0700412 required: [
413 "cacerts_google",
Tianjie Xube4ea232019-10-15 18:08:31 -0700414 "otacerts",
Tao Bao1e1c86c2019-04-18 10:48:32 -0700415 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700416
Amin Hassaniec7bc112020-10-29 16:47:58 -0700417 srcs: ["main.cc", "aosp/metrics_reporter_android.cc"],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700418 init_rc: ["update_engine.rc"],
419}
420
421// update_engine_sideload (type: executable)
422// ========================================================
423// A binary executable equivalent to update_engine daemon that installs an update
424// from a local file directly instead of running in the background. Used in
425// recovery image.
426cc_binary {
427 name: "update_engine_sideload",
428 defaults: [
429 "ue_defaults",
430 "update_metadata-protos_exports",
431 "libupdate_engine_boot_control_exports",
432 "libpayload_consumer_exports",
433 ],
434 recovery: true,
435
436 cflags: ["-D_UE_SIDELOAD"],
437 // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved
438 // out of the DBus interface.
439 include_dirs: ["external/cros/system_api/dbus"],
Elliott Hughes88f3c8c2021-04-22 13:47:21 -0700440 header_libs: ["libgtest_prod_headers"],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700441
442 srcs: [
Amin Hassaniec7bc112020-10-29 16:47:58 -0700443 "aosp/hardware_android.cc",
444 "aosp/logging_android.cc",
445 "aosp/sideload_main.cc",
446 "aosp/update_attempter_android.cc",
447 "common/metrics_reporter_stub.cc",
448 "common/network_selector_stub.cc",
Amin Hassani538bd592020-11-04 20:46:08 -0800449 "common/system_state.cc",
450 "download_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700451 "metrics_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700452 "update_boot_flags_action.cc",
453 "update_status_utils.cc",
454 ],
455
456 // Use commonly used shared libraries. libprotobuf-cpp-lite.so is filtered out,
457 // as it doesn't look beneficial to be installed separately due to its size. Note
458 // that we explicitly request their recovery variants, so that the expected files
459 // will be used and installed.
460 shared_libs: [
461 "libbase",
462 "liblog",
463 ],
464 static_libs: [
465 "libpayload_consumer",
466 "libupdate_engine_boot_control",
467 "update_metadata-protos",
468
469 // We add the static versions of the shared libraries that are not installed to
470 // recovery image due to size concerns. Need to include all the static library
471 // dependencies of these static libraries.
Yifan Hong126d13e2020-09-21 19:50:06 -0700472 "gkiprops",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700473 "libevent",
474 "libmodpb64",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700475 "libprotobuf-cpp-lite",
476 "libbrillo-stream",
477 "libbrillo",
478 "libchrome",
479 ],
480 target: {
481 recovery: {
482 exclude_shared_libs: [
483 "libprotobuf-cpp-lite",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700484 "libbrillo-stream",
485 "libbrillo",
486 "libchrome",
487 ],
488 },
489 },
490
Tao Bao1e1c86c2019-04-18 10:48:32 -0700491 required: [
Tianjie Xube4ea232019-10-15 18:08:31 -0700492 "otacerts.recovery",
Tao Bao1e1c86c2019-04-18 10:48:32 -0700493 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700494}
495
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700496// update_engine_client (type: executable)
497// ========================================================
498// update_engine console client.
499cc_binary {
500 name: "update_engine_client",
501 defaults: ["ue_defaults"],
502
503 // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved
504 // out of the DBus interface.
505 include_dirs: ["external/cros/system_api/dbus"],
506
507 shared_libs: [
508 "libbinder",
509 "libbinderwrapper",
510 "libbrillo-binder",
511 "libutils",
512 ],
513
514 aidl: {
515 local_include_dirs: ["binder_bindings"],
516 },
517
518 srcs: [
519 ":libupdate_engine_aidl",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700520 "aosp/update_engine_client_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700521 "common/error_code_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700522 "update_status_utils.cc",
523 ],
524}
525
526// libpayload_generator (type: static_library)
527// ========================================================
528// server-side code. This is used for delta_generator and unittests but not
529// for any client code.
530cc_defaults {
531 name: "libpayload_generator_exports",
532 defaults: [
533 "libpayload_consumer_exports",
534 "update_metadata-protos_exports",
Kelvin Zhang446989a2021-12-08 13:49:07 -0800535 "erofs-utils_export_defaults",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700536 ],
537
Tianjie37ae8562020-03-25 15:16:01 -0700538 header_libs: [
539 "bootimg_headers",
540 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700541 static_libs: [
542 "libavb",
543 "libbrotli",
544 "libbsdiff",
545 "libdivsufsort",
546 "libdivsufsort64",
547 "liblzma",
548 "libpayload_consumer",
549 "libpuffdiff",
Tianjiea69cfe22021-08-22 23:28:44 -0700550 "libzucchini",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700551 "libverity_tree",
552 "update_metadata-protos",
Kelvin Zhangeb8703b2020-12-10 14:17:21 -0500553 "libpayload_extent_utils",
Kelvin Zhangb93055f2021-02-03 14:22:35 -0500554 "libcow_size_estimator",
Kelvin Zhang446989a2021-12-08 13:49:07 -0800555 "liberofs",
556 "lz4diff-protos",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700557 ],
558 shared_libs: [
559 "libbase",
560 "libext2fs",
Kelvin Zhang446989a2021-12-08 13:49:07 -0800561 // LZ4 has to be a shared lib, as we want to override it with
562 // LD_LIBRARY_PRELOAD later
563 "liblz4",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700564 ],
565}
566
567cc_library_static {
David Andersonc1c93052020-08-26 18:22:09 +0000568 name: "libpayload_extent_ranges",
569 defaults: [
570 "ue_defaults",
571 ],
572 host_supported: true,
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400573 recovery_available: true,
David Andersonc1c93052020-08-26 18:22:09 +0000574 srcs: [
575 "payload_generator/extent_ranges.cc",
576 ],
577 static_libs: [
578 "update_metadata-protos",
579 ],
580}
581
582cc_library_static {
Kelvin Zhangb93055f2021-02-03 14:22:35 -0500583 name: "libcow_size_estimator",
584 defaults: [
585 "ue_defaults",
586 "update_metadata-protos_exports"
587 ],
588 host_supported: true,
589 recovery_available: true,
590 srcs: [
591 "payload_generator/cow_size_estimator.cc",
592 ],
593 static_libs: [
594 "update_metadata-protos",
595 "libbase",
596 "libsnapshot_cow",
597 "libcow_operation_convert",
598 ],
599}
600
601cc_library_static {
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700602 name: "libpayload_generator",
603 defaults: [
604 "ue_defaults",
605 "libpayload_generator_exports",
606 ],
607 host_supported: true,
608
609 srcs: [
Amin Hassani538bd592020-11-04 20:46:08 -0800610 "common/system_state.cc",
611 "download_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700612 "payload_generator/ab_generator.cc",
613 "payload_generator/annotated_operation.cc",
614 "payload_generator/blob_file_writer.cc",
615 "payload_generator/block_mapping.cc",
616 "payload_generator/boot_img_filesystem.cc",
617 "payload_generator/bzip.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700618 "payload_generator/deflate_utils.cc",
619 "payload_generator/delta_diff_generator.cc",
620 "payload_generator/delta_diff_utils.cc",
Kelvin Zhangee481e42021-12-20 12:59:10 -0800621 "lz4diff/lz4diff.cc",
Kelvin Zhang55624032021-12-20 12:13:24 -0800622 "lz4diff/lz4diff_compress.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700623 "payload_generator/ext2_filesystem.cc",
Kelvin Zhang446989a2021-12-08 13:49:07 -0800624 "payload_generator/erofs_filesystem.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700625 "payload_generator/extent_ranges.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700626 "payload_generator/full_update_generator.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700627 "payload_generator/mapfile_filesystem.cc",
Tianjiee9156ec2020-08-11 11:13:54 -0700628 "payload_generator/merge_sequence_generator.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700629 "payload_generator/payload_file.cc",
630 "payload_generator/payload_generation_config_android.cc",
631 "payload_generator/payload_generation_config.cc",
Amin Hassani79821002019-05-06 17:40:49 -0700632 "payload_generator/payload_properties.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700633 "payload_generator/payload_signer.cc",
634 "payload_generator/raw_filesystem.cc",
635 "payload_generator/squashfs_filesystem.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700636 "payload_generator/xz_android.cc",
637 ],
638}
639
640// delta_generator (type: executable)
641// ========================================================
642// server-side delta generator.
643cc_binary_host {
644 name: "delta_generator",
645 defaults: [
646 "ue_defaults",
647 "libpayload_generator_exports",
648 "libpayload_consumer_exports",
649 ],
650
651 static_libs: [
652 "libavb_host_sysdeps",
653 "libpayload_consumer",
654 "libpayload_generator",
655 ],
656
657 srcs: ["payload_generator/generate_delta_main.cc"],
658}
659
660cc_test {
Kelvin Zhangc5803b72021-09-02 09:06:16 -0700661 host_supported: true,
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700662 name: "ue_unittest_delta_generator",
663 defaults: [
664 "ue_defaults",
665 "libpayload_generator_exports",
666 "libpayload_consumer_exports",
667 ],
668
669 static_libs: [
670 "libpayload_consumer",
671 "libpayload_generator",
672 ],
673
674 srcs: ["payload_generator/generate_delta_main.cc"],
675
676 gtest: false,
677 stem: "delta_generator",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700678}
679
680// test_http_server (type: executable)
681// ========================================================
682// Test HTTP Server.
683cc_test {
684 name: "test_http_server",
685 defaults: ["ue_defaults"],
686 srcs: [
687 "common/http_common.cc",
688 "test_http_server.cc",
689 ],
690
691 gtest: false,
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700692}
693
694// test_subprocess (type: executable)
695// ========================================================
696// Test helper subprocess program.
697cc_test {
698 name: "test_subprocess",
699 defaults: ["ue_defaults"],
700 srcs: ["test_subprocess.cc"],
701
702 gtest: false,
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700703}
704
705// Public keys for unittests.
706// ========================================================
707genrule {
708 name: "ue_unittest_keys",
709 cmd: "openssl rsa -in $(location unittest_key.pem) -pubout -out $(location unittest_key.pub.pem) &&" +
xunchangcda3c032019-03-26 15:41:14 -0700710 "openssl rsa -in $(location unittest_key2.pem) -pubout -out $(location unittest_key2.pub.pem) &&" +
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700711 "openssl rsa -in $(location unittest_key_RSA4096.pem) -pubout -out $(location unittest_key_RSA4096.pub.pem) &&" +
712 "openssl pkey -in $(location unittest_key_EC.pem) -pubout -out $(location unittest_key_EC.pub.pem)",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700713 srcs: [
714 "unittest_key.pem",
715 "unittest_key2.pem",
xunchangcda3c032019-03-26 15:41:14 -0700716 "unittest_key_RSA4096.pem",
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700717 "unittest_key_EC.pem",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700718 ],
719 out: [
720 "unittest_key.pub.pem",
721 "unittest_key2.pub.pem",
xunchangcda3c032019-03-26 15:41:14 -0700722 "unittest_key_RSA4096.pub.pem",
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700723 "unittest_key_EC.pub.pem",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700724 ],
725}
726
727// Sample images for unittests.
728// ========================================================
729// Extract sample image from the compressed sample_images.tar.bz2 file used by
730// the unittests.
731genrule {
732 name: "ue_unittest_disk_imgs",
733 cmd: "tar -jxf $(in) -C $(genDir)/gen disk_ext2_1k.img disk_ext2_4k.img disk_ext2_4k_empty.img disk_ext2_unittest.img",
734 srcs: ["sample_images/sample_images.tar.bz2"],
735 out: [
736 "gen/disk_ext2_1k.img",
737 "gen/disk_ext2_4k.img",
738 "gen/disk_ext2_4k_empty.img",
739 "gen/disk_ext2_unittest.img",
740 ],
741}
742
Kelvin Zhang759e8b92021-12-21 16:46:58 -0800743genrule {
744 name: "ue_unittest_erofs_imgs",
745 cmd: "$(in) $(location mkfs.erofs) $(location gen/erofs_empty.img) &&" +
746 "$(in) $(location mkfs.erofs) $(location gen/erofs.img) $(location delta_generator)",
747 srcs: ["sample_images/generate_test_erofs_images.sh"],
748 out: [
749 "gen/erofs.img",
750 "gen/erofs_empty.img",
751 ],
752 tools: [
753 "mkfs.erofs",
754 "delta_generator",
755 ],
756}
757
Kelvin Zhangc5803b72021-09-02 09:06:16 -0700758filegroup {
759 name: "update_engine_host_unittest_srcs",
760 srcs: [
761 "common/action_pipe_unittest.cc",
762 "common/action_processor_unittest.cc",
763 "common/action_unittest.cc",
764 "common/cow_operation_convert_unittest.cc",
765 "common/cpu_limiter_unittest.cc",
766 "common/fake_prefs.cc",
767 "common/file_fetcher_unittest.cc",
768 "common/hash_calculator_unittest.cc",
769 "common/hwid_override_unittest.cc",
770 "common/metrics_reporter_stub.cc",
771 "common/mock_http_fetcher.cc",
772 "common/prefs_unittest.cc",
773 "common/terminator_unittest.cc",
774 "common/test_utils.cc",
Kelvin Zhang55624032021-12-20 12:13:24 -0800775 "lz4diff/lz4diff_compress_unittest.cc",
Kelvin Zhangc5803b72021-09-02 09:06:16 -0700776 "payload_generator/ab_generator_unittest.cc",
777 "payload_generator/blob_file_writer_unittest.cc",
778 "payload_generator/block_mapping_unittest.cc",
779 "payload_generator/boot_img_filesystem_unittest.cc",
780 "payload_generator/deflate_utils_unittest.cc",
781 "payload_generator/delta_diff_utils_unittest.cc",
Kelvin Zhang759e8b92021-12-21 16:46:58 -0800782 "payload_generator/erofs_filesystem_unittest.cc",
Kelvin Zhangc5803b72021-09-02 09:06:16 -0700783 "payload_generator/ext2_filesystem_unittest.cc",
784 "payload_generator/extent_ranges_unittest.cc",
785 "payload_generator/extent_utils_unittest.cc",
786 "payload_generator/fake_filesystem.cc",
787 "payload_generator/full_update_generator_unittest.cc",
788 "payload_generator/mapfile_filesystem_unittest.cc",
789 "payload_generator/merge_sequence_generator_unittest.cc",
790 "payload_generator/payload_file_unittest.cc",
791 "payload_generator/payload_generation_config_android_unittest.cc",
792 "payload_generator/payload_generation_config_unittest.cc",
793 "payload_generator/payload_properties_unittest.cc",
794 "payload_generator/payload_signer_unittest.cc",
795 "payload_generator/squashfs_filesystem_unittest.cc",
796 "payload_generator/zip_unittest.cc",
797 "testrunner.cc",
798 ],
799}
800
801cc_test_host {
802 name: "update_engine_host_unittests",
803 defaults: [
804 "ue_defaults",
805 "libpayload_generator_exports",
806 ],
807 strip: {
808 none: true,
809 },
810 cflags: [
811 "-g3",
812 ],
813 srcs: [":update_engine_host_unittest_srcs"],
814 data: [
815 ":ue_unittest_delta_generator",
816 ":ue_unittest_disk_imgs",
Kelvin Zhang759e8b92021-12-21 16:46:58 -0800817 ":ue_unittest_erofs_imgs",
Kelvin Zhangc5803b72021-09-02 09:06:16 -0700818 ":ue_unittest_keys",
819 "otacerts.zip",
820 "unittest_key.pem",
821 "unittest_key2.pem",
822 "unittest_key_RSA4096.pem",
823 "unittest_key_EC.pem",
824 "update_engine.conf",
825 ],
826 static_libs: [
827 "libcurl",
828 "libgmock",
829 "libpayload_generator",
830 ],
831}
832
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700833// update_engine_unittests (type: executable)
834// ========================================================
835// Main unittest file.
836cc_test {
837 name: "update_engine_unittests",
838 defaults: [
839 "ue_defaults",
840 "libpayload_generator_exports",
841 "libupdate_engine_android_exports",
842 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700843
844 static_libs: [
845 "libpayload_generator",
846 "libbrillo-test-helpers",
847 "libgmock",
848 "libchrome_test_helpers",
849 "libupdate_engine_android",
Tianjie Xu173e6192019-12-10 10:56:01 -0800850 "libdm",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700851 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700852
Yifan Hong87ea73f2019-09-12 13:07:37 -0700853 header_libs: [
854 "libstorage_literals_headers",
855 ],
856
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700857 data: [
Tao Bao9456b6f2019-04-29 18:14:58 -0700858 ":test_http_server",
859 ":test_subprocess",
860 ":ue_unittest_delta_generator",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700861 ":ue_unittest_disk_imgs",
Kelvin Zhang759e8b92021-12-21 16:46:58 -0800862 ":ue_unittest_erofs_imgs",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700863 ":ue_unittest_keys",
Tianjie Xu7a78d632019-10-08 16:32:39 -0700864 "otacerts.zip",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700865 "unittest_key.pem",
866 "unittest_key2.pem",
xunchangcda3c032019-03-26 15:41:14 -0700867 "unittest_key_RSA4096.pem",
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700868 "unittest_key_EC.pem",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700869 "update_engine.conf",
870 ],
871
Tao Bao9456b6f2019-04-29 18:14:58 -0700872 // We cannot use the default generated AndroidTest.xml because of the use of helper modules
873 // (i.e. test_http_server, test_subprocess, ue_unittest_delta_generator).
874 test_config: "test_config.xml",
875 test_suites: ["device-tests"],
876
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700877 srcs: [
Kelvin Zhangc5803b72021-09-02 09:06:16 -0700878 ":update_engine_host_unittest_srcs",
Mohammad Samiul Islam24a82792021-02-12 16:52:36 +0000879 "aosp/apex_handler_android_unittest.cc",
Kelvin Zhangb4b95c22021-04-05 15:56:26 -0400880 "aosp/cleanup_previous_update_action_unittest.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700881 "aosp/dynamic_partition_control_android_unittest.cc",
Kelvin Zhang3fe49642021-10-04 15:35:02 -0700882 "aosp/update_attempter_android_integration_test.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700883 "aosp/update_attempter_android_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700884 "certificate_checker_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700885 "common/http_fetcher_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700886 "common/proxy_resolver_unittest.cc",
887 "common/subprocess_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700888 "common/utils_unittest.cc",
Kelvin Zhang4e93cf12021-09-13 16:03:24 -0700889 "download_action_android_unittest.cc",
890 "libcurl_http_fetcher_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700891 "payload_consumer/bzip_extent_writer_unittest.cc",
892 "payload_consumer/cached_file_descriptor_unittest.cc",
Kelvin Zhang46d6c492021-04-26 17:51:25 -0400893 "payload_consumer/cow_writer_file_descriptor_unittest.cc",
Tianjie Xu7a78d632019-10-08 16:32:39 -0700894 "payload_consumer/certificate_parser_android_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700895 "payload_consumer/delta_performer_integration_test.cc",
896 "payload_consumer/delta_performer_unittest.cc",
897 "payload_consumer/extent_reader_unittest.cc",
898 "payload_consumer/extent_writer_unittest.cc",
Kelvin Zhangc5803b72021-09-02 09:06:16 -0700899 "payload_consumer/extent_map_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700900 "payload_consumer/fake_file_descriptor.cc",
901 "payload_consumer/file_descriptor_utils_unittest.cc",
902 "payload_consumer/file_writer_unittest.cc",
903 "payload_consumer/filesystem_verifier_action_unittest.cc",
Amin Hassani23795032020-11-24 14:38:55 -0800904 "payload_consumer/install_plan_unittest.cc",
Kelvin Zhang40d96662021-02-24 14:21:29 -0500905 "payload_consumer/install_operation_executor_unittest.cc",
Tianjie99d570d2020-06-04 14:57:19 -0700906 "payload_consumer/partition_update_generator_android_unittest.cc",
Kelvin Zhang4e93cf12021-09-13 16:03:24 -0700907 "payload_consumer/partition_writer_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700908 "payload_consumer/postinstall_runner_action_unittest.cc",
Kelvin Zhang4e93cf12021-09-13 16:03:24 -0700909 "payload_consumer/snapshot_extent_writer_unittest.cc",
910 "payload_consumer/vabc_partition_writer_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700911 "payload_consumer/verity_writer_android_unittest.cc",
Kelvin Zhang4e93cf12021-09-13 16:03:24 -0700912 "payload_consumer/xor_extent_writer_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700913 "payload_consumer/xz_extent_writer_unittest.cc",
Jae Hoon Kim916af852019-08-01 17:45:30 -0700914 "update_status_utils_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700915 ],
916}
917
918// Brillo update payload generation script
919// ========================================================
Martin Stjernholm18e9f3c2020-09-08 13:56:59 +0100920sh_binary {
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700921 name: "brillo_update_payload",
922 device_supported: false,
923 host_supported: true,
924
Martin Stjernholm18e9f3c2020-09-08 13:56:59 +0100925 src: "scripts/brillo_update_payload",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700926 required: [
927 "delta_generator",
928 "shflags",
929 "simg2img",
930 ],
931
932 target: {
933 darwin: {
934 enabled: false,
935 },
936 },
Colin Cross606913a2017-11-14 13:05:37 -0800937}
Yifan Hongd51738c2020-07-23 17:06:25 -0700938
939// update_engine header library
940cc_library_headers {
941 name: "libupdate_engine_headers",
Yifan Hong309c8a82020-10-06 18:31:08 -0700942
943 // This header library is available to core and product modules.
Justin Yun6d121de2020-11-11 19:31:57 +0900944 product_available: true,
Yifan Hong309c8a82020-10-06 18:31:08 -0700945
Yifan Hongd51738c2020-07-23 17:06:25 -0700946 export_include_dirs: ["."],
947 apex_available: [
948 "com.android.gki.*",
David Anderson5e6dfe32020-09-17 15:50:33 -0700949 "//apex_available:platform",
Yifan Hongd51738c2020-07-23 17:06:25 -0700950 ],
David Andersonc1c93052020-08-26 18:22:09 +0000951 host_supported: true,
David Anderson5e6dfe32020-09-17 15:50:33 -0700952 recovery_available: true,
953 ramdisk_available: true,
954
955 target: {
956 darwin: {
957 enabled: false,
958 },
959 }
Yifan Hongd51738c2020-07-23 17:06:25 -0700960}
Kelvin Zhangb93055f2021-02-03 14:22:35 -0500961
962cc_binary_host {
963 name: "cow_converter",
964 defaults: [
965 "ue_defaults",
966 "libpayload_consumer_exports",
967 ],
968 srcs: [
969 "aosp/cow_converter.cc",
970 ],
971 static_libs: [
972 "liblog",
973 "libbrotli",
974 "libbase",
975 "libcow_operation_convert",
976 "libcow_size_estimator",
977 "libpayload_consumer",
978 "libpayload_extent_ranges",
979 "libpayload_extent_utils",
980 "libsnapshot_cow",
981 "libz",
982 "update_metadata-protos",
983 ],
Elliott Hughes88f3c8c2021-04-22 13:47:21 -0700984}
Kelvin Zhang98001b22021-12-08 14:10:11 -0800985
986cc_library_static {
987 name: "lz4diff-protos",
988 host_supported: true,
989 ramdisk_available: true,
990 recovery_available: true,
991
992 srcs: ["lz4diff/lz4diff.proto"],
993 cflags: [
994 "-Wall",
995 "-Werror",
996 ],
997 proto: {
998 canonical_path_from_root: false,
999 export_proto_headers: true,
1000 },
1001}