blob: bc178bc5fc0fdf4a70370fc23108ed3d6741378f [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"],
69 static_libs: ["libgtest_prod"],
70 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",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700227 "payload_consumer/delta_performer.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700228 "payload_consumer/extent_reader.cc",
229 "payload_consumer/extent_writer.cc",
230 "payload_consumer/file_descriptor.cc",
231 "payload_consumer/file_descriptor_utils.cc",
232 "payload_consumer/file_writer.cc",
233 "payload_consumer/filesystem_verifier_action.cc",
234 "payload_consumer/install_plan.cc",
235 "payload_consumer/mount_history.cc",
236 "payload_consumer/payload_constants.cc",
237 "payload_consumer/payload_metadata.cc",
238 "payload_consumer/payload_verifier.cc",
Kelvin Zhang50bac652020-09-28 15:51:41 -0400239 "payload_consumer/partition_writer.cc",
Kelvin Zhang94f51cc2020-09-25 11:34:49 -0400240 "payload_consumer/partition_writer_factory_android.cc",
241 "payload_consumer/vabc_partition_writer.cc",
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400242 "payload_consumer/snapshot_extent_writer.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700243 "payload_consumer/postinstall_runner_action.cc",
244 "payload_consumer/verity_writer_android.cc",
245 "payload_consumer/xz_extent_writer.cc",
246 "payload_consumer/fec_file_descriptor.cc",
Tianjied3865d12020-06-03 15:25:17 -0700247 "payload_consumer/partition_update_generator_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700248 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700249}
250
251// libupdate_engine_boot_control (type: static_library)
252// ========================================================
253// A BootControl class implementation using Android's HIDL boot_control HAL.
254cc_defaults {
255 name: "libupdate_engine_boot_control_exports",
256 defaults: ["update_metadata-protos_exports"],
257
Yifan Hong420db9b2019-07-23 20:50:33 -0700258 static_libs: [
David Andersone7ce8212019-12-16 20:13:19 -0800259 "libcutils",
260 "libfs_mgr_binder",
261 "libgsi",
Yifan Hongdad0af82020-02-19 17:19:49 -0800262 "libpayload_consumer",
Yifan Hong420db9b2019-07-23 20:50:33 -0700263 "libsnapshot",
David Anderson6c190a22020-09-21 17:09:53 -0700264 "libsnapshot_cow",
265 "libz",
Yifan Hong420db9b2019-07-23 20:50:33 -0700266 "update_metadata-protos",
267 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700268 shared_libs: [
269 "libbootloader_message",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700270 "libhidlbase",
271 "liblp",
Yifan Hongd976cc52020-02-25 14:51:42 -0800272 "libstatslog",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700273 "libutils",
274 "android.hardware.boot@1.0",
David Anderson2111d062019-10-15 22:36:27 -0700275 "android.hardware.boot@1.1",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700276 ],
Yifan Hong29692902020-03-26 12:47:05 -0700277 header_libs: [
278 "avb_headers",
279 ],
Yifan Hong420db9b2019-07-23 20:50:33 -0700280 target: {
281 recovery: {
David Andersone7ce8212019-12-16 20:13:19 -0800282 static_libs: [
283 "libfs_mgr",
284 "libsnapshot_nobinder",
285 ],
286 exclude_static_libs: [
287 "libfs_mgr_binder",
288 "libsnapshot",
289 ],
Yifan Hong212d7952020-02-04 11:08:08 -0800290 exclude_shared_libs: [
Yifan Hongd976cc52020-02-25 14:51:42 -0800291 "libstatslog",
Yifan Hong212d7952020-02-04 11:08:08 -0800292 ],
Yifan Hong420db9b2019-07-23 20:50:33 -0700293 },
294 },
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700295}
296
297cc_library_static {
298 name: "libupdate_engine_boot_control",
299 defaults: [
300 "ue_defaults",
301 "libupdate_engine_boot_control_exports",
Yifan Hongdad0af82020-02-19 17:19:49 -0800302 "libpayload_consumer_exports",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700303 ],
304 recovery_available: true,
305
306 srcs: [
Amin Hassaniec7bc112020-10-29 16:47:58 -0700307 "aosp/boot_control_android.cc",
308 "aosp/cleanup_previous_update_action.cc",
309 "aosp/dynamic_partition_control_android.cc",
310 "aosp/dynamic_partition_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700311 ],
312}
313
314// libupdate_engine_android (type: static_library)
315// ========================================================
316// The main daemon static_library used in Android (non-Brillo). This only has a
317// loop to apply payloads provided by the upper layer via a Binder interface.
318cc_defaults {
319 name: "libupdate_engine_android_exports",
320 defaults: [
321 "ue_defaults",
322 "libpayload_consumer_exports",
323 "libupdate_engine_boot_control_exports",
324 ],
325
326 static_libs: [
Tianjie838793d2021-01-14 22:05:13 -0800327 "libavb",
328 "libavb_user",
Yifan Hong126d13e2020-09-21 19:50:06 -0700329 "gkiprops",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700330 "libpayload_consumer",
331 "libupdate_engine_boot_control",
Tianjie838793d2021-01-14 22:05:13 -0800332 "PlatformProperties",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700333 ],
334 shared_libs: [
Mohammad Samiul Islam24a82792021-02-12 16:52:36 +0000335 "apex_aidl_interface-cpp",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700336 "libandroid_net",
337 "libbase",
338 "libbinder",
339 "libbinderwrapper",
340 "libbootloader_message",
341 "libbrillo-binder",
342 "libcurl",
343 "libcutils",
Jeongik Cha95f89e92021-01-26 22:33:11 +0900344 "libupdate_engine_stable-V1-cpp",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700345 "liblog",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700346 "libssl",
Tianjie Xu75cc9f22019-08-02 14:53:38 -0700347 "libstatslog",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700348 "libutils",
349 ],
350}
351
352cc_library_static {
353 name: "libupdate_engine_android",
354 defaults: [
355 "ue_defaults",
356 "libupdate_engine_android_exports",
357 ],
358
359 // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved
360 // out of the DBus interface.
361 include_dirs: ["external/cros/system_api/dbus"],
362
363 aidl: {
364 local_include_dirs: ["binder_bindings"],
365 export_aidl_headers: true,
366 },
367
368 srcs: [
369 ":libupdate_engine_aidl",
Amin Hassani538bd592020-11-04 20:46:08 -0800370 "common/system_state.cc",
Mohammad Samiul Islam24a82792021-02-12 16:52:36 +0000371 "aosp/apex_handler_android.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700372 "aosp/binder_service_android.cc",
373 "aosp/binder_service_stable_android.cc",
374 "aosp/daemon_android.cc",
375 "aosp/daemon_state_android.cc",
376 "aosp/hardware_android.cc",
377 "aosp/logging_android.cc",
378 "aosp/network_selector_android.cc",
379 "aosp/update_attempter_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700380 "certificate_checker.cc",
Amin Hassani538bd592020-11-04 20:46:08 -0800381 "download_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700382 "libcurl_http_fetcher.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700383 "metrics_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700384 "update_boot_flags_action.cc",
385 "update_status_utils.cc",
386 ],
387}
388
389// update_engine (type: executable)
390// ========================================================
391// update_engine daemon.
392cc_binary {
393 name: "update_engine",
394 defaults: [
395 "ue_defaults",
396 "libupdate_engine_android_exports",
397 ],
398
399 static_libs: ["libupdate_engine_android"],
Tao Bao1e1c86c2019-04-18 10:48:32 -0700400 required: [
401 "cacerts_google",
Tianjie Xube4ea232019-10-15 18:08:31 -0700402 "otacerts",
Tao Bao1e1c86c2019-04-18 10:48:32 -0700403 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700404
Amin Hassaniec7bc112020-10-29 16:47:58 -0700405 srcs: ["main.cc", "aosp/metrics_reporter_android.cc"],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700406 init_rc: ["update_engine.rc"],
407}
408
409// update_engine_sideload (type: executable)
410// ========================================================
411// A binary executable equivalent to update_engine daemon that installs an update
412// from a local file directly instead of running in the background. Used in
413// recovery image.
414cc_binary {
415 name: "update_engine_sideload",
416 defaults: [
417 "ue_defaults",
418 "update_metadata-protos_exports",
419 "libupdate_engine_boot_control_exports",
420 "libpayload_consumer_exports",
421 ],
422 recovery: true,
423
424 cflags: ["-D_UE_SIDELOAD"],
425 // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved
426 // out of the DBus interface.
427 include_dirs: ["external/cros/system_api/dbus"],
428
429 srcs: [
Amin Hassaniec7bc112020-10-29 16:47:58 -0700430 "aosp/hardware_android.cc",
431 "aosp/logging_android.cc",
432 "aosp/sideload_main.cc",
433 "aosp/update_attempter_android.cc",
434 "common/metrics_reporter_stub.cc",
435 "common/network_selector_stub.cc",
Amin Hassani538bd592020-11-04 20:46:08 -0800436 "common/system_state.cc",
437 "download_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700438 "metrics_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700439 "update_boot_flags_action.cc",
440 "update_status_utils.cc",
441 ],
442
443 // Use commonly used shared libraries. libprotobuf-cpp-lite.so is filtered out,
444 // as it doesn't look beneficial to be installed separately due to its size. Note
445 // that we explicitly request their recovery variants, so that the expected files
446 // will be used and installed.
447 shared_libs: [
448 "libbase",
449 "liblog",
450 ],
451 static_libs: [
452 "libpayload_consumer",
453 "libupdate_engine_boot_control",
454 "update_metadata-protos",
455
456 // We add the static versions of the shared libraries that are not installed to
457 // recovery image due to size concerns. Need to include all the static library
458 // dependencies of these static libraries.
Yifan Hong126d13e2020-09-21 19:50:06 -0700459 "gkiprops",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700460 "libevent",
461 "libmodpb64",
462 "libgtest_prod",
463 "libprotobuf-cpp-lite",
464 "libbrillo-stream",
465 "libbrillo",
466 "libchrome",
467 ],
468 target: {
469 recovery: {
470 exclude_shared_libs: [
471 "libprotobuf-cpp-lite",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700472 "libbrillo-stream",
473 "libbrillo",
474 "libchrome",
475 ],
476 },
477 },
478
Tao Bao1e1c86c2019-04-18 10:48:32 -0700479 required: [
Tianjie Xube4ea232019-10-15 18:08:31 -0700480 "otacerts.recovery",
Tao Bao1e1c86c2019-04-18 10:48:32 -0700481 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700482}
483
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700484// update_engine_client (type: executable)
485// ========================================================
486// update_engine console client.
487cc_binary {
488 name: "update_engine_client",
489 defaults: ["ue_defaults"],
490
491 // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved
492 // out of the DBus interface.
493 include_dirs: ["external/cros/system_api/dbus"],
494
495 shared_libs: [
496 "libbinder",
497 "libbinderwrapper",
498 "libbrillo-binder",
499 "libutils",
500 ],
501
502 aidl: {
503 local_include_dirs: ["binder_bindings"],
504 },
505
506 srcs: [
507 ":libupdate_engine_aidl",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700508 "aosp/update_engine_client_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700509 "common/error_code_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700510 "update_status_utils.cc",
511 ],
512}
513
514// libpayload_generator (type: static_library)
515// ========================================================
516// server-side code. This is used for delta_generator and unittests but not
517// for any client code.
518cc_defaults {
519 name: "libpayload_generator_exports",
520 defaults: [
521 "libpayload_consumer_exports",
522 "update_metadata-protos_exports",
523 ],
524
Tianjie37ae8562020-03-25 15:16:01 -0700525 header_libs: [
526 "bootimg_headers",
527 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700528 static_libs: [
529 "libavb",
530 "libbrotli",
531 "libbsdiff",
532 "libdivsufsort",
533 "libdivsufsort64",
534 "liblzma",
535 "libpayload_consumer",
536 "libpuffdiff",
537 "libverity_tree",
538 "update_metadata-protos",
Kelvin Zhangeb8703b2020-12-10 14:17:21 -0500539 "libpayload_extent_utils",
Kelvin Zhangb93055f2021-02-03 14:22:35 -0500540 "libcow_size_estimator",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700541 ],
542 shared_libs: [
543 "libbase",
544 "libext2fs",
545 ],
546}
547
548cc_library_static {
David Andersonc1c93052020-08-26 18:22:09 +0000549 name: "libpayload_extent_ranges",
550 defaults: [
551 "ue_defaults",
552 ],
553 host_supported: true,
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400554 recovery_available: true,
David Andersonc1c93052020-08-26 18:22:09 +0000555 srcs: [
556 "payload_generator/extent_ranges.cc",
557 ],
558 static_libs: [
559 "update_metadata-protos",
560 ],
561}
562
563cc_library_static {
Kelvin Zhangb93055f2021-02-03 14:22:35 -0500564 name: "libcow_size_estimator",
565 defaults: [
566 "ue_defaults",
567 "update_metadata-protos_exports"
568 ],
569 host_supported: true,
570 recovery_available: true,
571 srcs: [
572 "payload_generator/cow_size_estimator.cc",
573 ],
574 static_libs: [
575 "update_metadata-protos",
576 "libbase",
577 "libsnapshot_cow",
578 "libcow_operation_convert",
579 ],
580}
581
582cc_library_static {
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700583 name: "libpayload_generator",
584 defaults: [
585 "ue_defaults",
586 "libpayload_generator_exports",
587 ],
588 host_supported: true,
589
590 srcs: [
Amin Hassani538bd592020-11-04 20:46:08 -0800591 "common/system_state.cc",
592 "download_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700593 "payload_generator/ab_generator.cc",
594 "payload_generator/annotated_operation.cc",
595 "payload_generator/blob_file_writer.cc",
596 "payload_generator/block_mapping.cc",
597 "payload_generator/boot_img_filesystem.cc",
598 "payload_generator/bzip.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700599 "payload_generator/deflate_utils.cc",
600 "payload_generator/delta_diff_generator.cc",
601 "payload_generator/delta_diff_utils.cc",
602 "payload_generator/ext2_filesystem.cc",
603 "payload_generator/extent_ranges.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700604 "payload_generator/full_update_generator.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700605 "payload_generator/mapfile_filesystem.cc",
Tianjiee9156ec2020-08-11 11:13:54 -0700606 "payload_generator/merge_sequence_generator.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700607 "payload_generator/payload_file.cc",
608 "payload_generator/payload_generation_config_android.cc",
609 "payload_generator/payload_generation_config.cc",
Amin Hassani79821002019-05-06 17:40:49 -0700610 "payload_generator/payload_properties.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700611 "payload_generator/payload_signer.cc",
612 "payload_generator/raw_filesystem.cc",
613 "payload_generator/squashfs_filesystem.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700614 "payload_generator/xz_android.cc",
615 ],
616}
617
618// delta_generator (type: executable)
619// ========================================================
620// server-side delta generator.
621cc_binary_host {
622 name: "delta_generator",
623 defaults: [
624 "ue_defaults",
625 "libpayload_generator_exports",
626 "libpayload_consumer_exports",
627 ],
628
629 static_libs: [
630 "libavb_host_sysdeps",
631 "libpayload_consumer",
632 "libpayload_generator",
633 ],
634
635 srcs: ["payload_generator/generate_delta_main.cc"],
636}
637
638cc_test {
639 name: "ue_unittest_delta_generator",
640 defaults: [
641 "ue_defaults",
642 "libpayload_generator_exports",
643 "libpayload_consumer_exports",
644 ],
645
646 static_libs: [
647 "libpayload_consumer",
648 "libpayload_generator",
649 ],
650
651 srcs: ["payload_generator/generate_delta_main.cc"],
652
653 gtest: false,
654 stem: "delta_generator",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700655}
656
657// test_http_server (type: executable)
658// ========================================================
659// Test HTTP Server.
660cc_test {
661 name: "test_http_server",
662 defaults: ["ue_defaults"],
663 srcs: [
664 "common/http_common.cc",
665 "test_http_server.cc",
666 ],
667
668 gtest: false,
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700669}
670
671// test_subprocess (type: executable)
672// ========================================================
673// Test helper subprocess program.
674cc_test {
675 name: "test_subprocess",
676 defaults: ["ue_defaults"],
677 srcs: ["test_subprocess.cc"],
678
679 gtest: false,
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700680}
681
682// Public keys for unittests.
683// ========================================================
684genrule {
685 name: "ue_unittest_keys",
686 cmd: "openssl rsa -in $(location unittest_key.pem) -pubout -out $(location unittest_key.pub.pem) &&" +
xunchangcda3c032019-03-26 15:41:14 -0700687 "openssl rsa -in $(location unittest_key2.pem) -pubout -out $(location unittest_key2.pub.pem) &&" +
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700688 "openssl rsa -in $(location unittest_key_RSA4096.pem) -pubout -out $(location unittest_key_RSA4096.pub.pem) &&" +
689 "openssl pkey -in $(location unittest_key_EC.pem) -pubout -out $(location unittest_key_EC.pub.pem)",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700690 srcs: [
691 "unittest_key.pem",
692 "unittest_key2.pem",
xunchangcda3c032019-03-26 15:41:14 -0700693 "unittest_key_RSA4096.pem",
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700694 "unittest_key_EC.pem",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700695 ],
696 out: [
697 "unittest_key.pub.pem",
698 "unittest_key2.pub.pem",
xunchangcda3c032019-03-26 15:41:14 -0700699 "unittest_key_RSA4096.pub.pem",
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700700 "unittest_key_EC.pub.pem",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700701 ],
702}
703
704// Sample images for unittests.
705// ========================================================
706// Extract sample image from the compressed sample_images.tar.bz2 file used by
707// the unittests.
708genrule {
709 name: "ue_unittest_disk_imgs",
710 cmd: "tar -jxf $(in) -C $(genDir)/gen disk_ext2_1k.img disk_ext2_4k.img disk_ext2_4k_empty.img disk_ext2_unittest.img",
711 srcs: ["sample_images/sample_images.tar.bz2"],
712 out: [
713 "gen/disk_ext2_1k.img",
714 "gen/disk_ext2_4k.img",
715 "gen/disk_ext2_4k_empty.img",
716 "gen/disk_ext2_unittest.img",
717 ],
718}
719
720// update_engine_unittests (type: executable)
721// ========================================================
722// Main unittest file.
723cc_test {
724 name: "update_engine_unittests",
725 defaults: [
726 "ue_defaults",
727 "libpayload_generator_exports",
728 "libupdate_engine_android_exports",
729 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700730
731 static_libs: [
732 "libpayload_generator",
733 "libbrillo-test-helpers",
734 "libgmock",
735 "libchrome_test_helpers",
736 "libupdate_engine_android",
Tianjie Xu173e6192019-12-10 10:56:01 -0800737 "libdm",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700738 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700739
Yifan Hong87ea73f2019-09-12 13:07:37 -0700740 header_libs: [
741 "libstorage_literals_headers",
742 ],
743
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700744 data: [
Tao Bao9456b6f2019-04-29 18:14:58 -0700745 ":test_http_server",
746 ":test_subprocess",
747 ":ue_unittest_delta_generator",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700748 ":ue_unittest_disk_imgs",
749 ":ue_unittest_keys",
Tianjie Xu7a78d632019-10-08 16:32:39 -0700750 "otacerts.zip",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700751 "unittest_key.pem",
752 "unittest_key2.pem",
xunchangcda3c032019-03-26 15:41:14 -0700753 "unittest_key_RSA4096.pem",
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700754 "unittest_key_EC.pem",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700755 "update_engine.conf",
756 ],
757
Tao Bao9456b6f2019-04-29 18:14:58 -0700758 // We cannot use the default generated AndroidTest.xml because of the use of helper modules
759 // (i.e. test_http_server, test_subprocess, ue_unittest_delta_generator).
760 test_config: "test_config.xml",
761 test_suites: ["device-tests"],
762
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700763 srcs: [
Mohammad Samiul Islam24a82792021-02-12 16:52:36 +0000764 "aosp/apex_handler_android_unittest.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700765 "aosp/dynamic_partition_control_android_unittest.cc",
766 "aosp/update_attempter_android_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700767 "certificate_checker_unittest.cc",
768 "common/action_pipe_unittest.cc",
769 "common/action_processor_unittest.cc",
770 "common/action_unittest.cc",
Kelvin Zhangb05e4e22020-09-25 16:16:19 -0400771 "common/cow_operation_convert_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700772 "common/cpu_limiter_unittest.cc",
773 "common/fake_prefs.cc",
774 "common/file_fetcher_unittest.cc",
775 "common/hash_calculator_unittest.cc",
776 "common/http_fetcher_unittest.cc",
777 "common/hwid_override_unittest.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700778 "common/metrics_reporter_stub.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700779 "common/mock_http_fetcher.cc",
780 "common/prefs_unittest.cc",
781 "common/proxy_resolver_unittest.cc",
782 "common/subprocess_unittest.cc",
783 "common/terminator_unittest.cc",
784 "common/test_utils.cc",
785 "common/utils_unittest.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700786 "download_action_android_unittest.cc",
Jae Hoon Kim0ae8fe12019-06-26 14:32:50 -0700787 "libcurl_http_fetcher_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700788 "payload_consumer/bzip_extent_writer_unittest.cc",
789 "payload_consumer/cached_file_descriptor_unittest.cc",
Tianjie Xu7a78d632019-10-08 16:32:39 -0700790 "payload_consumer/certificate_parser_android_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700791 "payload_consumer/delta_performer_integration_test.cc",
792 "payload_consumer/delta_performer_unittest.cc",
Kelvin Zhang9bd519d2020-09-23 12:55:19 -0400793 "payload_consumer/partition_writer_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700794 "payload_consumer/extent_reader_unittest.cc",
795 "payload_consumer/extent_writer_unittest.cc",
Kelvin Zhang9754f172020-09-25 15:22:35 -0400796 "payload_consumer/snapshot_extent_writer_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700797 "payload_consumer/fake_file_descriptor.cc",
798 "payload_consumer/file_descriptor_utils_unittest.cc",
799 "payload_consumer/file_writer_unittest.cc",
800 "payload_consumer/filesystem_verifier_action_unittest.cc",
Amin Hassani23795032020-11-24 14:38:55 -0800801 "payload_consumer/install_plan_unittest.cc",
Tianjie99d570d2020-06-04 14:57:19 -0700802 "payload_consumer/partition_update_generator_android_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700803 "payload_consumer/postinstall_runner_action_unittest.cc",
804 "payload_consumer/verity_writer_android_unittest.cc",
805 "payload_consumer/xz_extent_writer_unittest.cc",
806 "payload_generator/ab_generator_unittest.cc",
807 "payload_generator/blob_file_writer_unittest.cc",
808 "payload_generator/block_mapping_unittest.cc",
809 "payload_generator/boot_img_filesystem_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700810 "payload_generator/deflate_utils_unittest.cc",
811 "payload_generator/delta_diff_utils_unittest.cc",
812 "payload_generator/ext2_filesystem_unittest.cc",
813 "payload_generator/extent_ranges_unittest.cc",
814 "payload_generator/extent_utils_unittest.cc",
815 "payload_generator/fake_filesystem.cc",
816 "payload_generator/full_update_generator_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700817 "payload_generator/mapfile_filesystem_unittest.cc",
Tianjie87af6c02020-08-11 15:06:26 -0700818 "payload_generator/merge_sequence_generator_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700819 "payload_generator/payload_file_unittest.cc",
820 "payload_generator/payload_generation_config_android_unittest.cc",
821 "payload_generator/payload_generation_config_unittest.cc",
Jae Hoon Kim4b6d1262019-06-20 10:41:18 -0700822 "payload_generator/payload_properties_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700823 "payload_generator/payload_signer_unittest.cc",
824 "payload_generator/squashfs_filesystem_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700825 "payload_generator/zip_unittest.cc",
826 "testrunner.cc",
Jae Hoon Kim916af852019-08-01 17:45:30 -0700827 "update_status_utils_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700828 ],
829}
830
831// Brillo update payload generation script
832// ========================================================
Martin Stjernholm18e9f3c2020-09-08 13:56:59 +0100833sh_binary {
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700834 name: "brillo_update_payload",
835 device_supported: false,
836 host_supported: true,
837
Martin Stjernholm18e9f3c2020-09-08 13:56:59 +0100838 src: "scripts/brillo_update_payload",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700839 required: [
840 "delta_generator",
841 "shflags",
842 "simg2img",
843 ],
844
845 target: {
846 darwin: {
847 enabled: false,
848 },
849 },
Colin Cross606913a2017-11-14 13:05:37 -0800850}
Yifan Hongd51738c2020-07-23 17:06:25 -0700851
852// update_engine header library
853cc_library_headers {
854 name: "libupdate_engine_headers",
Yifan Hong309c8a82020-10-06 18:31:08 -0700855
856 // This header library is available to core and product modules.
Justin Yun6d121de2020-11-11 19:31:57 +0900857 product_available: true,
Yifan Hong309c8a82020-10-06 18:31:08 -0700858
Yifan Hongd51738c2020-07-23 17:06:25 -0700859 export_include_dirs: ["."],
860 apex_available: [
861 "com.android.gki.*",
David Anderson5e6dfe32020-09-17 15:50:33 -0700862 "//apex_available:platform",
Yifan Hongd51738c2020-07-23 17:06:25 -0700863 ],
David Andersonc1c93052020-08-26 18:22:09 +0000864 host_supported: true,
David Anderson5e6dfe32020-09-17 15:50:33 -0700865 recovery_available: true,
866 ramdisk_available: true,
867
868 target: {
869 darwin: {
870 enabled: false,
871 },
872 }
Yifan Hongd51738c2020-07-23 17:06:25 -0700873}
Kelvin Zhangb93055f2021-02-03 14:22:35 -0500874
875cc_binary_host {
876 name: "cow_converter",
877 defaults: [
878 "ue_defaults",
879 "libpayload_consumer_exports",
880 ],
881 srcs: [
882 "aosp/cow_converter.cc",
883 ],
884 static_libs: [
885 "liblog",
886 "libbrotli",
887 "libbase",
888 "libcow_operation_convert",
889 "libcow_size_estimator",
890 "libpayload_consumer",
891 "libpayload_extent_ranges",
892 "libpayload_extent_utils",
893 "libsnapshot_cow",
894 "libz",
895 "update_metadata-protos",
896 ],
897}