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