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