1// 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 17// AIDL interface between libupdate_engine and framework.jar 18package { 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 35filegroup { 36 name: "libupdate_engine_aidl", 37 srcs: [ 38 "binder_bindings/android/os/IUpdateEngine.aidl", 39 "binder_bindings/android/os/IUpdateEngineCallback.aidl", 40 ], 41 path: "binder_bindings", 42} 43 44cc_defaults { 45 name: "ue_defaults", 46 47 cflags: [ 48 "-DBASE_VER=576279", 49 "-DUSE_HWID_OVERRIDE=0", 50 "-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 "-g3", 63 ], 64 cppflags: [ 65 "-Wnon-virtual-dtor", 66 "-fno-strict-aliasing", 67 ], 68 include_dirs: ["system"], 69 local_include_dirs: ["client_library/include"], 70 header_libs: ["libgtest_prod_headers"], 71 shared_libs: [ 72 "libbrillo-stream", 73 "libbrillo", 74 "libchrome", 75 ], 76 ldflags: ["-Wl,--gc-sections"], 77 78 target: { 79 android: { 80 cflags: [ 81 "-DUSE_FEC=1", 82 ], 83 }, 84 host: { 85 cflags: [ 86 "-DUSE_FEC=0", 87 ], 88 }, 89 darwin: { 90 enabled: false, 91 }, 92 }, 93} 94 95// libcow_operation_convert (type: library) 96// ======================================================== 97cc_library_static { 98 name: "libpayload_extent_utils", 99 defaults: [ 100 "ue_defaults", 101 ], 102 host_supported: true, 103 recovery_available: true, 104 srcs: [ 105 "payload_generator/extent_utils.cc", 106 ], 107 static_libs: [ 108 "update_metadata-protos", 109 ], 110} 111 112cc_library { 113 name: "libcow_operation_convert", 114 host_supported: true, 115 recovery_available: true, 116 defaults: [ 117 "ue_defaults", 118 "update_metadata-protos_exports", 119 ], 120 srcs: [ 121 "common/cow_operation_convert.cc", 122 ], 123 static_libs: [ 124 "libsnapshot_cow", 125 "update_metadata-protos", 126 "libpayload_extent_ranges", 127 "libpayload_extent_utils", 128 "libbrotli", 129 "libz", 130 ], 131} 132 133// update_metadata-protos (type: static_library) 134// ======================================================== 135// Protobufs. 136cc_defaults { 137 name: "update_metadata-protos_exports", 138 139 shared_libs: ["libprotobuf-cpp-lite"], 140} 141 142cc_defaults { 143 name: "update_metadata-protos-defaults", 144 host_supported: true, 145 ramdisk_available: true, 146 recovery_available: true, 147 148 srcs: ["update_engine/update_metadata.proto"], 149 cflags: [ 150 "-Wall", 151 "-Werror", 152 ], 153 proto: { 154 canonical_path_from_root: false, 155 export_proto_headers: true, 156 }, 157} 158 159cc_library_static { 160 name: "update_metadata-protos", 161 defaults: ["update_metadata-protos-defaults"], 162 proto: { 163 type: "lite", 164 }, 165} 166 167cc_library_static { 168 name: "update_metadata-protos-full", 169 defaults: ["update_metadata-protos-defaults"], 170} 171 172python_library_host { 173 name: "update_metadata-protos-python", 174 srcs: ["update_metadata.proto"], 175 proto: { 176 canonical_path_from_root: false, 177 }, 178} 179 180// libpayload_consumer (type: static_library) 181// ======================================================== 182// The payload application component and common dependencies. 183cc_defaults { 184 name: "libpayload_consumer_exports_defaults", 185 defaults: ["update_metadata-protos_exports",], 186 187 static_libs: [ 188 "libxz", 189 "libbz", 190 "libbspatch", 191 "libbrotli", 192 "libfec_rs", 193 "libpuffpatch", 194 "libverity_tree", 195 "libsnapshot_cow", 196 "libbrotli", 197 "libz", 198 "libpayload_extent_ranges", 199 "libpayload_extent_utils", 200 "libcow_operation_convert", 201 "lz4diff-protos", 202 "liblz4patch", 203 "libzstd", 204 ], 205 shared_libs: [ 206 "libbase", 207 "libcrypto", 208 "libfec", 209 "liblz4", 210 "libziparchive", 211 ], 212} 213 214cc_defaults { 215 name: "libpayload_consumer_exports", 216 defaults: [ 217 "libpayload_consumer_exports_defaults" 218 ], 219 static_libs: ["update_metadata-protos",], 220} 221 222cc_defaults { 223 name: "libpayload_consumer_exports_proto-full", 224 defaults: [ 225 "libpayload_consumer_exports_defaults" 226 ], 227 static_libs: ["update_metadata-protos-full",], 228} 229 230cc_defaults { 231 name: "libpayload_consumer_defaults", 232 host_supported: true, 233 recovery_available: true, 234 235 srcs: [ 236 "aosp/platform_constants_android.cc", 237 "common/action_processor.cc", 238 "common/boot_control_stub.cc", 239 "common/clock.cc", 240 "common/constants.cc", 241 "common/cpu_limiter.cc", 242 "common/dynamic_partition_control_stub.cc", 243 "common/error_code_utils.cc", 244 "common/file_fetcher.cc", 245 "common/hash_calculator.cc", 246 "common/http_common.cc", 247 "common/http_fetcher.cc", 248 "common/hwid_override.cc", 249 "common/multi_range_http_fetcher.cc", 250 "common/prefs.cc", 251 "common/subprocess.cc", 252 "common/terminator.cc", 253 "common/utils.cc", 254 "payload_consumer/bzip_extent_writer.cc", 255 "payload_consumer/cached_file_descriptor.cc", 256 "payload_consumer/certificate_parser_android.cc", 257 "payload_consumer/cow_writer_file_descriptor.cc", 258 "payload_consumer/delta_performer.cc", 259 "payload_consumer/extent_reader.cc", 260 "payload_consumer/extent_writer.cc", 261 "payload_consumer/file_descriptor.cc", 262 "payload_consumer/file_descriptor_utils.cc", 263 "payload_consumer/file_writer.cc", 264 "payload_consumer/filesystem_verifier_action.cc", 265 "payload_consumer/install_operation_executor.cc", 266 "payload_consumer/install_plan.cc", 267 "payload_consumer/mount_history.cc", 268 "payload_consumer/payload_constants.cc", 269 "payload_consumer/payload_metadata.cc", 270 "payload_consumer/payload_verifier.cc", 271 "payload_consumer/partition_writer.cc", 272 "payload_consumer/partition_writer_factory_android.cc", 273 "payload_consumer/vabc_partition_writer.cc", 274 "payload_consumer/xor_extent_writer.cc", 275 "payload_consumer/block_extent_writer.cc", 276 "payload_consumer/snapshot_extent_writer.cc", 277 "payload_consumer/postinstall_runner_action.cc", 278 "payload_consumer/verified_source_fd.cc", 279 "payload_consumer/verity_writer_android.cc", 280 "payload_consumer/xz_extent_writer.cc", 281 "payload_consumer/fec_file_descriptor.cc", 282 "payload_consumer/partition_update_generator_android.cc", 283 "update_status_utils.cc", 284 ], 285} 286 287cc_library_static { 288 name: "libpayload_consumer", 289 defaults: [ 290 "ue_defaults", 291 "libpayload_consumer_exports", 292 "libpayload_consumer_defaults", 293 ], 294} 295 296cc_library_static { 297 name: "libpayload_consumer_proto-full", 298 defaults: [ 299 "ue_defaults", 300 "libpayload_consumer_exports_proto-full", 301 "libpayload_consumer_defaults", 302 ], 303} 304 305cc_library_static { 306 name: "libstatslog_ue", 307 generated_sources: ["statslog_ue.cpp"], 308 generated_headers: ["statslog_ue.h"], 309 export_generated_headers: ["statslog_ue.h"], 310 shared_libs: [ 311 "libstatssocket", 312 ] 313} 314 315genrule { 316 name: "statslog_ue.h", 317 tools: ["stats-log-api-gen"], 318 cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_ue.h --module update_engine --namespace chromeos_update_engine,statsd", 319 out: [ 320 "statslog_ue.h", 321 ], 322} 323 324genrule { 325 name: "statslog_ue.cpp", 326 tools: ["stats-log-api-gen"], 327 cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_ue.cpp --module update_engine --namespace chromeos_update_engine,statsd --importHeader statslog_ue.h", 328 out: [ 329 "statslog_ue.cpp", 330 ], 331} 332 333// libupdate_engine_boot_control (type: static_library) 334// ======================================================== 335// A BootControl class implementation using Android's HIDL boot_control HAL. 336cc_defaults { 337 name: "libupdate_engine_boot_control_exports_defaults", 338 defaults: ["update_metadata-protos_exports",], 339 340 static_libs: [ 341 "libcutils", 342 "libfs_mgr_binder", 343 "libgsi", 344 "libsnapshot_static", 345 "libstatslog_ue", 346 "libz", 347 ], 348 shared_libs: [ 349 "libbootloader_message", 350 "libhidlbase", 351 "liblp", 352 "libutils", 353 "android.hardware.boot@1.0", 354 "android.hardware.boot@1.1", 355 "android.hardware.boot@1.2", 356 "android.hardware.boot-V1-ndk", 357 "libboot_control_client", 358 ], 359 header_libs: [ 360 "avb_headers", 361 ], 362 target: { 363 recovery: { 364 static_libs: [ 365 "libfs_mgr", 366 "libsnapshot_nobinder", 367 ], 368 exclude_static_libs: [ 369 "libfs_mgr_binder", 370 "libsnapshot_static", 371 "libstatslog_ue" 372 ], 373 }, 374 }, 375} 376 377cc_defaults { 378 name: "libupdate_engine_boot_control_exports", 379 defaults: [ 380 "libupdate_engine_boot_control_exports_defaults", 381 ], 382 static_libs: [ 383 "libpayload_consumer", 384 "update_metadata-protos", 385 ] 386} 387 388cc_defaults { 389 name: "libupdate_engine_boot_control_exports_proto-full", 390 defaults: [ 391 "libupdate_engine_boot_control_exports_defaults", 392 ], 393 static_libs: [ 394 "libpayload_consumer_proto-full", 395 "update_metadata-protos-full", 396 ] 397} 398 399cc_defaults { 400 name: "libupdate_engine_boot_control_defaults", 401 defaults: [ 402 "ue_defaults", 403 ], 404 recovery_available: true, 405 406 srcs: [ 407 "aosp/boot_control_android.cc", 408 "aosp/cleanup_previous_update_action.cc", 409 "aosp/dynamic_partition_control_android.cc", 410 "aosp/dynamic_partition_utils.cc", 411 ], 412} 413 414cc_library_static { 415 name: "libupdate_engine_boot_control", 416 defaults: [ 417 "libupdate_engine_boot_control_defaults", 418 "libupdate_engine_boot_control_exports", 419 "libpayload_consumer_exports", 420 ], 421} 422 423cc_library_static { 424 name: "libupdate_engine_boot_control_nostats", 425 cflags: ["-DUE_DISABLE_STATS"], 426 defaults: [ 427 "libupdate_engine_boot_control_defaults", 428 "libupdate_engine_boot_control_exports", 429 "libpayload_consumer_exports", 430 ], 431} 432 433cc_library_static { 434 name: "libupdate_engine_boot_control_proto-full", 435 defaults: [ 436 "libupdate_engine_boot_control_defaults", 437 "libupdate_engine_boot_control_exports_proto-full", 438 "libpayload_consumer_exports_proto-full", 439 ], 440} 441 442// libupdate_engine_android (type: static_library) 443// ======================================================== 444// The main daemon static_library used in Android (non-Brillo). This only has a 445// loop to apply payloads provided by the upper layer via a Binder interface. 446cc_defaults { 447 name: "libupdate_engine_android_exports_defaults", 448 defaults: [ 449 "ue_defaults", 450 ], 451 452 static_libs: [ 453 "libavb", 454 "libavb_user", 455 "libgkiprops", 456 "libstatslog_ue", 457 "libPlatformProperties", 458 ], 459 shared_libs: [ 460 "apex_aidl_interface-cpp", 461 "libandroid_net", 462 "libbase", 463 "libbinder", 464 "libbinderwrapper", 465 "libbootloader_message", 466 "libbrillo-binder", 467 "libcurl", 468 "libcutils", 469 "libupdate_engine_stable-V2-cpp", 470 "liblog", 471 "libssl", 472 "libstatssocket", 473 "libutils", 474 ], 475 whole_static_libs: [ 476 "libcom.android.sysprop.apex", 477 ], 478} 479 480cc_defaults { 481 name: "libupdate_engine_android_exports", 482 defaults: [ 483 "libupdate_engine_android_exports_defaults", 484 "libupdate_engine_boot_control_exports", 485 "libpayload_consumer_exports", 486 ], 487 static_libs: [ 488 "libpayload_consumer", 489 "libupdate_engine_boot_control", 490 ], 491} 492 493cc_defaults { 494 name: "libupdate_engine_android_exports_proto-full", 495 defaults: [ 496 "libupdate_engine_android_exports_defaults", 497 "libupdate_engine_boot_control_exports_proto-full", 498 "libpayload_consumer_exports_proto-full", 499 ], 500 static_libs: [ 501 "libpayload_consumer_proto-full", 502 "libupdate_engine_boot_control_proto-full", 503 ], 504} 505 506cc_defaults { 507 name: "libupdate_engine_android_defaults", 508 defaults: [ 509 "ue_defaults", 510 ], 511 512 aidl: { 513 local_include_dirs: ["binder_bindings"], 514 export_aidl_headers: true, 515 }, 516 517 srcs: [ 518 ":libupdate_engine_aidl", 519 "common/system_state.cc", 520 "aosp/apex_handler_android.cc", 521 "aosp/binder_service_android.cc", 522 "aosp/binder_service_stable_android.cc", 523 "aosp/daemon_android.cc", 524 "aosp/daemon_state_android.cc", 525 "aosp/hardware_android.cc", 526 "aosp/logging_android.cc", 527 "aosp/network_selector_android.cc", 528 "aosp/update_attempter_android.cc", 529 "certificate_checker.cc", 530 "download_action.cc", 531 "libcurl_http_fetcher.cc", 532 "metrics_utils.cc", 533 "update_boot_flags_action.cc", 534 ], 535} 536 537cc_library_static { 538 name: "libupdate_engine_android", 539 defaults: [ 540 "libupdate_engine_android_defaults", 541 "libupdate_engine_android_exports", 542 ] 543} 544 545cc_library_static { 546 name: "libupdate_engine_android_proto-full", 547 defaults: [ 548 "libupdate_engine_android_defaults", 549 "libupdate_engine_android_exports_proto-full", 550 ] 551} 552 553// update_engine (type: executable) 554// ======================================================== 555// update_engine daemon. 556cc_binary { 557 name: "update_engine", 558 defaults: [ 559 "ue_defaults", 560 "libupdate_engine_android_exports", 561 ], 562 563 static_libs: [ 564 "libupdate_engine_android", 565 "libgflags", 566 ], 567 required: [ 568 "cacerts", 569 "otacerts", 570 ], 571 572 srcs: ["main.cc", "aosp/metrics_reporter_android.cc"], 573 init_rc: ["update_engine.rc"], 574} 575 576// update_engine_nostats (type: executable) 577// ======================================================== 578// update_engine daemon version without the stats integration. 579cc_binary { 580 name: "update_engine_nostats", 581 defaults: [ 582 "ue_defaults", 583 "libupdate_engine_android_exports", 584 ], 585 586 static_libs: [ 587 "libupdate_engine_android", 588 "libgflags", 589 "libupdate_engine_boot_control_nostats", 590 ], 591 required: [ 592 "cacerts", 593 "otacerts", 594 ], 595 596 exclude_static_libs: [ 597 "libstatslog_ue", 598 "libupdate_engine_boot_control" 599 ], 600 601 exclude_shared_libs: [ 602 "libstatssocket", 603 ], 604 605 cflags: ["-DUE_DISABLE_STATS"], 606 srcs: [ 607 "main.cc", 608 "common/metrics_reporter_stub.cc", 609 ], 610 init_rc: ["update_engine_nostats.rc"], 611} 612 613// update_engine_sideload (type: executable) 614// ======================================================== 615// A binary executable equivalent to update_engine daemon that installs an update 616// from a local file directly instead of running in the background. Used in 617// recovery image. 618cc_binary { 619 name: "update_engine_sideload", 620 defaults: [ 621 "ue_defaults", 622 "update_metadata-protos_exports", 623 "libupdate_engine_boot_control_exports", 624 "libpayload_consumer_exports", 625 ], 626 recovery: true, 627 628 cflags: [ 629 "-D_UE_SIDELOAD", 630 "-DUE_DISABLE_STATS", 631 ], 632 header_libs: ["libgtest_prod_headers"], 633 634 srcs: [ 635 "aosp/hardware_android.cc", 636 "aosp/logging_android.cc", 637 "aosp/sideload_main.cc", 638 "aosp/update_attempter_android.cc", 639 "common/metrics_reporter_stub.cc", 640 "common/network_selector_stub.cc", 641 "common/system_state.cc", 642 "download_action.cc", 643 "metrics_utils.cc", 644 "update_boot_flags_action.cc", 645 "update_status_utils.cc", 646 ], 647 648 // Use commonly used shared libraries. libprotobuf-cpp-lite.so is filtered out, 649 // as it doesn't look beneficial to be installed separately due to its size. Note 650 // that we explicitly request their recovery variants, so that the expected files 651 // will be used and installed. 652 shared_libs: [ 653 "libbase", 654 "liblog", 655 "liblz4", 656 "libprotobuf-cpp-lite", 657 ], 658 static_libs: [ 659 "libpayload_consumer", 660 "libupdate_engine_boot_control", 661 "update_metadata-protos", 662 663 // We add the static versions of the shared libraries that are not installed to 664 // recovery image due to size concerns. Need to include all the static library 665 // dependencies of these static libraries. 666 "libgkiprops", 667 "libevent", 668 "libmodpb64", 669 "libbrillo-stream", 670 "libbrillo", 671 "libchrome", 672 ], 673 target: { 674 recovery: { 675 exclude_shared_libs: [ 676 "libbrillo-stream", 677 "libbrillo", 678 "libchrome", 679 ], 680 }, 681 }, 682 683 required: [ 684 "otacerts.recovery", 685 ], 686} 687 688// update_engine_client (type: executable) 689// ======================================================== 690// update_engine console client. 691cc_binary { 692 name: "update_engine_client", 693 defaults: ["ue_defaults"], 694 695 shared_libs: [ 696 "libbinder", 697 "libbinderwrapper", 698 "libbrillo-binder", 699 "libutils", 700 ], 701 702 aidl: { 703 local_include_dirs: ["binder_bindings"], 704 }, 705 706 srcs: [ 707 ":libupdate_engine_aidl", 708 "aosp/update_engine_client_android.cc", 709 "common/error_code_utils.cc", 710 "update_status_utils.cc", 711 ], 712} 713 714// libpayload_generator (type: static_library) 715// ======================================================== 716// server-side code. This is used for delta_generator and unittests but not 717// for any client code. 718cc_defaults { 719 name: "libpayload_generator_exports", 720 defaults: [ 721 "libpayload_consumer_exports", 722 "update_metadata-protos_exports", 723 "erofs-utils_export_defaults", 724 ], 725 726 header_libs: [ 727 "bootimg_headers", 728 ], 729 static_libs: [ 730 "libavb", 731 "libbrotli", 732 "libbsdiff", 733 "libdivsufsort", 734 "libdivsufsort64", 735 "liblzma", 736 "libpayload_consumer", 737 "libpuffdiff", 738 "libzucchini", 739 "libverity_tree", 740 "update_metadata-protos", 741 "libpayload_extent_utils", 742 "libcow_size_estimator", 743 "liberofs", 744 "libselinux", 745 "lz4diff-protos", 746 "liblz4diff", 747 "libzstd", 748 ], 749 shared_libs: [ 750 "libbase", 751 "libext2fs", 752 // LZ4 has to be a shared lib, as we want to override it with 753 // LD_LIBRARY_PRELOAD later 754 "liblz4", 755 ], 756} 757 758cc_library_static { 759 name: "libpayload_extent_ranges", 760 defaults: [ 761 "ue_defaults", 762 ], 763 host_supported: true, 764 recovery_available: true, 765 srcs: [ 766 "payload_generator/extent_ranges.cc", 767 ], 768 static_libs: [ 769 "update_metadata-protos", 770 ], 771} 772 773cc_library_static { 774 name: "libcow_size_estimator", 775 defaults: [ 776 "ue_defaults", 777 "update_metadata-protos_exports" 778 ], 779 host_supported: true, 780 recovery_available: true, 781 srcs: [ 782 "payload_generator/cow_size_estimator.cc", 783 ], 784 static_libs: [ 785 "update_metadata-protos", 786 "libbase", 787 "libsnapshot_cow", 788 "libcow_operation_convert", 789 ], 790} 791 792cc_defaults { 793 name: "liblz4diff_defaults", 794 static_libs: [ 795 "lz4diff-protos", 796 "update_metadata-protos", 797 "libssl", 798 "libbsdiff", 799 "libpuffdiff", 800 ], 801 shared_libs: [ 802 "liblz4", 803 ], 804} 805 806cc_library_static { 807 name: "liblz4diff", 808 host_supported: true, 809 defaults: ["ue_defaults", "liblz4diff_defaults"], 810 srcs: [ 811 "lz4diff/lz4diff.cc", 812 "lz4diff/lz4diff_compress.cc", 813 ], 814} 815 816cc_library_static { 817 name: "liblz4patch", 818 host_supported: true, 819 recovery_available: true, 820 defaults: ["ue_defaults"], 821 static_libs: [ 822 "lz4diff-protos", 823 "update_metadata-protos", 824 "libssl", 825 "libbspatch", 826 "libpuffpatch", 827 ], 828 shared_libs: [ 829 "liblz4", 830 ], 831 srcs: [ 832 "lz4diff/lz4patch.cc", 833 "lz4diff/lz4diff_compress.cc", 834 ], 835} 836 837cc_binary_host { 838 name: "lz4diff", 839 defaults: [ 840 "ue_defaults", 841 "libpayload_generator_exports", 842 ], 843 static_libs: [ 844 "libpayload_generator", 845 "liblz4diff", 846 "liblz4patch", 847 ], 848 srcs: [ 849 "lz4diff/lz4diff_main.cc", 850 ], 851} 852 853cc_library_static { 854 name: "libpayload_generator", 855 defaults: [ 856 "ue_defaults", 857 "libpayload_generator_exports", 858 ], 859 host_supported: true, 860 861 srcs: [ 862 "common/system_state.cc", 863 "download_action.cc", 864 "payload_generator/ab_generator.cc", 865 "payload_generator/annotated_operation.cc", 866 "payload_generator/blob_file_writer.cc", 867 "payload_generator/block_mapping.cc", 868 "payload_generator/boot_img_filesystem.cc", 869 "payload_generator/bzip.cc", 870 "payload_generator/deflate_utils.cc", 871 "payload_generator/delta_diff_generator.cc", 872 "payload_generator/delta_diff_utils.cc", 873 "payload_generator/ext2_filesystem.cc", 874 "payload_generator/erofs_filesystem.cc", 875 "payload_generator/extent_ranges.cc", 876 "payload_generator/full_update_generator.cc", 877 "payload_generator/mapfile_filesystem.cc", 878 "payload_generator/merge_sequence_generator.cc", 879 "payload_generator/payload_file.cc", 880 "payload_generator/payload_generation_config_android.cc", 881 "payload_generator/payload_generation_config.cc", 882 "payload_generator/payload_properties.cc", 883 "payload_generator/payload_signer.cc", 884 "payload_generator/raw_filesystem.cc", 885 "payload_generator/squashfs_filesystem.cc", 886 "payload_generator/xz_android.cc", 887 ], 888} 889 890// delta_generator (type: executable) 891// ======================================================== 892// server-side delta generator. 893cc_binary_host { 894 name: "delta_generator", 895 defaults: [ 896 "ue_defaults", 897 "libpayload_generator_exports", 898 "libpayload_consumer_exports", 899 ], 900 901 static_libs: [ 902 "libavb_host_sysdeps", 903 "libpayload_consumer", 904 "libpayload_generator", 905 "libgflags", 906 ], 907 908 srcs: ["payload_generator/generate_delta_main.cc"], 909} 910 911cc_test { 912 host_supported: true, 913 name: "ue_unittest_delta_generator", 914 defaults: [ 915 "ue_defaults", 916 "libpayload_generator_exports", 917 "libpayload_consumer_exports", 918 ], 919 920 static_libs: [ 921 "libpayload_consumer", 922 "libpayload_generator", 923 "libgflags", 924 ], 925 926 srcs: ["payload_generator/generate_delta_main.cc"], 927 928 gtest: false, 929 stem: "delta_generator", 930} 931 932// test_http_server (type: executable) 933// ======================================================== 934// Test HTTP Server. 935cc_test { 936 name: "test_http_server", 937 defaults: ["ue_defaults"], 938 srcs: [ 939 "common/http_common.cc", 940 "test_http_server.cc", 941 ], 942 943 gtest: false, 944} 945 946// test_subprocess (type: executable) 947// ======================================================== 948// Test helper subprocess program. 949cc_test { 950 name: "test_subprocess", 951 defaults: ["ue_defaults"], 952 srcs: ["test_subprocess.cc"], 953 954 gtest: false, 955} 956 957// Public keys for unittests. 958// ======================================================== 959genrule { 960 name: "ue_unittest_keys", 961 cmd: "openssl rsa -in $(location unittest_key.pem) -pubout -out $(location unittest_key.pub.pem) &&" + 962 "openssl rsa -in $(location unittest_key2.pem) -pubout -out $(location unittest_key2.pub.pem) &&" + 963 "openssl rsa -in $(location unittest_key_RSA4096.pem) -pubout -out $(location unittest_key_RSA4096.pub.pem) &&" + 964 "openssl pkey -in $(location unittest_key_EC.pem) -pubout -out $(location unittest_key_EC.pub.pem)", 965 srcs: [ 966 "unittest_key.pem", 967 "unittest_key2.pem", 968 "unittest_key_RSA4096.pem", 969 "unittest_key_EC.pem", 970 ], 971 out: [ 972 "unittest_key.pub.pem", 973 "unittest_key2.pub.pem", 974 "unittest_key_RSA4096.pub.pem", 975 "unittest_key_EC.pub.pem", 976 ], 977} 978 979// Sample images for unittests. 980// ======================================================== 981// Extract sample image from the compressed sample_images.tar.bz2 file used by 982// the unittests. 983genrule { 984 name: "ue_unittest_disk_imgs", 985 cmd: "tar -jxf $(in) -C $(genDir)/gen disk_ext2_1k.img disk_ext2_4k.img disk_ext2_4k_empty.img disk_ext2_unittest.img", 986 srcs: ["sample_images/sample_images.tar.bz2"], 987 out: [ 988 "gen/disk_ext2_1k.img", 989 "gen/disk_ext2_4k.img", 990 "gen/disk_ext2_4k_empty.img", 991 "gen/disk_ext2_unittest.img", 992 ], 993} 994 995genrule { 996 name: "ue_unittest_erofs_imgs", 997 cmd: "$(in) $(location mkfs.erofs) $(location gen/erofs_empty.img) && " + 998 "$(in) $(location mkfs.erofs) $(location gen/erofs.img) $(location delta_generator) && " + 999 "$(in) $(location mkfs.erofs) $(location gen/erofs_new.img) $(location delta_generator) lz4hc,7", 1000 srcs: ["sample_images/generate_test_erofs_images.sh"], 1001 out: [ 1002 "gen/erofs.img", 1003 "gen/erofs_new.img", 1004 "gen/erofs_empty.img", 1005 ], 1006 tools: [ 1007 "mkfs.erofs", 1008 "delta_generator", 1009 ], 1010} 1011 1012filegroup { 1013 name: "update_engine_host_unittest_timeout_srcs", 1014 srcs: [ 1015 "common/action_processor_unittest.cc", 1016 "common/file_fetcher_unittest.cc", 1017 "payload_generator/delta_diff_utils_unittest.cc", 1018 ], 1019} 1020 1021filegroup { 1022 name: "update_engine_host_unittest_srcs", 1023 srcs: [ 1024 "common/action_pipe_unittest.cc", 1025 "common/action_processor_unittest.cc", 1026 "common/action_unittest.cc", 1027 "common/cow_operation_convert_unittest.cc", 1028 "common/cpu_limiter_unittest.cc", 1029 "common/fake_prefs.cc", 1030 "common/file_fetcher_unittest.cc", 1031 "common/hash_calculator_unittest.cc", 1032 "common/hwid_override_unittest.cc", 1033 "common/metrics_reporter_stub.cc", 1034 "common/mock_http_fetcher.cc", 1035 "common/prefs_unittest.cc", 1036 "common/terminator_unittest.cc", 1037 "common/test_utils.cc", 1038 "lz4diff/lz4diff_compress_unittest.cc", 1039 "lz4diff/lz4diff_unittest.cc", 1040 "payload_generator/ab_generator_unittest.cc", 1041 "payload_generator/blob_file_writer_unittest.cc", 1042 "payload_generator/block_mapping_unittest.cc", 1043 "payload_generator/boot_img_filesystem_unittest.cc", 1044 "payload_generator/deflate_utils_unittest.cc", 1045 "payload_generator/delta_diff_utils_unittest.cc", 1046 "payload_generator/erofs_filesystem_unittest.cc", 1047 "payload_generator/ext2_filesystem_unittest.cc", 1048 "payload_generator/extent_ranges_unittest.cc", 1049 "payload_generator/extent_utils_unittest.cc", 1050 "payload_generator/fake_filesystem.cc", 1051 "payload_generator/full_update_generator_unittest.cc", 1052 "payload_generator/mapfile_filesystem_unittest.cc", 1053 "payload_generator/merge_sequence_generator_unittest.cc", 1054 "payload_generator/payload_file_unittest.cc", 1055 "payload_generator/payload_generation_config_android_unittest.cc", 1056 "payload_generator/payload_generation_config_unittest.cc", 1057 "payload_generator/payload_properties_unittest.cc", 1058 "payload_generator/payload_signer_unittest.cc", 1059 "payload_generator/squashfs_filesystem_unittest.cc", 1060 "payload_generator/zip_unittest.cc", 1061 "payload_consumer/verity_writer_android_unittest.cc", 1062 "payload_consumer/xz_extent_writer_unittest.cc", 1063 "testrunner.cc", 1064 ], 1065} 1066 1067cc_test_host { 1068 name: "update_engine_host_unittests", 1069 defaults: [ 1070 "ue_defaults", 1071 "libpayload_generator_exports", 1072 ], 1073 strip: { 1074 none: true, 1075 }, 1076 cflags: [ 1077 "-g3", 1078 ], 1079 tidy_timeout_srcs: [":update_engine_host_unittest_timeout_srcs"], 1080 srcs: [":update_engine_host_unittest_srcs"], 1081 data: [ 1082 ":ue_unittest_delta_generator", 1083 ":ue_unittest_disk_imgs", 1084 ":ue_unittest_erofs_imgs", 1085 ":ue_unittest_keys", 1086 "otacerts.zip", 1087 "unittest_key.pem", 1088 "unittest_key2.pem", 1089 "unittest_key_RSA4096.pem", 1090 "unittest_key_EC.pem", 1091 "update_engine.conf", 1092 "testdata/cycle_nodes_product.bin", 1093 "testdata/cycle_nodes_product_no_xor.bin", 1094 ], 1095 static_libs: [ 1096 "libgmock", 1097 "libpayload_generator", 1098 ], 1099} 1100 1101// update_engine_unittests (type: executable) 1102// ======================================================== 1103// Main unittest file. 1104cc_test { 1105 name: "update_engine_http_unittests", 1106 defaults: [ 1107 "ue_defaults", 1108 "liblz4diff_defaults", 1109 "update_metadata-protos_exports", 1110 ], 1111 require_root: true, 1112 static_libs: [ 1113 "libbase", 1114 "libbrillo-test-helpers", 1115 "libchrome_test_helpers", 1116 "libcurl", 1117 "libcutils", 1118 "libdm", 1119 "libgmock", 1120 "libz", 1121 "libzstd", 1122 ], 1123 shared_libs: [ 1124 "libssl", 1125 "libcrypto", 1126 "libziparchive", 1127 "liblog", 1128 ], 1129 1130 data: [ 1131 ":test_http_server", 1132 ":test_subprocess", 1133 ":ue_unittest_keys", 1134 "otacerts.zip", 1135 "unittest_key.pem", 1136 "unittest_key2.pem", 1137 "unittest_key_RSA4096.pem", 1138 "unittest_key_EC.pem", 1139 ], 1140 1141 // We cannot use the default generated AndroidTest.xml because of the use of helper modules 1142 // (i.e. test_http_server, test_subprocess, ue_unittest_delta_generator). 1143 // test_config: "test_config.xml", 1144 test_suites: ["device-tests"], 1145 1146 srcs: [ 1147 "aosp/platform_constants_android.cc", 1148 "certificate_checker.cc", 1149 "common/action_processor.cc", 1150 "common/boot_control_stub.cc", 1151 "common/error_code_utils.cc", 1152 "common/file_fetcher.cc", 1153 "common/hash_calculator.cc", 1154 "common/http_fetcher.cc", 1155 "common/multi_range_http_fetcher.cc", 1156 "common/http_common.cc", 1157 "common/subprocess.cc", 1158 "common/test_utils.cc", 1159 "common/utils.cc", 1160 "libcurl_http_fetcher.cc", 1161 "payload_consumer/certificate_parser_android.cc", 1162 "payload_consumer/payload_verifier.cc", 1163 "payload_generator/payload_signer.cc", 1164 "update_status_utils.cc", 1165 "certificate_checker_unittest.cc", 1166 "common/http_fetcher_unittest.cc", 1167 "common/mock_http_fetcher.cc", 1168 "common/subprocess_unittest.cc", 1169 "libcurl_http_fetcher_unittest.cc", 1170 "payload_consumer/certificate_parser_android_unittest.cc", 1171 "update_status_utils_unittest.cc", 1172 ], 1173} 1174 1175// update_engine_unittests (type: executable) 1176// ======================================================== 1177// Main unittest file. 1178cc_test { 1179 name: "update_engine_unittests", 1180 defaults: [ 1181 "ue_defaults", 1182 "libpayload_generator_exports", 1183 "libupdate_engine_android_exports", 1184 ], 1185 1186 static_libs: [ 1187 "libpayload_generator", 1188 "libbrillo-test-helpers", 1189 "libgmock", 1190 "libchrome_test_helpers", 1191 "libupdate_engine_android", 1192 "libdm", 1193 ], 1194 1195 header_libs: [ 1196 "libstorage_literals_headers", 1197 ], 1198 1199 data: [ 1200 ":ue_unittest_delta_generator", 1201 ":ue_unittest_disk_imgs", 1202 ":ue_unittest_erofs_imgs", 1203 ":ue_unittest_keys", 1204 "otacerts.zip", 1205 "unittest_key.pem", 1206 "unittest_key2.pem", 1207 "unittest_key_RSA4096.pem", 1208 "unittest_key_EC.pem", 1209 "update_engine.conf", 1210 "testdata/cycle_nodes_product.bin", 1211 "testdata/cycle_nodes_product_no_xor.bin", 1212 ], 1213 1214 // We cannot use the default generated AndroidTest.xml because of the use of helper modules 1215 // (i.e. test_http_server, test_subprocess, ue_unittest_delta_generator). 1216 test_config: "test_config.xml", 1217 test_suites: ["device-tests"], 1218 1219 tidy_timeout_srcs: [ 1220 ":update_engine_host_unittest_timeout_srcs", 1221 "aosp/dynamic_partition_control_android_unittest.cc", 1222 "common/http_fetcher_unittest.cc", 1223 "payload_consumer/delta_performer_integration_test.cc", 1224 "payload_consumer/delta_performer_unittest.cc", 1225 ], 1226 srcs: [ 1227 ":update_engine_host_unittest_srcs", 1228 "aosp/apex_handler_android_unittest.cc", 1229 "aosp/cleanup_previous_update_action_unittest.cc", 1230 "aosp/dynamic_partition_control_android_unittest.cc", 1231 "aosp/update_attempter_android_integration_test.cc", 1232 "aosp/update_attempter_android_unittest.cc", 1233 "common/utils_unittest.cc", 1234 "download_action_android_unittest.cc", 1235 "payload_consumer/block_extent_writer_unittest.cc", 1236 "payload_consumer/bzip_extent_writer_unittest.cc", 1237 "payload_consumer/cached_file_descriptor_unittest.cc", 1238 "payload_consumer/cow_writer_file_descriptor_unittest.cc", 1239 "payload_consumer/delta_performer_integration_test.cc", 1240 "payload_consumer/delta_performer_unittest.cc", 1241 "payload_consumer/extent_reader_unittest.cc", 1242 "payload_consumer/extent_writer_unittest.cc", 1243 "payload_consumer/extent_map_unittest.cc", 1244 "payload_consumer/fake_file_descriptor.cc", 1245 "payload_consumer/file_descriptor_utils_unittest.cc", 1246 "payload_consumer/file_writer_unittest.cc", 1247 "payload_consumer/filesystem_verifier_action_unittest.cc", 1248 "payload_consumer/install_plan_unittest.cc", 1249 "payload_consumer/install_operation_executor_unittest.cc", 1250 "payload_consumer/partition_update_generator_android_unittest.cc", 1251 "payload_consumer/partition_writer_unittest.cc", 1252 "payload_consumer/postinstall_runner_action_unittest.cc", 1253 "payload_consumer/snapshot_extent_writer_unittest.cc", 1254 "payload_consumer/vabc_partition_writer_unittest.cc", 1255 "payload_consumer/xor_extent_writer_unittest.cc", 1256 ], 1257} 1258 1259// Brillo update payload generation script 1260// ======================================================== 1261sh_binary { 1262 name: "brillo_update_payload", 1263 device_supported: false, 1264 host_supported: true, 1265 1266 src: "scripts/brillo_update_payload", 1267 required: [ 1268 "delta_generator", 1269 "shflags", 1270 "simg2img", 1271 ], 1272 1273 target: { 1274 darwin: { 1275 enabled: false, 1276 }, 1277 }, 1278} 1279 1280// update_engine header library 1281cc_library_headers { 1282 name: "libupdate_engine_headers", 1283 1284 // This header library is available to core and product modules. 1285 product_available: true, 1286 1287 export_include_dirs: ["."], 1288 apex_available: [ 1289 "com.android.gki.*", 1290 "//apex_available:platform", 1291 ], 1292 host_supported: true, 1293 recovery_available: true, 1294 ramdisk_available: true, 1295 vendor_ramdisk_available: true, 1296 1297 target: { 1298 darwin: { 1299 enabled: false, 1300 }, 1301 } 1302} 1303 1304cc_binary_host { 1305 name: "cow_converter", 1306 defaults: [ 1307 "ue_defaults", 1308 "libpayload_consumer_exports", 1309 ], 1310 srcs: [ 1311 "aosp/cow_converter.cc", 1312 ], 1313 static_libs: [ 1314 "liblog", 1315 "libbrotli", 1316 "libbase", 1317 "libcow_operation_convert", 1318 "libcow_size_estimator", 1319 "libgflags", 1320 "libpayload_consumer", 1321 "libpayload_extent_ranges", 1322 "libpayload_extent_utils", 1323 "libsnapshot_cow", 1324 "libz", 1325 "update_metadata-protos", 1326 ], 1327} 1328 1329cc_library_static { 1330 name: "lz4diff-protos", 1331 host_supported: true, 1332 ramdisk_available: true, 1333 recovery_available: true, 1334 1335 srcs: ["lz4diff/lz4diff.proto"], 1336 cflags: [ 1337 "-Wall", 1338 "-Werror", 1339 ], 1340 proto: { 1341 canonical_path_from_root: false, 1342 export_proto_headers: true, 1343 }, 1344} 1345 1346cc_binary_host { 1347 name: "ota_extractor", 1348 defaults: [ 1349 "ue_defaults", 1350 "libpayload_consumer_exports", 1351 ], 1352 srcs: [ 1353 "aosp/ota_extractor.cc", 1354 ], 1355 static_libs: [ 1356 "liblog", 1357 "libbrotli", 1358 "libbase", 1359 "libpayload_consumer", 1360 "libpayload_extent_ranges", 1361 "libpayload_extent_utils", 1362 "libz", 1363 "libgflags", 1364 "update_metadata-protos", 1365 ], 1366} 1367 1368cc_binary_host { 1369 name: "map_file_generator", 1370 defaults: [ 1371 "ue_defaults", 1372 "libpayload_generator_exports", 1373 ], 1374 srcs: [ 1375 "aosp/map_file_generator.cc", 1376 ], 1377 static_libs: [ 1378 "liblog", 1379 "libbase", 1380 "libpayload_generator", 1381 "libpayload_extent_ranges", 1382 "libpayload_extent_utils", 1383 "libgflags", 1384 "libsparse", 1385 "update_metadata-protos", 1386 ], 1387 required: [ 1388 "unsquashfs", 1389 ], 1390} 1391 1392cc_fuzz { 1393 name: "update_engine_service_fuzzer", 1394 defaults: [ 1395 "ue_defaults", 1396 "libupdate_engine_android_exports", 1397 "service_fuzzer_defaults", 1398 "fuzzer_disable_leaks", 1399 ], 1400 static_libs: [ 1401 "libupdate_engine_android", 1402 "libgflags", 1403 ], 1404 srcs: [ 1405 "fuzzers/update_engine_service_fuzzer.cpp", 1406 "aosp/metrics_reporter_android.cc", 1407 ], 1408 fuzz_config: { 1409 triage_assignee: "waghpawan@google.com", 1410 cc: [ 1411 "elsk@google.com", 1412 "zhangkelvin@google.com", 1413 ] 1414 }, 1415} 1416