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