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 | dad0af8 | 2020-02-19 17:19:49 -0800 | [diff] [blame^] | 201 | "libpayload_consumer", |
Yifan Hong | 420db9b | 2019-07-23 20:50:33 -0700 | [diff] [blame] | 202 | "libsnapshot", |
| 203 | "update_metadata-protos", |
| 204 | ], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 205 | shared_libs: [ |
| 206 | "libbootloader_message", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 207 | "libhidlbase", |
| 208 | "liblp", |
| 209 | "libutils", |
| 210 | "android.hardware.boot@1.0", |
David Anderson | 2111d06 | 2019-10-15 22:36:27 -0700 | [diff] [blame] | 211 | "android.hardware.boot@1.1", |
Yifan Hong | 212d795 | 2020-02-04 11:08:08 -0800 | [diff] [blame] | 212 | |
| 213 | //TODO(b/148818798): remove when parent bug fixed |
| 214 | "libutilscallstack", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 215 | ], |
Yifan Hong | 420db9b | 2019-07-23 20:50:33 -0700 | [diff] [blame] | 216 | target: { |
| 217 | recovery: { |
David Anderson | e7ce821 | 2019-12-16 20:13:19 -0800 | [diff] [blame] | 218 | static_libs: [ |
| 219 | "libfs_mgr", |
| 220 | "libsnapshot_nobinder", |
| 221 | ], |
| 222 | exclude_static_libs: [ |
| 223 | "libfs_mgr_binder", |
| 224 | "libsnapshot", |
| 225 | ], |
Yifan Hong | 212d795 | 2020-02-04 11:08:08 -0800 | [diff] [blame] | 226 | exclude_shared_libs: [ |
| 227 | "libutilscallstack", |
| 228 | ], |
Yifan Hong | 420db9b | 2019-07-23 20:50:33 -0700 | [diff] [blame] | 229 | }, |
| 230 | }, |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 231 | } |
| 232 | |
| 233 | cc_library_static { |
| 234 | name: "libupdate_engine_boot_control", |
| 235 | defaults: [ |
| 236 | "ue_defaults", |
| 237 | "libupdate_engine_boot_control_exports", |
Yifan Hong | dad0af8 | 2020-02-19 17:19:49 -0800 | [diff] [blame^] | 238 | "libpayload_consumer_exports", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 239 | ], |
| 240 | recovery_available: true, |
| 241 | |
| 242 | srcs: [ |
| 243 | "boot_control_android.cc", |
Yifan Hong | dad0af8 | 2020-02-19 17:19:49 -0800 | [diff] [blame^] | 244 | "cleanup_previous_update_action.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 245 | "dynamic_partition_control_android.cc", |
Yifan Hong | 012508e | 2019-07-22 18:30:40 -0700 | [diff] [blame] | 246 | "dynamic_partition_utils.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 247 | ], |
| 248 | } |
| 249 | |
| 250 | // libupdate_engine_android (type: static_library) |
| 251 | // ======================================================== |
| 252 | // The main daemon static_library used in Android (non-Brillo). This only has a |
| 253 | // loop to apply payloads provided by the upper layer via a Binder interface. |
| 254 | cc_defaults { |
| 255 | name: "libupdate_engine_android_exports", |
| 256 | defaults: [ |
| 257 | "ue_defaults", |
| 258 | "libpayload_consumer_exports", |
| 259 | "libupdate_engine_boot_control_exports", |
| 260 | ], |
| 261 | |
| 262 | static_libs: [ |
| 263 | "libpayload_consumer", |
| 264 | "libupdate_engine_boot_control", |
| 265 | ], |
| 266 | shared_libs: [ |
| 267 | "libandroid_net", |
| 268 | "libbase", |
| 269 | "libbinder", |
| 270 | "libbinderwrapper", |
| 271 | "libbootloader_message", |
| 272 | "libbrillo-binder", |
| 273 | "libcurl", |
| 274 | "libcutils", |
| 275 | "liblog", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 276 | "libssl", |
Tianjie Xu | 75cc9f2 | 2019-08-02 14:53:38 -0700 | [diff] [blame] | 277 | "libstatslog", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 278 | "libutils", |
| 279 | ], |
| 280 | } |
| 281 | |
| 282 | cc_library_static { |
| 283 | name: "libupdate_engine_android", |
| 284 | defaults: [ |
| 285 | "ue_defaults", |
| 286 | "libupdate_engine_android_exports", |
| 287 | ], |
| 288 | |
| 289 | // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved |
| 290 | // out of the DBus interface. |
| 291 | include_dirs: ["external/cros/system_api/dbus"], |
| 292 | |
| 293 | aidl: { |
| 294 | local_include_dirs: ["binder_bindings"], |
| 295 | export_aidl_headers: true, |
| 296 | }, |
| 297 | |
| 298 | srcs: [ |
| 299 | ":libupdate_engine_aidl", |
| 300 | "binder_service_android.cc", |
| 301 | "certificate_checker.cc", |
| 302 | "daemon.cc", |
| 303 | "daemon_state_android.cc", |
| 304 | "hardware_android.cc", |
| 305 | "libcurl_http_fetcher.cc", |
| 306 | "metrics_reporter_android.cc", |
| 307 | "metrics_utils.cc", |
| 308 | "network_selector_android.cc", |
| 309 | "update_attempter_android.cc", |
| 310 | "update_boot_flags_action.cc", |
| 311 | "update_status_utils.cc", |
| 312 | ], |
| 313 | } |
| 314 | |
| 315 | // update_engine (type: executable) |
| 316 | // ======================================================== |
| 317 | // update_engine daemon. |
| 318 | cc_binary { |
| 319 | name: "update_engine", |
| 320 | defaults: [ |
| 321 | "ue_defaults", |
| 322 | "libupdate_engine_android_exports", |
| 323 | ], |
| 324 | |
| 325 | static_libs: ["libupdate_engine_android"], |
Tao Bao | 1e1c86c | 2019-04-18 10:48:32 -0700 | [diff] [blame] | 326 | required: [ |
| 327 | "cacerts_google", |
Tianjie Xu | be4ea23 | 2019-10-15 18:08:31 -0700 | [diff] [blame] | 328 | "otacerts", |
Tao Bao | 1e1c86c | 2019-04-18 10:48:32 -0700 | [diff] [blame] | 329 | ], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 330 | |
| 331 | srcs: ["main.cc"], |
| 332 | init_rc: ["update_engine.rc"], |
| 333 | } |
| 334 | |
| 335 | // update_engine_sideload (type: executable) |
| 336 | // ======================================================== |
| 337 | // A binary executable equivalent to update_engine daemon that installs an update |
| 338 | // from a local file directly instead of running in the background. Used in |
| 339 | // recovery image. |
| 340 | cc_binary { |
| 341 | name: "update_engine_sideload", |
| 342 | defaults: [ |
| 343 | "ue_defaults", |
| 344 | "update_metadata-protos_exports", |
| 345 | "libupdate_engine_boot_control_exports", |
| 346 | "libpayload_consumer_exports", |
| 347 | ], |
| 348 | recovery: true, |
| 349 | |
| 350 | cflags: ["-D_UE_SIDELOAD"], |
| 351 | // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved |
| 352 | // out of the DBus interface. |
| 353 | include_dirs: ["external/cros/system_api/dbus"], |
| 354 | |
| 355 | srcs: [ |
| 356 | "hardware_android.cc", |
| 357 | "metrics_reporter_stub.cc", |
| 358 | "metrics_utils.cc", |
| 359 | "network_selector_stub.cc", |
Yifan Hong | c73cb8c | 2019-10-24 18:28:31 -0700 | [diff] [blame] | 360 | "sideload_logging_android.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 361 | "sideload_main.cc", |
| 362 | "update_attempter_android.cc", |
| 363 | "update_boot_flags_action.cc", |
| 364 | "update_status_utils.cc", |
| 365 | ], |
| 366 | |
| 367 | // Use commonly used shared libraries. libprotobuf-cpp-lite.so is filtered out, |
| 368 | // as it doesn't look beneficial to be installed separately due to its size. Note |
| 369 | // that we explicitly request their recovery variants, so that the expected files |
| 370 | // will be used and installed. |
| 371 | shared_libs: [ |
| 372 | "libbase", |
| 373 | "liblog", |
| 374 | ], |
| 375 | static_libs: [ |
| 376 | "libpayload_consumer", |
| 377 | "libupdate_engine_boot_control", |
| 378 | "update_metadata-protos", |
| 379 | |
| 380 | // We add the static versions of the shared libraries that are not installed to |
| 381 | // recovery image due to size concerns. Need to include all the static library |
| 382 | // dependencies of these static libraries. |
| 383 | "libevent", |
| 384 | "libmodpb64", |
| 385 | "libgtest_prod", |
| 386 | "libprotobuf-cpp-lite", |
| 387 | "libbrillo-stream", |
| 388 | "libbrillo", |
| 389 | "libchrome", |
| 390 | ], |
| 391 | target: { |
| 392 | recovery: { |
| 393 | exclude_shared_libs: [ |
| 394 | "libprotobuf-cpp-lite", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 395 | "libbrillo-stream", |
| 396 | "libbrillo", |
| 397 | "libchrome", |
| 398 | ], |
| 399 | }, |
| 400 | }, |
| 401 | |
Tao Bao | 1e1c86c | 2019-04-18 10:48:32 -0700 | [diff] [blame] | 402 | required: [ |
Tianjie Xu | be4ea23 | 2019-10-15 18:08:31 -0700 | [diff] [blame] | 403 | "otacerts.recovery", |
Tao Bao | 1e1c86c | 2019-04-18 10:48:32 -0700 | [diff] [blame] | 404 | ], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 405 | } |
| 406 | |
| 407 | // libupdate_engine_client (type: shared_library) |
| 408 | // ======================================================== |
| 409 | cc_library_shared { |
| 410 | name: "libupdate_engine_client", |
| 411 | |
| 412 | cflags: [ |
| 413 | "-Wall", |
| 414 | "-Werror", |
| 415 | "-Wno-unused-parameter", |
| 416 | "-DUSE_BINDER=1", |
| 417 | ], |
| 418 | export_include_dirs: ["client_library/include"], |
| 419 | include_dirs: [ |
| 420 | // TODO(deymo): Remove "external/cros/system_api/dbus" when dbus is not used. |
| 421 | "external/cros/system_api/dbus", |
| 422 | "system", |
| 423 | ], |
| 424 | |
| 425 | aidl: { |
| 426 | local_include_dirs: ["binder_bindings"], |
| 427 | }, |
| 428 | |
| 429 | shared_libs: [ |
| 430 | "libchrome", |
| 431 | "libbrillo", |
| 432 | "libbinder", |
| 433 | "libbrillo-binder", |
| 434 | "libutils", |
| 435 | ], |
| 436 | |
| 437 | srcs: [ |
Dan Willemsen | 3c7e4b6 | 2019-06-06 14:56:15 -0700 | [diff] [blame] | 438 | ":libupdate_engine_client_aidl", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 439 | "client_library/client.cc", |
| 440 | "client_library/client_binder.cc", |
| 441 | "parcelable_update_engine_status.cc", |
| 442 | "update_status_utils.cc", |
| 443 | ], |
| 444 | } |
| 445 | |
Dan Willemsen | 3c7e4b6 | 2019-06-06 14:56:15 -0700 | [diff] [blame] | 446 | filegroup { |
| 447 | name: "libupdate_engine_client_aidl", |
| 448 | srcs: [ |
| 449 | "binder_bindings/android/brillo/IUpdateEngine.aidl", |
| 450 | "binder_bindings/android/brillo/IUpdateEngineStatusCallback.aidl", |
| 451 | ], |
| 452 | path: "binder_bindings", |
| 453 | } |
| 454 | |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 455 | // update_engine_client (type: executable) |
| 456 | // ======================================================== |
| 457 | // update_engine console client. |
| 458 | cc_binary { |
| 459 | name: "update_engine_client", |
| 460 | defaults: ["ue_defaults"], |
| 461 | |
| 462 | // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved |
| 463 | // out of the DBus interface. |
| 464 | include_dirs: ["external/cros/system_api/dbus"], |
| 465 | |
| 466 | shared_libs: [ |
| 467 | "libbinder", |
| 468 | "libbinderwrapper", |
| 469 | "libbrillo-binder", |
| 470 | "libutils", |
| 471 | ], |
| 472 | |
| 473 | aidl: { |
| 474 | local_include_dirs: ["binder_bindings"], |
| 475 | }, |
| 476 | |
| 477 | srcs: [ |
| 478 | ":libupdate_engine_aidl", |
| 479 | "common/error_code_utils.cc", |
| 480 | "update_engine_client_android.cc", |
| 481 | "update_status_utils.cc", |
| 482 | ], |
| 483 | } |
| 484 | |
| 485 | // libpayload_generator (type: static_library) |
| 486 | // ======================================================== |
| 487 | // server-side code. This is used for delta_generator and unittests but not |
| 488 | // for any client code. |
| 489 | cc_defaults { |
| 490 | name: "libpayload_generator_exports", |
| 491 | defaults: [ |
| 492 | "libpayload_consumer_exports", |
| 493 | "update_metadata-protos_exports", |
| 494 | ], |
| 495 | |
| 496 | static_libs: [ |
| 497 | "libavb", |
| 498 | "libbrotli", |
| 499 | "libbsdiff", |
| 500 | "libdivsufsort", |
| 501 | "libdivsufsort64", |
| 502 | "liblzma", |
| 503 | "libpayload_consumer", |
| 504 | "libpuffdiff", |
| 505 | "libverity_tree", |
| 506 | "update_metadata-protos", |
| 507 | ], |
| 508 | shared_libs: [ |
| 509 | "libbase", |
| 510 | "libext2fs", |
| 511 | ], |
| 512 | } |
| 513 | |
| 514 | cc_library_static { |
| 515 | name: "libpayload_generator", |
| 516 | defaults: [ |
| 517 | "ue_defaults", |
| 518 | "libpayload_generator_exports", |
| 519 | ], |
| 520 | host_supported: true, |
| 521 | |
| 522 | srcs: [ |
| 523 | "payload_generator/ab_generator.cc", |
| 524 | "payload_generator/annotated_operation.cc", |
| 525 | "payload_generator/blob_file_writer.cc", |
| 526 | "payload_generator/block_mapping.cc", |
| 527 | "payload_generator/boot_img_filesystem.cc", |
| 528 | "payload_generator/bzip.cc", |
| 529 | "payload_generator/cycle_breaker.cc", |
| 530 | "payload_generator/deflate_utils.cc", |
| 531 | "payload_generator/delta_diff_generator.cc", |
| 532 | "payload_generator/delta_diff_utils.cc", |
| 533 | "payload_generator/ext2_filesystem.cc", |
| 534 | "payload_generator/extent_ranges.cc", |
| 535 | "payload_generator/extent_utils.cc", |
| 536 | "payload_generator/full_update_generator.cc", |
| 537 | "payload_generator/graph_types.cc", |
| 538 | "payload_generator/graph_utils.cc", |
| 539 | "payload_generator/inplace_generator.cc", |
| 540 | "payload_generator/mapfile_filesystem.cc", |
| 541 | "payload_generator/payload_file.cc", |
| 542 | "payload_generator/payload_generation_config_android.cc", |
| 543 | "payload_generator/payload_generation_config.cc", |
| 544 | "payload_generator/payload_signer.cc", |
| 545 | "payload_generator/raw_filesystem.cc", |
| 546 | "payload_generator/squashfs_filesystem.cc", |
| 547 | "payload_generator/tarjan.cc", |
| 548 | "payload_generator/topological_sort.cc", |
| 549 | "payload_generator/xz_android.cc", |
| 550 | ], |
| 551 | } |
| 552 | |
| 553 | // delta_generator (type: executable) |
| 554 | // ======================================================== |
| 555 | // server-side delta generator. |
| 556 | cc_binary_host { |
| 557 | name: "delta_generator", |
| 558 | defaults: [ |
| 559 | "ue_defaults", |
| 560 | "libpayload_generator_exports", |
| 561 | "libpayload_consumer_exports", |
| 562 | ], |
| 563 | |
| 564 | static_libs: [ |
| 565 | "libavb_host_sysdeps", |
| 566 | "libpayload_consumer", |
| 567 | "libpayload_generator", |
| 568 | ], |
| 569 | |
| 570 | srcs: ["payload_generator/generate_delta_main.cc"], |
| 571 | } |
| 572 | |
| 573 | cc_test { |
| 574 | name: "ue_unittest_delta_generator", |
| 575 | defaults: [ |
| 576 | "ue_defaults", |
| 577 | "libpayload_generator_exports", |
| 578 | "libpayload_consumer_exports", |
| 579 | ], |
| 580 | |
| 581 | static_libs: [ |
| 582 | "libpayload_consumer", |
| 583 | "libpayload_generator", |
| 584 | ], |
| 585 | |
| 586 | srcs: ["payload_generator/generate_delta_main.cc"], |
| 587 | |
| 588 | gtest: false, |
| 589 | stem: "delta_generator", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 590 | } |
| 591 | |
| 592 | // test_http_server (type: executable) |
| 593 | // ======================================================== |
| 594 | // Test HTTP Server. |
| 595 | cc_test { |
| 596 | name: "test_http_server", |
| 597 | defaults: ["ue_defaults"], |
| 598 | srcs: [ |
| 599 | "common/http_common.cc", |
| 600 | "test_http_server.cc", |
| 601 | ], |
| 602 | |
| 603 | gtest: false, |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 604 | } |
| 605 | |
| 606 | // test_subprocess (type: executable) |
| 607 | // ======================================================== |
| 608 | // Test helper subprocess program. |
| 609 | cc_test { |
| 610 | name: "test_subprocess", |
| 611 | defaults: ["ue_defaults"], |
| 612 | srcs: ["test_subprocess.cc"], |
| 613 | |
| 614 | gtest: false, |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 615 | } |
| 616 | |
| 617 | // Public keys for unittests. |
| 618 | // ======================================================== |
| 619 | genrule { |
| 620 | name: "ue_unittest_keys", |
| 621 | 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] | 622 | "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] | 623 | "openssl rsa -in $(location unittest_key_RSA4096.pem) -pubout -out $(location unittest_key_RSA4096.pub.pem) &&" + |
| 624 | "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] | 625 | srcs: [ |
| 626 | "unittest_key.pem", |
| 627 | "unittest_key2.pem", |
xunchang | cda3c03 | 2019-03-26 15:41:14 -0700 | [diff] [blame] | 628 | "unittest_key_RSA4096.pem", |
Tianjie Xu | 7bbe015 | 2019-10-09 18:11:15 -0700 | [diff] [blame] | 629 | "unittest_key_EC.pem", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 630 | ], |
| 631 | out: [ |
| 632 | "unittest_key.pub.pem", |
| 633 | "unittest_key2.pub.pem", |
xunchang | cda3c03 | 2019-03-26 15:41:14 -0700 | [diff] [blame] | 634 | "unittest_key_RSA4096.pub.pem", |
Tianjie Xu | 7bbe015 | 2019-10-09 18:11:15 -0700 | [diff] [blame] | 635 | "unittest_key_EC.pub.pem", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 636 | ], |
| 637 | } |
| 638 | |
| 639 | // Sample images for unittests. |
| 640 | // ======================================================== |
| 641 | // Extract sample image from the compressed sample_images.tar.bz2 file used by |
| 642 | // the unittests. |
| 643 | genrule { |
| 644 | name: "ue_unittest_disk_imgs", |
| 645 | cmd: "tar -jxf $(in) -C $(genDir)/gen disk_ext2_1k.img disk_ext2_4k.img disk_ext2_4k_empty.img disk_ext2_unittest.img", |
| 646 | srcs: ["sample_images/sample_images.tar.bz2"], |
| 647 | out: [ |
| 648 | "gen/disk_ext2_1k.img", |
| 649 | "gen/disk_ext2_4k.img", |
| 650 | "gen/disk_ext2_4k_empty.img", |
| 651 | "gen/disk_ext2_unittest.img", |
| 652 | ], |
| 653 | } |
| 654 | |
| 655 | // update_engine_unittests (type: executable) |
| 656 | // ======================================================== |
| 657 | // Main unittest file. |
| 658 | cc_test { |
| 659 | name: "update_engine_unittests", |
| 660 | defaults: [ |
| 661 | "ue_defaults", |
| 662 | "libpayload_generator_exports", |
| 663 | "libupdate_engine_android_exports", |
| 664 | ], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 665 | |
| 666 | static_libs: [ |
| 667 | "libpayload_generator", |
| 668 | "libbrillo-test-helpers", |
| 669 | "libgmock", |
| 670 | "libchrome_test_helpers", |
| 671 | "libupdate_engine_android", |
Tianjie Xu | 173e619 | 2019-12-10 10:56:01 -0800 | [diff] [blame] | 672 | "libdm", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 673 | ], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 674 | |
Yifan Hong | 87ea73f | 2019-09-12 13:07:37 -0700 | [diff] [blame] | 675 | header_libs: [ |
| 676 | "libstorage_literals_headers", |
| 677 | ], |
| 678 | |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 679 | data: [ |
Tao Bao | 9456b6f | 2019-04-29 18:14:58 -0700 | [diff] [blame] | 680 | ":test_http_server", |
| 681 | ":test_subprocess", |
| 682 | ":ue_unittest_delta_generator", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 683 | ":ue_unittest_disk_imgs", |
| 684 | ":ue_unittest_keys", |
Tianjie Xu | 7a78d63 | 2019-10-08 16:32:39 -0700 | [diff] [blame] | 685 | "otacerts.zip", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 686 | "unittest_key.pem", |
| 687 | "unittest_key2.pem", |
xunchang | cda3c03 | 2019-03-26 15:41:14 -0700 | [diff] [blame] | 688 | "unittest_key_RSA4096.pem", |
Tianjie Xu | 7bbe015 | 2019-10-09 18:11:15 -0700 | [diff] [blame] | 689 | "unittest_key_EC.pem", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 690 | "update_engine.conf", |
| 691 | ], |
| 692 | |
Tao Bao | 9456b6f | 2019-04-29 18:14:58 -0700 | [diff] [blame] | 693 | // We cannot use the default generated AndroidTest.xml because of the use of helper modules |
| 694 | // (i.e. test_http_server, test_subprocess, ue_unittest_delta_generator). |
| 695 | test_config: "test_config.xml", |
| 696 | test_suites: ["device-tests"], |
| 697 | |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 698 | srcs: [ |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 699 | "certificate_checker_unittest.cc", |
| 700 | "common/action_pipe_unittest.cc", |
| 701 | "common/action_processor_unittest.cc", |
| 702 | "common/action_unittest.cc", |
| 703 | "common/cpu_limiter_unittest.cc", |
| 704 | "common/fake_prefs.cc", |
| 705 | "common/file_fetcher_unittest.cc", |
| 706 | "common/hash_calculator_unittest.cc", |
| 707 | "common/http_fetcher_unittest.cc", |
| 708 | "common/hwid_override_unittest.cc", |
| 709 | "common/mock_http_fetcher.cc", |
| 710 | "common/prefs_unittest.cc", |
| 711 | "common/proxy_resolver_unittest.cc", |
| 712 | "common/subprocess_unittest.cc", |
| 713 | "common/terminator_unittest.cc", |
| 714 | "common/test_utils.cc", |
| 715 | "common/utils_unittest.cc", |
Yifan Hong | c049f93 | 2019-07-23 15:06:05 -0700 | [diff] [blame] | 716 | "dynamic_partition_control_android_unittest.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 717 | "payload_consumer/bzip_extent_writer_unittest.cc", |
| 718 | "payload_consumer/cached_file_descriptor_unittest.cc", |
Tianjie Xu | 7a78d63 | 2019-10-08 16:32:39 -0700 | [diff] [blame] | 719 | "payload_consumer/certificate_parser_android_unittest.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 720 | "payload_consumer/delta_performer_integration_test.cc", |
| 721 | "payload_consumer/delta_performer_unittest.cc", |
| 722 | "payload_consumer/extent_reader_unittest.cc", |
| 723 | "payload_consumer/extent_writer_unittest.cc", |
| 724 | "payload_consumer/fake_file_descriptor.cc", |
| 725 | "payload_consumer/file_descriptor_utils_unittest.cc", |
| 726 | "payload_consumer/file_writer_unittest.cc", |
| 727 | "payload_consumer/filesystem_verifier_action_unittest.cc", |
| 728 | "payload_consumer/postinstall_runner_action_unittest.cc", |
| 729 | "payload_consumer/verity_writer_android_unittest.cc", |
| 730 | "payload_consumer/xz_extent_writer_unittest.cc", |
| 731 | "payload_generator/ab_generator_unittest.cc", |
| 732 | "payload_generator/blob_file_writer_unittest.cc", |
| 733 | "payload_generator/block_mapping_unittest.cc", |
| 734 | "payload_generator/boot_img_filesystem_unittest.cc", |
| 735 | "payload_generator/cycle_breaker_unittest.cc", |
| 736 | "payload_generator/deflate_utils_unittest.cc", |
| 737 | "payload_generator/delta_diff_utils_unittest.cc", |
| 738 | "payload_generator/ext2_filesystem_unittest.cc", |
| 739 | "payload_generator/extent_ranges_unittest.cc", |
| 740 | "payload_generator/extent_utils_unittest.cc", |
| 741 | "payload_generator/fake_filesystem.cc", |
| 742 | "payload_generator/full_update_generator_unittest.cc", |
| 743 | "payload_generator/graph_utils_unittest.cc", |
| 744 | "payload_generator/inplace_generator_unittest.cc", |
| 745 | "payload_generator/mapfile_filesystem_unittest.cc", |
| 746 | "payload_generator/payload_file_unittest.cc", |
| 747 | "payload_generator/payload_generation_config_android_unittest.cc", |
| 748 | "payload_generator/payload_generation_config_unittest.cc", |
| 749 | "payload_generator/payload_signer_unittest.cc", |
| 750 | "payload_generator/squashfs_filesystem_unittest.cc", |
| 751 | "payload_generator/tarjan_unittest.cc", |
| 752 | "payload_generator/topological_sort_unittest.cc", |
| 753 | "payload_generator/zip_unittest.cc", |
| 754 | "testrunner.cc", |
| 755 | "update_attempter_android_unittest.cc", |
| 756 | ], |
| 757 | } |
| 758 | |
| 759 | // Brillo update payload generation script |
| 760 | // ======================================================== |
| 761 | cc_prebuilt_binary { |
| 762 | name: "brillo_update_payload", |
| 763 | device_supported: false, |
| 764 | host_supported: true, |
| 765 | |
| 766 | srcs: ["scripts/brillo_update_payload"], |
| 767 | required: [ |
| 768 | "delta_generator", |
| 769 | "shflags", |
| 770 | "simg2img", |
| 771 | ], |
| 772 | |
| 773 | target: { |
| 774 | darwin: { |
| 775 | enabled: false, |
| 776 | }, |
| 777 | }, |
Colin Cross | 606913a | 2017-11-14 13:05:37 -0800 | [diff] [blame] | 778 | } |
Ralph Nathan | ab8026c | 2018-08-08 15:43:02 -0700 | [diff] [blame] | 779 | |
| 780 | // AIDL interface between libupdate_engine and the Things jar. |
| 781 | filegroup { |
| 782 | name: "things_update_engine_aidl", |
| 783 | srcs: [ |
| 784 | "binder_bindings/android/brillo/IUpdateEngine.aidl", |
| 785 | "binder_bindings/android/brillo/IUpdateEngineStatusCallback.aidl", |
| 786 | ], |
| 787 | } |