Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 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 | |
Colin Cross | 606913a | 2017-11-14 13:05:37 -0800 | [diff] [blame] | 17 | // AIDL interface between libupdate_engine and framework.jar |
| 18 | filegroup { |
| 19 | name: "libupdate_engine_aidl", |
| 20 | srcs: [ |
| 21 | "binder_bindings/android/os/IUpdateEngine.aidl", |
| 22 | "binder_bindings/android/os/IUpdateEngineCallback.aidl", |
| 23 | ], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 24 | path: "binder_bindings", |
| 25 | } |
| 26 | |
| 27 | cc_defaults { |
| 28 | name: "ue_defaults", |
| 29 | |
| 30 | cflags: [ |
Amin Hassani | 2e4eda5 | 2019-01-07 14:01:17 -0800 | [diff] [blame] | 31 | "-DBASE_VER=576279", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 32 | "-DUSE_HWID_OVERRIDE=0", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 33 | "-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 Jiang | b5f631d | 2018-12-18 16:59:57 -0800 | [diff] [blame] | 67 | android: { |
| 68 | cflags: [ |
| 69 | "-DUSE_FEC=1", |
| 70 | ], |
| 71 | }, |
| 72 | host: { |
| 73 | cflags: [ |
| 74 | "-DUSE_FEC=0", |
| 75 | ], |
| 76 | }, |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 77 | darwin: { |
| 78 | enabled: false, |
| 79 | }, |
| 80 | }, |
| 81 | } |
| 82 | |
| 83 | // update_metadata-protos (type: static_library) |
| 84 | // ======================================================== |
| 85 | // Protobufs. |
| 86 | cc_defaults { |
| 87 | name: "update_metadata-protos_exports", |
| 88 | |
| 89 | shared_libs: ["libprotobuf-cpp-lite"], |
| 90 | } |
| 91 | |
| 92 | cc_library_static { |
| 93 | name: "update_metadata-protos", |
| 94 | host_supported: true, |
| 95 | recovery_available: true, |
| 96 | |
| 97 | srcs: ["update_engine/update_metadata.proto"], |
| 98 | cflags: [ |
| 99 | "-Wall", |
| 100 | "-Werror", |
| 101 | ], |
| 102 | proto: { |
| 103 | canonical_path_from_root: false, |
| 104 | export_proto_headers: true, |
| 105 | }, |
| 106 | } |
| 107 | |
| 108 | // libpayload_consumer (type: static_library) |
| 109 | // ======================================================== |
| 110 | // The payload application component and common dependencies. |
| 111 | cc_defaults { |
| 112 | name: "libpayload_consumer_exports", |
| 113 | defaults: ["update_metadata-protos_exports"], |
| 114 | |
| 115 | static_libs: [ |
| 116 | "update_metadata-protos", |
| 117 | "libxz", |
| 118 | "libbz", |
| 119 | "libbspatch", |
| 120 | "libbrotli", |
Tianjie | 99d570d | 2020-06-04 14:57:19 -0700 | [diff] [blame] | 121 | "libc++fs", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 122 | "libfec_rs", |
| 123 | "libpuffpatch", |
| 124 | "libverity_tree", |
| 125 | ], |
| 126 | shared_libs: [ |
| 127 | "libbase", |
| 128 | "libcrypto", |
Sen Jiang | b5f631d | 2018-12-18 16:59:57 -0800 | [diff] [blame] | 129 | "libfec", |
Tianjie | 99d570d | 2020-06-04 14:57:19 -0700 | [diff] [blame] | 130 | "libziparchive", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 131 | ], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 132 | } |
| 133 | |
| 134 | cc_library_static { |
| 135 | name: "libpayload_consumer", |
| 136 | defaults: [ |
| 137 | "ue_defaults", |
| 138 | "libpayload_consumer_exports", |
| 139 | ], |
| 140 | host_supported: true, |
| 141 | recovery_available: true, |
| 142 | |
| 143 | srcs: [ |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 144 | "aosp/platform_constants_android.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 145 | "common/action_processor.cc", |
| 146 | "common/boot_control_stub.cc", |
| 147 | "common/clock.cc", |
| 148 | "common/constants.cc", |
| 149 | "common/cpu_limiter.cc", |
Yifan Hong | daac732 | 2019-11-07 10:48:26 -0800 | [diff] [blame] | 150 | "common/dynamic_partition_control_stub.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 151 | "common/error_code_utils.cc", |
| 152 | "common/file_fetcher.cc", |
| 153 | "common/hash_calculator.cc", |
| 154 | "common/http_common.cc", |
| 155 | "common/http_fetcher.cc", |
| 156 | "common/hwid_override.cc", |
| 157 | "common/multi_range_http_fetcher.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 158 | "common/prefs.cc", |
| 159 | "common/proxy_resolver.cc", |
| 160 | "common/subprocess.cc", |
| 161 | "common/terminator.cc", |
| 162 | "common/utils.cc", |
| 163 | "payload_consumer/bzip_extent_writer.cc", |
| 164 | "payload_consumer/cached_file_descriptor.cc", |
Tianjie Xu | 7a78d63 | 2019-10-08 16:32:39 -0700 | [diff] [blame] | 165 | "payload_consumer/certificate_parser_android.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 166 | "payload_consumer/delta_performer.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 167 | "payload_consumer/extent_reader.cc", |
| 168 | "payload_consumer/extent_writer.cc", |
| 169 | "payload_consumer/file_descriptor.cc", |
| 170 | "payload_consumer/file_descriptor_utils.cc", |
| 171 | "payload_consumer/file_writer.cc", |
| 172 | "payload_consumer/filesystem_verifier_action.cc", |
| 173 | "payload_consumer/install_plan.cc", |
| 174 | "payload_consumer/mount_history.cc", |
| 175 | "payload_consumer/payload_constants.cc", |
| 176 | "payload_consumer/payload_metadata.cc", |
| 177 | "payload_consumer/payload_verifier.cc", |
| 178 | "payload_consumer/postinstall_runner_action.cc", |
| 179 | "payload_consumer/verity_writer_android.cc", |
| 180 | "payload_consumer/xz_extent_writer.cc", |
| 181 | "payload_consumer/fec_file_descriptor.cc", |
Tianjie | d3865d1 | 2020-06-03 15:25:17 -0700 | [diff] [blame] | 182 | "payload_consumer/partition_update_generator_android.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 183 | ], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 184 | } |
| 185 | |
| 186 | // libupdate_engine_boot_control (type: static_library) |
| 187 | // ======================================================== |
| 188 | // A BootControl class implementation using Android's HIDL boot_control HAL. |
| 189 | cc_defaults { |
| 190 | name: "libupdate_engine_boot_control_exports", |
| 191 | defaults: ["update_metadata-protos_exports"], |
| 192 | |
Yifan Hong | 420db9b | 2019-07-23 20:50:33 -0700 | [diff] [blame] | 193 | static_libs: [ |
David Anderson | e7ce821 | 2019-12-16 20:13:19 -0800 | [diff] [blame] | 194 | "libcutils", |
| 195 | "libfs_mgr_binder", |
| 196 | "libgsi", |
Yifan Hong | dad0af8 | 2020-02-19 17:19:49 -0800 | [diff] [blame] | 197 | "libpayload_consumer", |
Yifan Hong | 420db9b | 2019-07-23 20:50:33 -0700 | [diff] [blame] | 198 | "libsnapshot", |
| 199 | "update_metadata-protos", |
| 200 | ], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 201 | shared_libs: [ |
| 202 | "libbootloader_message", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 203 | "libhidlbase", |
| 204 | "liblp", |
Yifan Hong | d976cc5 | 2020-02-25 14:51:42 -0800 | [diff] [blame] | 205 | "libstatslog", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 206 | "libutils", |
| 207 | "android.hardware.boot@1.0", |
David Anderson | 2111d06 | 2019-10-15 22:36:27 -0700 | [diff] [blame] | 208 | "android.hardware.boot@1.1", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 209 | ], |
Yifan Hong | 2969290 | 2020-03-26 12:47:05 -0700 | [diff] [blame] | 210 | header_libs: [ |
| 211 | "avb_headers", |
| 212 | ], |
Yifan Hong | 420db9b | 2019-07-23 20:50:33 -0700 | [diff] [blame] | 213 | target: { |
| 214 | recovery: { |
David Anderson | e7ce821 | 2019-12-16 20:13:19 -0800 | [diff] [blame] | 215 | static_libs: [ |
| 216 | "libfs_mgr", |
| 217 | "libsnapshot_nobinder", |
| 218 | ], |
| 219 | exclude_static_libs: [ |
| 220 | "libfs_mgr_binder", |
| 221 | "libsnapshot", |
| 222 | ], |
Yifan Hong | 212d795 | 2020-02-04 11:08:08 -0800 | [diff] [blame] | 223 | exclude_shared_libs: [ |
Yifan Hong | d976cc5 | 2020-02-25 14:51:42 -0800 | [diff] [blame] | 224 | "libstatslog", |
Yifan Hong | 212d795 | 2020-02-04 11:08:08 -0800 | [diff] [blame] | 225 | ], |
Yifan Hong | 420db9b | 2019-07-23 20:50:33 -0700 | [diff] [blame] | 226 | }, |
| 227 | }, |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 228 | } |
| 229 | |
| 230 | cc_library_static { |
| 231 | name: "libupdate_engine_boot_control", |
| 232 | defaults: [ |
| 233 | "ue_defaults", |
| 234 | "libupdate_engine_boot_control_exports", |
Yifan Hong | dad0af8 | 2020-02-19 17:19:49 -0800 | [diff] [blame] | 235 | "libpayload_consumer_exports", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 236 | ], |
| 237 | recovery_available: true, |
| 238 | |
| 239 | srcs: [ |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 240 | "aosp/boot_control_android.cc", |
| 241 | "aosp/cleanup_previous_update_action.cc", |
| 242 | "aosp/dynamic_partition_control_android.cc", |
| 243 | "aosp/dynamic_partition_utils.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 244 | ], |
| 245 | } |
| 246 | |
| 247 | // libupdate_engine_android (type: static_library) |
| 248 | // ======================================================== |
| 249 | // The main daemon static_library used in Android (non-Brillo). This only has a |
| 250 | // loop to apply payloads provided by the upper layer via a Binder interface. |
| 251 | cc_defaults { |
| 252 | name: "libupdate_engine_android_exports", |
| 253 | defaults: [ |
| 254 | "ue_defaults", |
| 255 | "libpayload_consumer_exports", |
| 256 | "libupdate_engine_boot_control_exports", |
| 257 | ], |
| 258 | |
| 259 | static_libs: [ |
Yifan Hong | fd6640f | 2020-08-27 19:13:17 -0700 | [diff] [blame] | 260 | "libkver", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 261 | "libpayload_consumer", |
| 262 | "libupdate_engine_boot_control", |
| 263 | ], |
| 264 | shared_libs: [ |
| 265 | "libandroid_net", |
| 266 | "libbase", |
| 267 | "libbinder", |
| 268 | "libbinderwrapper", |
| 269 | "libbootloader_message", |
| 270 | "libbrillo-binder", |
| 271 | "libcurl", |
| 272 | "libcutils", |
Yifan Hong | 2562cf2 | 2020-07-21 19:28:44 -0700 | [diff] [blame] | 273 | "libupdate_engine_stable-cpp", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 274 | "liblog", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 275 | "libssl", |
Tianjie Xu | 75cc9f2 | 2019-08-02 14:53:38 -0700 | [diff] [blame] | 276 | "libstatslog", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 277 | "libutils", |
| 278 | ], |
| 279 | } |
| 280 | |
| 281 | cc_library_static { |
| 282 | name: "libupdate_engine_android", |
| 283 | defaults: [ |
| 284 | "ue_defaults", |
| 285 | "libupdate_engine_android_exports", |
| 286 | ], |
| 287 | |
| 288 | // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved |
| 289 | // out of the DBus interface. |
| 290 | include_dirs: ["external/cros/system_api/dbus"], |
| 291 | |
| 292 | aidl: { |
| 293 | local_include_dirs: ["binder_bindings"], |
| 294 | export_aidl_headers: true, |
| 295 | }, |
| 296 | |
| 297 | srcs: [ |
| 298 | ":libupdate_engine_aidl", |
Amin Hassani | 538bd59 | 2020-11-04 20:46:08 -0800 | [diff] [blame^] | 299 | "common/system_state.cc", |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 300 | "aosp/binder_service_android.cc", |
| 301 | "aosp/binder_service_stable_android.cc", |
| 302 | "aosp/daemon_android.cc", |
| 303 | "aosp/daemon_state_android.cc", |
| 304 | "aosp/hardware_android.cc", |
| 305 | "aosp/logging_android.cc", |
| 306 | "aosp/network_selector_android.cc", |
| 307 | "aosp/update_attempter_android.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 308 | "certificate_checker.cc", |
Amin Hassani | 538bd59 | 2020-11-04 20:46:08 -0800 | [diff] [blame^] | 309 | "download_action.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 310 | "libcurl_http_fetcher.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 311 | "metrics_utils.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 312 | "update_boot_flags_action.cc", |
| 313 | "update_status_utils.cc", |
| 314 | ], |
| 315 | } |
| 316 | |
| 317 | // update_engine (type: executable) |
| 318 | // ======================================================== |
| 319 | // update_engine daemon. |
| 320 | cc_binary { |
| 321 | name: "update_engine", |
| 322 | defaults: [ |
| 323 | "ue_defaults", |
| 324 | "libupdate_engine_android_exports", |
| 325 | ], |
| 326 | |
| 327 | static_libs: ["libupdate_engine_android"], |
Tao Bao | 1e1c86c | 2019-04-18 10:48:32 -0700 | [diff] [blame] | 328 | required: [ |
| 329 | "cacerts_google", |
Tianjie Xu | be4ea23 | 2019-10-15 18:08:31 -0700 | [diff] [blame] | 330 | "otacerts", |
Tao Bao | 1e1c86c | 2019-04-18 10:48:32 -0700 | [diff] [blame] | 331 | ], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 332 | |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 333 | srcs: ["main.cc", "aosp/metrics_reporter_android.cc"], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 334 | init_rc: ["update_engine.rc"], |
| 335 | } |
| 336 | |
| 337 | // update_engine_sideload (type: executable) |
| 338 | // ======================================================== |
| 339 | // A binary executable equivalent to update_engine daemon that installs an update |
| 340 | // from a local file directly instead of running in the background. Used in |
| 341 | // recovery image. |
| 342 | cc_binary { |
| 343 | name: "update_engine_sideload", |
| 344 | defaults: [ |
| 345 | "ue_defaults", |
| 346 | "update_metadata-protos_exports", |
| 347 | "libupdate_engine_boot_control_exports", |
| 348 | "libpayload_consumer_exports", |
| 349 | ], |
| 350 | recovery: true, |
| 351 | |
| 352 | cflags: ["-D_UE_SIDELOAD"], |
| 353 | // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved |
| 354 | // out of the DBus interface. |
| 355 | include_dirs: ["external/cros/system_api/dbus"], |
| 356 | |
| 357 | srcs: [ |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 358 | "aosp/hardware_android.cc", |
| 359 | "aosp/logging_android.cc", |
| 360 | "aosp/sideload_main.cc", |
| 361 | "aosp/update_attempter_android.cc", |
| 362 | "common/metrics_reporter_stub.cc", |
| 363 | "common/network_selector_stub.cc", |
Amin Hassani | 538bd59 | 2020-11-04 20:46:08 -0800 | [diff] [blame^] | 364 | "common/system_state.cc", |
| 365 | "download_action.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 366 | "metrics_utils.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 367 | "update_boot_flags_action.cc", |
| 368 | "update_status_utils.cc", |
| 369 | ], |
| 370 | |
| 371 | // Use commonly used shared libraries. libprotobuf-cpp-lite.so is filtered out, |
| 372 | // as it doesn't look beneficial to be installed separately due to its size. Note |
| 373 | // that we explicitly request their recovery variants, so that the expected files |
| 374 | // will be used and installed. |
| 375 | shared_libs: [ |
| 376 | "libbase", |
| 377 | "liblog", |
| 378 | ], |
| 379 | static_libs: [ |
| 380 | "libpayload_consumer", |
| 381 | "libupdate_engine_boot_control", |
| 382 | "update_metadata-protos", |
| 383 | |
| 384 | // We add the static versions of the shared libraries that are not installed to |
| 385 | // recovery image due to size concerns. Need to include all the static library |
| 386 | // dependencies of these static libraries. |
| 387 | "libevent", |
| 388 | "libmodpb64", |
| 389 | "libgtest_prod", |
| 390 | "libprotobuf-cpp-lite", |
| 391 | "libbrillo-stream", |
| 392 | "libbrillo", |
| 393 | "libchrome", |
Yifan Hong | fd6640f | 2020-08-27 19:13:17 -0700 | [diff] [blame] | 394 | "libkver", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 395 | ], |
| 396 | target: { |
| 397 | recovery: { |
| 398 | exclude_shared_libs: [ |
| 399 | "libprotobuf-cpp-lite", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 400 | "libbrillo-stream", |
| 401 | "libbrillo", |
| 402 | "libchrome", |
| 403 | ], |
| 404 | }, |
| 405 | }, |
| 406 | |
Tao Bao | 1e1c86c | 2019-04-18 10:48:32 -0700 | [diff] [blame] | 407 | required: [ |
Tianjie Xu | be4ea23 | 2019-10-15 18:08:31 -0700 | [diff] [blame] | 408 | "otacerts.recovery", |
Tao Bao | 1e1c86c | 2019-04-18 10:48:32 -0700 | [diff] [blame] | 409 | ], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 410 | } |
| 411 | |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 412 | // update_engine_client (type: executable) |
| 413 | // ======================================================== |
| 414 | // update_engine console client. |
| 415 | cc_binary { |
| 416 | name: "update_engine_client", |
| 417 | defaults: ["ue_defaults"], |
| 418 | |
| 419 | // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved |
| 420 | // out of the DBus interface. |
| 421 | include_dirs: ["external/cros/system_api/dbus"], |
| 422 | |
| 423 | shared_libs: [ |
| 424 | "libbinder", |
| 425 | "libbinderwrapper", |
| 426 | "libbrillo-binder", |
| 427 | "libutils", |
| 428 | ], |
| 429 | |
| 430 | aidl: { |
| 431 | local_include_dirs: ["binder_bindings"], |
| 432 | }, |
| 433 | |
| 434 | srcs: [ |
| 435 | ":libupdate_engine_aidl", |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 436 | "aosp/update_engine_client_android.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 437 | "common/error_code_utils.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 438 | "update_status_utils.cc", |
| 439 | ], |
| 440 | } |
| 441 | |
| 442 | // libpayload_generator (type: static_library) |
| 443 | // ======================================================== |
| 444 | // server-side code. This is used for delta_generator and unittests but not |
| 445 | // for any client code. |
| 446 | cc_defaults { |
| 447 | name: "libpayload_generator_exports", |
| 448 | defaults: [ |
| 449 | "libpayload_consumer_exports", |
| 450 | "update_metadata-protos_exports", |
| 451 | ], |
| 452 | |
Tianjie | 37ae856 | 2020-03-25 15:16:01 -0700 | [diff] [blame] | 453 | header_libs: [ |
| 454 | "bootimg_headers", |
| 455 | ], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 456 | static_libs: [ |
| 457 | "libavb", |
| 458 | "libbrotli", |
| 459 | "libbsdiff", |
| 460 | "libdivsufsort", |
| 461 | "libdivsufsort64", |
| 462 | "liblzma", |
| 463 | "libpayload_consumer", |
| 464 | "libpuffdiff", |
| 465 | "libverity_tree", |
| 466 | "update_metadata-protos", |
| 467 | ], |
| 468 | shared_libs: [ |
| 469 | "libbase", |
| 470 | "libext2fs", |
| 471 | ], |
| 472 | } |
| 473 | |
| 474 | cc_library_static { |
David Anderson | c1c9305 | 2020-08-26 18:22:09 +0000 | [diff] [blame] | 475 | name: "libpayload_extent_ranges", |
| 476 | defaults: [ |
| 477 | "ue_defaults", |
| 478 | ], |
| 479 | host_supported: true, |
| 480 | srcs: [ |
| 481 | "payload_generator/extent_ranges.cc", |
| 482 | ], |
| 483 | static_libs: [ |
| 484 | "update_metadata-protos", |
| 485 | ], |
| 486 | } |
| 487 | |
| 488 | cc_library_static { |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 489 | name: "libpayload_generator", |
| 490 | defaults: [ |
| 491 | "ue_defaults", |
| 492 | "libpayload_generator_exports", |
| 493 | ], |
| 494 | host_supported: true, |
| 495 | |
| 496 | srcs: [ |
Amin Hassani | 538bd59 | 2020-11-04 20:46:08 -0800 | [diff] [blame^] | 497 | "common/system_state.cc", |
| 498 | "download_action.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 499 | "payload_generator/ab_generator.cc", |
| 500 | "payload_generator/annotated_operation.cc", |
| 501 | "payload_generator/blob_file_writer.cc", |
| 502 | "payload_generator/block_mapping.cc", |
| 503 | "payload_generator/boot_img_filesystem.cc", |
| 504 | "payload_generator/bzip.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 505 | "payload_generator/deflate_utils.cc", |
| 506 | "payload_generator/delta_diff_generator.cc", |
| 507 | "payload_generator/delta_diff_utils.cc", |
| 508 | "payload_generator/ext2_filesystem.cc", |
| 509 | "payload_generator/extent_ranges.cc", |
| 510 | "payload_generator/extent_utils.cc", |
| 511 | "payload_generator/full_update_generator.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 512 | "payload_generator/mapfile_filesystem.cc", |
Tianjie | e9156ec | 2020-08-11 11:13:54 -0700 | [diff] [blame] | 513 | "payload_generator/merge_sequence_generator.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 514 | "payload_generator/payload_file.cc", |
| 515 | "payload_generator/payload_generation_config_android.cc", |
| 516 | "payload_generator/payload_generation_config.cc", |
Amin Hassani | 7982100 | 2019-05-06 17:40:49 -0700 | [diff] [blame] | 517 | "payload_generator/payload_properties.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 518 | "payload_generator/payload_signer.cc", |
| 519 | "payload_generator/raw_filesystem.cc", |
| 520 | "payload_generator/squashfs_filesystem.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 521 | "payload_generator/xz_android.cc", |
| 522 | ], |
| 523 | } |
| 524 | |
| 525 | // delta_generator (type: executable) |
| 526 | // ======================================================== |
| 527 | // server-side delta generator. |
| 528 | cc_binary_host { |
| 529 | name: "delta_generator", |
| 530 | defaults: [ |
| 531 | "ue_defaults", |
| 532 | "libpayload_generator_exports", |
| 533 | "libpayload_consumer_exports", |
| 534 | ], |
| 535 | |
| 536 | static_libs: [ |
| 537 | "libavb_host_sysdeps", |
| 538 | "libpayload_consumer", |
| 539 | "libpayload_generator", |
| 540 | ], |
| 541 | |
| 542 | srcs: ["payload_generator/generate_delta_main.cc"], |
| 543 | } |
| 544 | |
| 545 | cc_test { |
| 546 | name: "ue_unittest_delta_generator", |
| 547 | defaults: [ |
| 548 | "ue_defaults", |
| 549 | "libpayload_generator_exports", |
| 550 | "libpayload_consumer_exports", |
| 551 | ], |
| 552 | |
| 553 | static_libs: [ |
| 554 | "libpayload_consumer", |
| 555 | "libpayload_generator", |
| 556 | ], |
| 557 | |
| 558 | srcs: ["payload_generator/generate_delta_main.cc"], |
| 559 | |
| 560 | gtest: false, |
| 561 | stem: "delta_generator", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 562 | } |
| 563 | |
| 564 | // test_http_server (type: executable) |
| 565 | // ======================================================== |
| 566 | // Test HTTP Server. |
| 567 | cc_test { |
| 568 | name: "test_http_server", |
| 569 | defaults: ["ue_defaults"], |
| 570 | srcs: [ |
| 571 | "common/http_common.cc", |
| 572 | "test_http_server.cc", |
| 573 | ], |
| 574 | |
| 575 | gtest: false, |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 576 | } |
| 577 | |
| 578 | // test_subprocess (type: executable) |
| 579 | // ======================================================== |
| 580 | // Test helper subprocess program. |
| 581 | cc_test { |
| 582 | name: "test_subprocess", |
| 583 | defaults: ["ue_defaults"], |
| 584 | srcs: ["test_subprocess.cc"], |
| 585 | |
| 586 | gtest: false, |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 587 | } |
| 588 | |
| 589 | // Public keys for unittests. |
| 590 | // ======================================================== |
| 591 | genrule { |
| 592 | name: "ue_unittest_keys", |
| 593 | cmd: "openssl rsa -in $(location unittest_key.pem) -pubout -out $(location unittest_key.pub.pem) &&" + |
xunchang | cda3c03 | 2019-03-26 15:41:14 -0700 | [diff] [blame] | 594 | "openssl rsa -in $(location unittest_key2.pem) -pubout -out $(location unittest_key2.pub.pem) &&" + |
Tianjie Xu | 7bbe015 | 2019-10-09 18:11:15 -0700 | [diff] [blame] | 595 | "openssl rsa -in $(location unittest_key_RSA4096.pem) -pubout -out $(location unittest_key_RSA4096.pub.pem) &&" + |
| 596 | "openssl pkey -in $(location unittest_key_EC.pem) -pubout -out $(location unittest_key_EC.pub.pem)", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 597 | srcs: [ |
| 598 | "unittest_key.pem", |
| 599 | "unittest_key2.pem", |
xunchang | cda3c03 | 2019-03-26 15:41:14 -0700 | [diff] [blame] | 600 | "unittest_key_RSA4096.pem", |
Tianjie Xu | 7bbe015 | 2019-10-09 18:11:15 -0700 | [diff] [blame] | 601 | "unittest_key_EC.pem", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 602 | ], |
| 603 | out: [ |
| 604 | "unittest_key.pub.pem", |
| 605 | "unittest_key2.pub.pem", |
xunchang | cda3c03 | 2019-03-26 15:41:14 -0700 | [diff] [blame] | 606 | "unittest_key_RSA4096.pub.pem", |
Tianjie Xu | 7bbe015 | 2019-10-09 18:11:15 -0700 | [diff] [blame] | 607 | "unittest_key_EC.pub.pem", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 608 | ], |
| 609 | } |
| 610 | |
| 611 | // Sample images for unittests. |
| 612 | // ======================================================== |
| 613 | // Extract sample image from the compressed sample_images.tar.bz2 file used by |
| 614 | // the unittests. |
| 615 | genrule { |
| 616 | name: "ue_unittest_disk_imgs", |
| 617 | cmd: "tar -jxf $(in) -C $(genDir)/gen disk_ext2_1k.img disk_ext2_4k.img disk_ext2_4k_empty.img disk_ext2_unittest.img", |
| 618 | srcs: ["sample_images/sample_images.tar.bz2"], |
| 619 | out: [ |
| 620 | "gen/disk_ext2_1k.img", |
| 621 | "gen/disk_ext2_4k.img", |
| 622 | "gen/disk_ext2_4k_empty.img", |
| 623 | "gen/disk_ext2_unittest.img", |
| 624 | ], |
| 625 | } |
| 626 | |
| 627 | // update_engine_unittests (type: executable) |
| 628 | // ======================================================== |
| 629 | // Main unittest file. |
| 630 | cc_test { |
| 631 | name: "update_engine_unittests", |
| 632 | defaults: [ |
| 633 | "ue_defaults", |
| 634 | "libpayload_generator_exports", |
| 635 | "libupdate_engine_android_exports", |
| 636 | ], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 637 | |
| 638 | static_libs: [ |
| 639 | "libpayload_generator", |
| 640 | "libbrillo-test-helpers", |
| 641 | "libgmock", |
| 642 | "libchrome_test_helpers", |
| 643 | "libupdate_engine_android", |
Tianjie Xu | 173e619 | 2019-12-10 10:56:01 -0800 | [diff] [blame] | 644 | "libdm", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 645 | ], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 646 | |
Yifan Hong | 87ea73f | 2019-09-12 13:07:37 -0700 | [diff] [blame] | 647 | header_libs: [ |
| 648 | "libstorage_literals_headers", |
| 649 | ], |
| 650 | |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 651 | data: [ |
Tao Bao | 9456b6f | 2019-04-29 18:14:58 -0700 | [diff] [blame] | 652 | ":test_http_server", |
| 653 | ":test_subprocess", |
| 654 | ":ue_unittest_delta_generator", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 655 | ":ue_unittest_disk_imgs", |
| 656 | ":ue_unittest_keys", |
Tianjie Xu | 7a78d63 | 2019-10-08 16:32:39 -0700 | [diff] [blame] | 657 | "otacerts.zip", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 658 | "unittest_key.pem", |
| 659 | "unittest_key2.pem", |
xunchang | cda3c03 | 2019-03-26 15:41:14 -0700 | [diff] [blame] | 660 | "unittest_key_RSA4096.pem", |
Tianjie Xu | 7bbe015 | 2019-10-09 18:11:15 -0700 | [diff] [blame] | 661 | "unittest_key_EC.pem", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 662 | "update_engine.conf", |
| 663 | ], |
| 664 | |
Tao Bao | 9456b6f | 2019-04-29 18:14:58 -0700 | [diff] [blame] | 665 | // We cannot use the default generated AndroidTest.xml because of the use of helper modules |
| 666 | // (i.e. test_http_server, test_subprocess, ue_unittest_delta_generator). |
| 667 | test_config: "test_config.xml", |
| 668 | test_suites: ["device-tests"], |
| 669 | |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 670 | srcs: [ |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 671 | "aosp/dynamic_partition_control_android_unittest.cc", |
| 672 | "aosp/update_attempter_android_unittest.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 673 | "certificate_checker_unittest.cc", |
| 674 | "common/action_pipe_unittest.cc", |
| 675 | "common/action_processor_unittest.cc", |
| 676 | "common/action_unittest.cc", |
| 677 | "common/cpu_limiter_unittest.cc", |
| 678 | "common/fake_prefs.cc", |
| 679 | "common/file_fetcher_unittest.cc", |
| 680 | "common/hash_calculator_unittest.cc", |
| 681 | "common/http_fetcher_unittest.cc", |
| 682 | "common/hwid_override_unittest.cc", |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 683 | "common/metrics_reporter_stub.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 684 | "common/mock_http_fetcher.cc", |
| 685 | "common/prefs_unittest.cc", |
| 686 | "common/proxy_resolver_unittest.cc", |
| 687 | "common/subprocess_unittest.cc", |
| 688 | "common/terminator_unittest.cc", |
| 689 | "common/test_utils.cc", |
| 690 | "common/utils_unittest.cc", |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 691 | "download_action_android_unittest.cc", |
Jae Hoon Kim | 0ae8fe1 | 2019-06-26 14:32:50 -0700 | [diff] [blame] | 692 | "libcurl_http_fetcher_unittest.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 693 | "payload_consumer/bzip_extent_writer_unittest.cc", |
| 694 | "payload_consumer/cached_file_descriptor_unittest.cc", |
Tianjie Xu | 7a78d63 | 2019-10-08 16:32:39 -0700 | [diff] [blame] | 695 | "payload_consumer/certificate_parser_android_unittest.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 696 | "payload_consumer/delta_performer_integration_test.cc", |
| 697 | "payload_consumer/delta_performer_unittest.cc", |
| 698 | "payload_consumer/extent_reader_unittest.cc", |
| 699 | "payload_consumer/extent_writer_unittest.cc", |
| 700 | "payload_consumer/fake_file_descriptor.cc", |
| 701 | "payload_consumer/file_descriptor_utils_unittest.cc", |
| 702 | "payload_consumer/file_writer_unittest.cc", |
| 703 | "payload_consumer/filesystem_verifier_action_unittest.cc", |
Tianjie | 99d570d | 2020-06-04 14:57:19 -0700 | [diff] [blame] | 704 | "payload_consumer/partition_update_generator_android_unittest.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 705 | "payload_consumer/postinstall_runner_action_unittest.cc", |
| 706 | "payload_consumer/verity_writer_android_unittest.cc", |
| 707 | "payload_consumer/xz_extent_writer_unittest.cc", |
| 708 | "payload_generator/ab_generator_unittest.cc", |
| 709 | "payload_generator/blob_file_writer_unittest.cc", |
| 710 | "payload_generator/block_mapping_unittest.cc", |
| 711 | "payload_generator/boot_img_filesystem_unittest.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 712 | "payload_generator/deflate_utils_unittest.cc", |
| 713 | "payload_generator/delta_diff_utils_unittest.cc", |
| 714 | "payload_generator/ext2_filesystem_unittest.cc", |
| 715 | "payload_generator/extent_ranges_unittest.cc", |
| 716 | "payload_generator/extent_utils_unittest.cc", |
| 717 | "payload_generator/fake_filesystem.cc", |
| 718 | "payload_generator/full_update_generator_unittest.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 719 | "payload_generator/mapfile_filesystem_unittest.cc", |
Tianjie | 87af6c0 | 2020-08-11 15:06:26 -0700 | [diff] [blame] | 720 | "payload_generator/merge_sequence_generator_unittest.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 721 | "payload_generator/payload_file_unittest.cc", |
| 722 | "payload_generator/payload_generation_config_android_unittest.cc", |
| 723 | "payload_generator/payload_generation_config_unittest.cc", |
Jae Hoon Kim | 4b6d126 | 2019-06-20 10:41:18 -0700 | [diff] [blame] | 724 | "payload_generator/payload_properties_unittest.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 725 | "payload_generator/payload_signer_unittest.cc", |
| 726 | "payload_generator/squashfs_filesystem_unittest.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 727 | "payload_generator/zip_unittest.cc", |
| 728 | "testrunner.cc", |
Jae Hoon Kim | 916af85 | 2019-08-01 17:45:30 -0700 | [diff] [blame] | 729 | "update_status_utils_unittest.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 730 | ], |
| 731 | } |
| 732 | |
| 733 | // Brillo update payload generation script |
| 734 | // ======================================================== |
Martin Stjernholm | 18e9f3c | 2020-09-08 13:56:59 +0100 | [diff] [blame] | 735 | sh_binary { |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 736 | name: "brillo_update_payload", |
| 737 | device_supported: false, |
| 738 | host_supported: true, |
| 739 | |
Martin Stjernholm | 18e9f3c | 2020-09-08 13:56:59 +0100 | [diff] [blame] | 740 | src: "scripts/brillo_update_payload", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 741 | required: [ |
| 742 | "delta_generator", |
| 743 | "shflags", |
| 744 | "simg2img", |
| 745 | ], |
| 746 | |
| 747 | target: { |
| 748 | darwin: { |
| 749 | enabled: false, |
| 750 | }, |
| 751 | }, |
Colin Cross | 606913a | 2017-11-14 13:05:37 -0800 | [diff] [blame] | 752 | } |
Yifan Hong | d51738c | 2020-07-23 17:06:25 -0700 | [diff] [blame] | 753 | |
| 754 | // update_engine header library |
| 755 | cc_library_headers { |
| 756 | name: "libupdate_engine_headers", |
| 757 | export_include_dirs: ["."], |
| 758 | apex_available: [ |
| 759 | "com.android.gki.*", |
| 760 | ], |
David Anderson | c1c9305 | 2020-08-26 18:22:09 +0000 | [diff] [blame] | 761 | host_supported: true, |
Yifan Hong | d51738c | 2020-07-23 17:06:25 -0700 | [diff] [blame] | 762 | } |