blob: 020fd6e6c07b68adfc35d41bfcf2b6885b23073f [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
18filegroup {
19 name: "libupdate_engine_aidl",
20 srcs: [
21 "binder_bindings/android/os/IUpdateEngine.aidl",
22 "binder_bindings/android/os/IUpdateEngineCallback.aidl",
23 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -070024 path: "binder_bindings",
25}
26
27cc_defaults {
28 name: "ue_defaults",
29
30 cflags: [
Amin Hassani2e4eda52019-01-07 14:01:17 -080031 "-DBASE_VER=576279",
Dan Willemsenf5a904e2018-10-23 01:02:44 -070032 "-DUSE_HWID_OVERRIDE=0",
Dan Willemsenf5a904e2018-10-23 01:02:44 -070033 "-D_FILE_OFFSET_BITS=64",
34 "-D_POSIX_C_SOURCE=199309L",
35 "-Wa,--noexecstack",
36 "-Wall",
37 "-Werror",
38 "-Wextra",
39 "-Wformat=2",
40 "-Wno-psabi",
41 "-Wno-unused-parameter",
42 "-ffunction-sections",
43 "-fstack-protector-strong",
44 "-fvisibility=hidden",
45 ],
46 cppflags: [
47 "-Wnon-virtual-dtor",
48 "-fno-strict-aliasing",
49 ],
50 include_dirs: ["system"],
51 local_include_dirs: ["client_library/include"],
52 static_libs: ["libgtest_prod"],
53 shared_libs: [
54 "libbrillo-stream",
55 "libbrillo",
56 "libchrome",
57 ],
58 ldflags: ["-Wl,--gc-sections"],
59
60 product_variables: {
61 pdk: {
62 enabled: false,
63 },
64 },
65
66 target: {
Sen Jiangb5f631d2018-12-18 16:59:57 -080067 android: {
68 cflags: [
69 "-DUSE_FEC=1",
70 ],
71 },
72 host: {
73 cflags: [
74 "-DUSE_FEC=0",
75 ],
76 },
Dan Willemsenf5a904e2018-10-23 01:02:44 -070077 darwin: {
78 enabled: false,
79 },
80 },
81}
82
Kelvin Zhang9b10dba2020-09-25 17:09:11 -040083// libcow_operation_convert (type: library)
84// ========================================================
Kelvin Zhangeb8703b2020-12-10 14:17:21 -050085cc_library_static {
86 name: "libpayload_extent_utils",
87 defaults: [
88 "ue_defaults",
89 ],
90 host_supported: true,
91 recovery_available: true,
92 srcs: [
93 "payload_generator/extent_utils.cc",
94 ],
95 static_libs: [
96 "update_metadata-protos",
97 ],
98}
99
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400100cc_library {
101 name: "libcow_operation_convert",
102 host_supported: true,
103 recovery_available: true,
104 defaults: [
105 "ue_defaults",
106 "update_metadata-protos_exports",
107 ],
108 srcs: [
109 "common/cow_operation_convert.cc",
110 ],
111 static_libs: [
112 "libsnapshot_cow",
113 "update_metadata-protos",
114 "libpayload_extent_ranges",
Kelvin Zhangeb8703b2020-12-10 14:17:21 -0500115 "libpayload_extent_utils",
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400116 "libbrotli",
117 "libz",
118 ],
119}
120
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700121// update_metadata-protos (type: static_library)
122// ========================================================
123// Protobufs.
124cc_defaults {
125 name: "update_metadata-protos_exports",
126
127 shared_libs: ["libprotobuf-cpp-lite"],
128}
129
130cc_library_static {
131 name: "update_metadata-protos",
132 host_supported: true,
133 recovery_available: true,
134
135 srcs: ["update_engine/update_metadata.proto"],
136 cflags: [
137 "-Wall",
138 "-Werror",
139 ],
140 proto: {
141 canonical_path_from_root: false,
142 export_proto_headers: true,
143 },
144}
145
146// libpayload_consumer (type: static_library)
147// ========================================================
148// The payload application component and common dependencies.
149cc_defaults {
150 name: "libpayload_consumer_exports",
151 defaults: ["update_metadata-protos_exports"],
152
153 static_libs: [
154 "update_metadata-protos",
155 "libxz",
156 "libbz",
157 "libbspatch",
158 "libbrotli",
Tianjie99d570d2020-06-04 14:57:19 -0700159 "libc++fs",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700160 "libfec_rs",
161 "libpuffpatch",
162 "libverity_tree",
Kelvin Zhang94f51cc2020-09-25 11:34:49 -0400163 "libsnapshot_cow",
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400164 "libbrotli",
165 "libz",
166 "libpayload_extent_ranges",
Kelvin Zhangeb8703b2020-12-10 14:17:21 -0500167 "libpayload_extent_utils",
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400168 "libcow_operation_convert",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700169 ],
170 shared_libs: [
171 "libbase",
172 "libcrypto",
Sen Jiangb5f631d2018-12-18 16:59:57 -0800173 "libfec",
Tianjie99d570d2020-06-04 14:57:19 -0700174 "libziparchive",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700175 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700176}
177
178cc_library_static {
179 name: "libpayload_consumer",
180 defaults: [
181 "ue_defaults",
182 "libpayload_consumer_exports",
183 ],
184 host_supported: true,
185 recovery_available: true,
186
187 srcs: [
Amin Hassaniec7bc112020-10-29 16:47:58 -0700188 "aosp/platform_constants_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700189 "common/action_processor.cc",
190 "common/boot_control_stub.cc",
191 "common/clock.cc",
192 "common/constants.cc",
193 "common/cpu_limiter.cc",
Yifan Hongdaac7322019-11-07 10:48:26 -0800194 "common/dynamic_partition_control_stub.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700195 "common/error_code_utils.cc",
196 "common/file_fetcher.cc",
197 "common/hash_calculator.cc",
198 "common/http_common.cc",
199 "common/http_fetcher.cc",
200 "common/hwid_override.cc",
201 "common/multi_range_http_fetcher.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700202 "common/prefs.cc",
203 "common/proxy_resolver.cc",
204 "common/subprocess.cc",
205 "common/terminator.cc",
206 "common/utils.cc",
207 "payload_consumer/bzip_extent_writer.cc",
208 "payload_consumer/cached_file_descriptor.cc",
Tianjie Xu7a78d632019-10-08 16:32:39 -0700209 "payload_consumer/certificate_parser_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700210 "payload_consumer/delta_performer.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700211 "payload_consumer/extent_reader.cc",
212 "payload_consumer/extent_writer.cc",
213 "payload_consumer/file_descriptor.cc",
214 "payload_consumer/file_descriptor_utils.cc",
215 "payload_consumer/file_writer.cc",
216 "payload_consumer/filesystem_verifier_action.cc",
217 "payload_consumer/install_plan.cc",
218 "payload_consumer/mount_history.cc",
219 "payload_consumer/payload_constants.cc",
220 "payload_consumer/payload_metadata.cc",
221 "payload_consumer/payload_verifier.cc",
Kelvin Zhang50bac652020-09-28 15:51:41 -0400222 "payload_consumer/partition_writer.cc",
Kelvin Zhang94f51cc2020-09-25 11:34:49 -0400223 "payload_consumer/partition_writer_factory_android.cc",
224 "payload_consumer/vabc_partition_writer.cc",
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400225 "payload_consumer/snapshot_extent_writer.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700226 "payload_consumer/postinstall_runner_action.cc",
227 "payload_consumer/verity_writer_android.cc",
228 "payload_consumer/xz_extent_writer.cc",
229 "payload_consumer/fec_file_descriptor.cc",
Tianjied3865d12020-06-03 15:25:17 -0700230 "payload_consumer/partition_update_generator_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700231 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700232}
233
234// libupdate_engine_boot_control (type: static_library)
235// ========================================================
236// A BootControl class implementation using Android's HIDL boot_control HAL.
237cc_defaults {
238 name: "libupdate_engine_boot_control_exports",
239 defaults: ["update_metadata-protos_exports"],
240
Yifan Hong420db9b2019-07-23 20:50:33 -0700241 static_libs: [
David Andersone7ce8212019-12-16 20:13:19 -0800242 "libcutils",
243 "libfs_mgr_binder",
244 "libgsi",
Yifan Hongdad0af82020-02-19 17:19:49 -0800245 "libpayload_consumer",
Yifan Hong420db9b2019-07-23 20:50:33 -0700246 "libsnapshot",
David Anderson6c190a22020-09-21 17:09:53 -0700247 "libsnapshot_cow",
248 "libz",
Yifan Hong420db9b2019-07-23 20:50:33 -0700249 "update_metadata-protos",
250 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700251 shared_libs: [
252 "libbootloader_message",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700253 "libhidlbase",
254 "liblp",
Yifan Hongd976cc52020-02-25 14:51:42 -0800255 "libstatslog",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700256 "libutils",
257 "android.hardware.boot@1.0",
David Anderson2111d062019-10-15 22:36:27 -0700258 "android.hardware.boot@1.1",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700259 ],
Yifan Hong29692902020-03-26 12:47:05 -0700260 header_libs: [
261 "avb_headers",
262 ],
Yifan Hong420db9b2019-07-23 20:50:33 -0700263 target: {
264 recovery: {
David Andersone7ce8212019-12-16 20:13:19 -0800265 static_libs: [
266 "libfs_mgr",
267 "libsnapshot_nobinder",
268 ],
269 exclude_static_libs: [
270 "libfs_mgr_binder",
271 "libsnapshot",
272 ],
Yifan Hong212d7952020-02-04 11:08:08 -0800273 exclude_shared_libs: [
Yifan Hongd976cc52020-02-25 14:51:42 -0800274 "libstatslog",
Yifan Hong212d7952020-02-04 11:08:08 -0800275 ],
Yifan Hong420db9b2019-07-23 20:50:33 -0700276 },
277 },
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700278}
279
280cc_library_static {
281 name: "libupdate_engine_boot_control",
282 defaults: [
283 "ue_defaults",
284 "libupdate_engine_boot_control_exports",
Yifan Hongdad0af82020-02-19 17:19:49 -0800285 "libpayload_consumer_exports",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700286 ],
287 recovery_available: true,
288
289 srcs: [
Amin Hassaniec7bc112020-10-29 16:47:58 -0700290 "aosp/boot_control_android.cc",
291 "aosp/cleanup_previous_update_action.cc",
292 "aosp/dynamic_partition_control_android.cc",
293 "aosp/dynamic_partition_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700294 ],
295}
296
297// libupdate_engine_android (type: static_library)
298// ========================================================
299// The main daemon static_library used in Android (non-Brillo). This only has a
300// loop to apply payloads provided by the upper layer via a Binder interface.
301cc_defaults {
302 name: "libupdate_engine_android_exports",
303 defaults: [
304 "ue_defaults",
305 "libpayload_consumer_exports",
306 "libupdate_engine_boot_control_exports",
307 ],
308
309 static_libs: [
Yifan Hong126d13e2020-09-21 19:50:06 -0700310 "gkiprops",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700311 "libpayload_consumer",
312 "libupdate_engine_boot_control",
313 ],
314 shared_libs: [
315 "libandroid_net",
316 "libbase",
317 "libbinder",
318 "libbinderwrapper",
319 "libbootloader_message",
320 "libbrillo-binder",
321 "libcurl",
322 "libcutils",
Yifan Hong2562cf22020-07-21 19:28:44 -0700323 "libupdate_engine_stable-cpp",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700324 "liblog",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700325 "libssl",
Tianjie Xu75cc9f22019-08-02 14:53:38 -0700326 "libstatslog",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700327 "libutils",
328 ],
329}
330
331cc_library_static {
332 name: "libupdate_engine_android",
333 defaults: [
334 "ue_defaults",
335 "libupdate_engine_android_exports",
336 ],
337
338 // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved
339 // out of the DBus interface.
340 include_dirs: ["external/cros/system_api/dbus"],
341
342 aidl: {
343 local_include_dirs: ["binder_bindings"],
344 export_aidl_headers: true,
345 },
346
347 srcs: [
348 ":libupdate_engine_aidl",
Amin Hassani538bd592020-11-04 20:46:08 -0800349 "common/system_state.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700350 "aosp/binder_service_android.cc",
351 "aosp/binder_service_stable_android.cc",
352 "aosp/daemon_android.cc",
353 "aosp/daemon_state_android.cc",
354 "aosp/hardware_android.cc",
355 "aosp/logging_android.cc",
356 "aosp/network_selector_android.cc",
357 "aosp/update_attempter_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700358 "certificate_checker.cc",
Amin Hassani538bd592020-11-04 20:46:08 -0800359 "download_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700360 "libcurl_http_fetcher.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700361 "metrics_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700362 "update_boot_flags_action.cc",
363 "update_status_utils.cc",
364 ],
365}
366
367// update_engine (type: executable)
368// ========================================================
369// update_engine daemon.
370cc_binary {
371 name: "update_engine",
372 defaults: [
373 "ue_defaults",
374 "libupdate_engine_android_exports",
375 ],
376
377 static_libs: ["libupdate_engine_android"],
Tao Bao1e1c86c2019-04-18 10:48:32 -0700378 required: [
379 "cacerts_google",
Tianjie Xube4ea232019-10-15 18:08:31 -0700380 "otacerts",
Tao Bao1e1c86c2019-04-18 10:48:32 -0700381 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700382
Amin Hassaniec7bc112020-10-29 16:47:58 -0700383 srcs: ["main.cc", "aosp/metrics_reporter_android.cc"],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700384 init_rc: ["update_engine.rc"],
385}
386
387// update_engine_sideload (type: executable)
388// ========================================================
389// A binary executable equivalent to update_engine daemon that installs an update
390// from a local file directly instead of running in the background. Used in
391// recovery image.
392cc_binary {
393 name: "update_engine_sideload",
394 defaults: [
395 "ue_defaults",
396 "update_metadata-protos_exports",
397 "libupdate_engine_boot_control_exports",
398 "libpayload_consumer_exports",
399 ],
400 recovery: true,
401
402 cflags: ["-D_UE_SIDELOAD"],
403 // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved
404 // out of the DBus interface.
405 include_dirs: ["external/cros/system_api/dbus"],
406
407 srcs: [
Amin Hassaniec7bc112020-10-29 16:47:58 -0700408 "aosp/hardware_android.cc",
409 "aosp/logging_android.cc",
410 "aosp/sideload_main.cc",
411 "aosp/update_attempter_android.cc",
412 "common/metrics_reporter_stub.cc",
413 "common/network_selector_stub.cc",
Amin Hassani538bd592020-11-04 20:46:08 -0800414 "common/system_state.cc",
415 "download_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700416 "metrics_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700417 "update_boot_flags_action.cc",
418 "update_status_utils.cc",
419 ],
420
421 // Use commonly used shared libraries. libprotobuf-cpp-lite.so is filtered out,
422 // as it doesn't look beneficial to be installed separately due to its size. Note
423 // that we explicitly request their recovery variants, so that the expected files
424 // will be used and installed.
425 shared_libs: [
426 "libbase",
427 "liblog",
428 ],
429 static_libs: [
430 "libpayload_consumer",
431 "libupdate_engine_boot_control",
432 "update_metadata-protos",
433
434 // We add the static versions of the shared libraries that are not installed to
435 // recovery image due to size concerns. Need to include all the static library
436 // dependencies of these static libraries.
Yifan Hong126d13e2020-09-21 19:50:06 -0700437 "gkiprops",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700438 "libevent",
439 "libmodpb64",
440 "libgtest_prod",
441 "libprotobuf-cpp-lite",
442 "libbrillo-stream",
443 "libbrillo",
444 "libchrome",
445 ],
446 target: {
447 recovery: {
448 exclude_shared_libs: [
449 "libprotobuf-cpp-lite",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700450 "libbrillo-stream",
451 "libbrillo",
452 "libchrome",
453 ],
454 },
455 },
456
Tao Bao1e1c86c2019-04-18 10:48:32 -0700457 required: [
Tianjie Xube4ea232019-10-15 18:08:31 -0700458 "otacerts.recovery",
Tao Bao1e1c86c2019-04-18 10:48:32 -0700459 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700460}
461
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700462// update_engine_client (type: executable)
463// ========================================================
464// update_engine console client.
465cc_binary {
466 name: "update_engine_client",
467 defaults: ["ue_defaults"],
468
469 // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved
470 // out of the DBus interface.
471 include_dirs: ["external/cros/system_api/dbus"],
472
473 shared_libs: [
474 "libbinder",
475 "libbinderwrapper",
476 "libbrillo-binder",
477 "libutils",
478 ],
479
480 aidl: {
481 local_include_dirs: ["binder_bindings"],
482 },
483
484 srcs: [
485 ":libupdate_engine_aidl",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700486 "aosp/update_engine_client_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700487 "common/error_code_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700488 "update_status_utils.cc",
489 ],
490}
491
492// libpayload_generator (type: static_library)
493// ========================================================
494// server-side code. This is used for delta_generator and unittests but not
495// for any client code.
496cc_defaults {
497 name: "libpayload_generator_exports",
498 defaults: [
499 "libpayload_consumer_exports",
500 "update_metadata-protos_exports",
501 ],
502
Tianjie37ae8562020-03-25 15:16:01 -0700503 header_libs: [
504 "bootimg_headers",
505 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700506 static_libs: [
507 "libavb",
508 "libbrotli",
509 "libbsdiff",
510 "libdivsufsort",
511 "libdivsufsort64",
512 "liblzma",
513 "libpayload_consumer",
514 "libpuffdiff",
515 "libverity_tree",
516 "update_metadata-protos",
Kelvin Zhangeb8703b2020-12-10 14:17:21 -0500517 "libpayload_extent_utils",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700518 ],
519 shared_libs: [
520 "libbase",
521 "libext2fs",
522 ],
523}
524
525cc_library_static {
David Andersonc1c93052020-08-26 18:22:09 +0000526 name: "libpayload_extent_ranges",
527 defaults: [
528 "ue_defaults",
529 ],
530 host_supported: true,
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400531 recovery_available: true,
David Andersonc1c93052020-08-26 18:22:09 +0000532 srcs: [
533 "payload_generator/extent_ranges.cc",
534 ],
535 static_libs: [
536 "update_metadata-protos",
537 ],
538}
539
540cc_library_static {
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700541 name: "libpayload_generator",
542 defaults: [
543 "ue_defaults",
544 "libpayload_generator_exports",
545 ],
546 host_supported: true,
547
548 srcs: [
Amin Hassani538bd592020-11-04 20:46:08 -0800549 "common/system_state.cc",
550 "download_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700551 "payload_generator/ab_generator.cc",
552 "payload_generator/annotated_operation.cc",
553 "payload_generator/blob_file_writer.cc",
554 "payload_generator/block_mapping.cc",
555 "payload_generator/boot_img_filesystem.cc",
556 "payload_generator/bzip.cc",
Kelvin Zhang7a265752020-10-29 15:51:35 -0400557 "payload_generator/cow_size_estimator.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700558 "payload_generator/deflate_utils.cc",
559 "payload_generator/delta_diff_generator.cc",
560 "payload_generator/delta_diff_utils.cc",
561 "payload_generator/ext2_filesystem.cc",
562 "payload_generator/extent_ranges.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700563 "payload_generator/full_update_generator.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700564 "payload_generator/mapfile_filesystem.cc",
Tianjiee9156ec2020-08-11 11:13:54 -0700565 "payload_generator/merge_sequence_generator.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700566 "payload_generator/payload_file.cc",
567 "payload_generator/payload_generation_config_android.cc",
568 "payload_generator/payload_generation_config.cc",
Amin Hassani79821002019-05-06 17:40:49 -0700569 "payload_generator/payload_properties.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700570 "payload_generator/payload_signer.cc",
571 "payload_generator/raw_filesystem.cc",
572 "payload_generator/squashfs_filesystem.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700573 "payload_generator/xz_android.cc",
574 ],
575}
576
577// delta_generator (type: executable)
578// ========================================================
579// server-side delta generator.
580cc_binary_host {
581 name: "delta_generator",
582 defaults: [
583 "ue_defaults",
584 "libpayload_generator_exports",
585 "libpayload_consumer_exports",
586 ],
587
588 static_libs: [
589 "libavb_host_sysdeps",
590 "libpayload_consumer",
591 "libpayload_generator",
592 ],
593
594 srcs: ["payload_generator/generate_delta_main.cc"],
595}
596
597cc_test {
598 name: "ue_unittest_delta_generator",
599 defaults: [
600 "ue_defaults",
601 "libpayload_generator_exports",
602 "libpayload_consumer_exports",
603 ],
604
605 static_libs: [
606 "libpayload_consumer",
607 "libpayload_generator",
608 ],
609
610 srcs: ["payload_generator/generate_delta_main.cc"],
611
612 gtest: false,
613 stem: "delta_generator",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700614}
615
616// test_http_server (type: executable)
617// ========================================================
618// Test HTTP Server.
619cc_test {
620 name: "test_http_server",
621 defaults: ["ue_defaults"],
622 srcs: [
623 "common/http_common.cc",
624 "test_http_server.cc",
625 ],
626
627 gtest: false,
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700628}
629
630// test_subprocess (type: executable)
631// ========================================================
632// Test helper subprocess program.
633cc_test {
634 name: "test_subprocess",
635 defaults: ["ue_defaults"],
636 srcs: ["test_subprocess.cc"],
637
638 gtest: false,
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700639}
640
641// Public keys for unittests.
642// ========================================================
643genrule {
644 name: "ue_unittest_keys",
645 cmd: "openssl rsa -in $(location unittest_key.pem) -pubout -out $(location unittest_key.pub.pem) &&" +
xunchangcda3c032019-03-26 15:41:14 -0700646 "openssl rsa -in $(location unittest_key2.pem) -pubout -out $(location unittest_key2.pub.pem) &&" +
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700647 "openssl rsa -in $(location unittest_key_RSA4096.pem) -pubout -out $(location unittest_key_RSA4096.pub.pem) &&" +
648 "openssl pkey -in $(location unittest_key_EC.pem) -pubout -out $(location unittest_key_EC.pub.pem)",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700649 srcs: [
650 "unittest_key.pem",
651 "unittest_key2.pem",
xunchangcda3c032019-03-26 15:41:14 -0700652 "unittest_key_RSA4096.pem",
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700653 "unittest_key_EC.pem",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700654 ],
655 out: [
656 "unittest_key.pub.pem",
657 "unittest_key2.pub.pem",
xunchangcda3c032019-03-26 15:41:14 -0700658 "unittest_key_RSA4096.pub.pem",
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700659 "unittest_key_EC.pub.pem",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700660 ],
661}
662
663// Sample images for unittests.
664// ========================================================
665// Extract sample image from the compressed sample_images.tar.bz2 file used by
666// the unittests.
667genrule {
668 name: "ue_unittest_disk_imgs",
669 cmd: "tar -jxf $(in) -C $(genDir)/gen disk_ext2_1k.img disk_ext2_4k.img disk_ext2_4k_empty.img disk_ext2_unittest.img",
670 srcs: ["sample_images/sample_images.tar.bz2"],
671 out: [
672 "gen/disk_ext2_1k.img",
673 "gen/disk_ext2_4k.img",
674 "gen/disk_ext2_4k_empty.img",
675 "gen/disk_ext2_unittest.img",
676 ],
677}
678
679// update_engine_unittests (type: executable)
680// ========================================================
681// Main unittest file.
682cc_test {
683 name: "update_engine_unittests",
684 defaults: [
685 "ue_defaults",
686 "libpayload_generator_exports",
687 "libupdate_engine_android_exports",
688 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700689
690 static_libs: [
691 "libpayload_generator",
692 "libbrillo-test-helpers",
693 "libgmock",
694 "libchrome_test_helpers",
695 "libupdate_engine_android",
Tianjie Xu173e6192019-12-10 10:56:01 -0800696 "libdm",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700697 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700698
Yifan Hong87ea73f2019-09-12 13:07:37 -0700699 header_libs: [
700 "libstorage_literals_headers",
701 ],
702
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700703 data: [
Tao Bao9456b6f2019-04-29 18:14:58 -0700704 ":test_http_server",
705 ":test_subprocess",
706 ":ue_unittest_delta_generator",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700707 ":ue_unittest_disk_imgs",
708 ":ue_unittest_keys",
Tianjie Xu7a78d632019-10-08 16:32:39 -0700709 "otacerts.zip",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700710 "unittest_key.pem",
711 "unittest_key2.pem",
xunchangcda3c032019-03-26 15:41:14 -0700712 "unittest_key_RSA4096.pem",
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700713 "unittest_key_EC.pem",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700714 "update_engine.conf",
715 ],
716
Tao Bao9456b6f2019-04-29 18:14:58 -0700717 // We cannot use the default generated AndroidTest.xml because of the use of helper modules
718 // (i.e. test_http_server, test_subprocess, ue_unittest_delta_generator).
719 test_config: "test_config.xml",
720 test_suites: ["device-tests"],
721
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700722 srcs: [
Amin Hassaniec7bc112020-10-29 16:47:58 -0700723 "aosp/dynamic_partition_control_android_unittest.cc",
724 "aosp/update_attempter_android_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700725 "certificate_checker_unittest.cc",
726 "common/action_pipe_unittest.cc",
727 "common/action_processor_unittest.cc",
728 "common/action_unittest.cc",
Kelvin Zhangb05e4e22020-09-25 16:16:19 -0400729 "common/cow_operation_convert_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700730 "common/cpu_limiter_unittest.cc",
731 "common/fake_prefs.cc",
732 "common/file_fetcher_unittest.cc",
733 "common/hash_calculator_unittest.cc",
734 "common/http_fetcher_unittest.cc",
735 "common/hwid_override_unittest.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700736 "common/metrics_reporter_stub.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700737 "common/mock_http_fetcher.cc",
738 "common/prefs_unittest.cc",
739 "common/proxy_resolver_unittest.cc",
740 "common/subprocess_unittest.cc",
741 "common/terminator_unittest.cc",
742 "common/test_utils.cc",
743 "common/utils_unittest.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700744 "download_action_android_unittest.cc",
Jae Hoon Kim0ae8fe12019-06-26 14:32:50 -0700745 "libcurl_http_fetcher_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700746 "payload_consumer/bzip_extent_writer_unittest.cc",
747 "payload_consumer/cached_file_descriptor_unittest.cc",
Tianjie Xu7a78d632019-10-08 16:32:39 -0700748 "payload_consumer/certificate_parser_android_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700749 "payload_consumer/delta_performer_integration_test.cc",
750 "payload_consumer/delta_performer_unittest.cc",
Kelvin Zhang9bd519d2020-09-23 12:55:19 -0400751 "payload_consumer/partition_writer_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700752 "payload_consumer/extent_reader_unittest.cc",
753 "payload_consumer/extent_writer_unittest.cc",
Kelvin Zhang9754f172020-09-25 15:22:35 -0400754 "payload_consumer/snapshot_extent_writer_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700755 "payload_consumer/fake_file_descriptor.cc",
756 "payload_consumer/file_descriptor_utils_unittest.cc",
757 "payload_consumer/file_writer_unittest.cc",
758 "payload_consumer/filesystem_verifier_action_unittest.cc",
Amin Hassani23795032020-11-24 14:38:55 -0800759 "payload_consumer/install_plan_unittest.cc",
Tianjie99d570d2020-06-04 14:57:19 -0700760 "payload_consumer/partition_update_generator_android_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700761 "payload_consumer/postinstall_runner_action_unittest.cc",
762 "payload_consumer/verity_writer_android_unittest.cc",
763 "payload_consumer/xz_extent_writer_unittest.cc",
764 "payload_generator/ab_generator_unittest.cc",
765 "payload_generator/blob_file_writer_unittest.cc",
766 "payload_generator/block_mapping_unittest.cc",
767 "payload_generator/boot_img_filesystem_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700768 "payload_generator/deflate_utils_unittest.cc",
769 "payload_generator/delta_diff_utils_unittest.cc",
770 "payload_generator/ext2_filesystem_unittest.cc",
771 "payload_generator/extent_ranges_unittest.cc",
772 "payload_generator/extent_utils_unittest.cc",
773 "payload_generator/fake_filesystem.cc",
774 "payload_generator/full_update_generator_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700775 "payload_generator/mapfile_filesystem_unittest.cc",
Tianjie87af6c02020-08-11 15:06:26 -0700776 "payload_generator/merge_sequence_generator_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700777 "payload_generator/payload_file_unittest.cc",
778 "payload_generator/payload_generation_config_android_unittest.cc",
779 "payload_generator/payload_generation_config_unittest.cc",
Jae Hoon Kim4b6d1262019-06-20 10:41:18 -0700780 "payload_generator/payload_properties_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700781 "payload_generator/payload_signer_unittest.cc",
782 "payload_generator/squashfs_filesystem_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700783 "payload_generator/zip_unittest.cc",
784 "testrunner.cc",
Jae Hoon Kim916af852019-08-01 17:45:30 -0700785 "update_status_utils_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700786 ],
787}
788
789// Brillo update payload generation script
790// ========================================================
Martin Stjernholm18e9f3c2020-09-08 13:56:59 +0100791sh_binary {
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700792 name: "brillo_update_payload",
793 device_supported: false,
794 host_supported: true,
795
Martin Stjernholm18e9f3c2020-09-08 13:56:59 +0100796 src: "scripts/brillo_update_payload",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700797 required: [
798 "delta_generator",
799 "shflags",
800 "simg2img",
801 ],
802
803 target: {
804 darwin: {
805 enabled: false,
806 },
807 },
Colin Cross606913a2017-11-14 13:05:37 -0800808}
Yifan Hongd51738c2020-07-23 17:06:25 -0700809
810// update_engine header library
811cc_library_headers {
812 name: "libupdate_engine_headers",
Yifan Hong309c8a82020-10-06 18:31:08 -0700813
814 // This header library is available to core and product modules.
Justin Yun6d121de2020-11-11 19:31:57 +0900815 product_available: true,
Yifan Hong309c8a82020-10-06 18:31:08 -0700816
Yifan Hongd51738c2020-07-23 17:06:25 -0700817 export_include_dirs: ["."],
818 apex_available: [
819 "com.android.gki.*",
David Anderson5e6dfe32020-09-17 15:50:33 -0700820 "//apex_available:platform",
Yifan Hongd51738c2020-07-23 17:06:25 -0700821 ],
David Andersonc1c93052020-08-26 18:22:09 +0000822 host_supported: true,
David Anderson5e6dfe32020-09-17 15:50:33 -0700823 recovery_available: true,
824 ramdisk_available: true,
825
826 target: {
827 darwin: {
828 enabled: false,
829 },
830 }
Yifan Hongd51738c2020-07-23 17:06:25 -0700831}