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", |
| 181 | "payload_consumer/postinstall_runner_action.cc", |
| 182 | "payload_consumer/verity_writer_android.cc", |
| 183 | "payload_consumer/xz_extent_writer.cc", |
| 184 | "payload_consumer/fec_file_descriptor.cc", |
Tianjie | d3865d1 | 2020-06-03 15:25:17 -0700 | [diff] [blame] | 185 | "payload_consumer/partition_update_generator_android.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 186 | ], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 187 | } |
| 188 | |
| 189 | // libupdate_engine_boot_control (type: static_library) |
| 190 | // ======================================================== |
| 191 | // A BootControl class implementation using Android's HIDL boot_control HAL. |
| 192 | cc_defaults { |
| 193 | name: "libupdate_engine_boot_control_exports", |
| 194 | defaults: ["update_metadata-protos_exports"], |
| 195 | |
Yifan Hong | 420db9b | 2019-07-23 20:50:33 -0700 | [diff] [blame] | 196 | static_libs: [ |
David Anderson | e7ce821 | 2019-12-16 20:13:19 -0800 | [diff] [blame] | 197 | "libcutils", |
| 198 | "libfs_mgr_binder", |
| 199 | "libgsi", |
Yifan Hong | dad0af8 | 2020-02-19 17:19:49 -0800 | [diff] [blame] | 200 | "libpayload_consumer", |
Yifan Hong | 420db9b | 2019-07-23 20:50:33 -0700 | [diff] [blame] | 201 | "libsnapshot", |
| 202 | "update_metadata-protos", |
| 203 | ], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 204 | shared_libs: [ |
| 205 | "libbootloader_message", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 206 | "libhidlbase", |
| 207 | "liblp", |
Yifan Hong | d976cc5 | 2020-02-25 14:51:42 -0800 | [diff] [blame] | 208 | "libstatslog", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 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", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 212 | ], |
Yifan Hong | 2969290 | 2020-03-26 12:47:05 -0700 | [diff] [blame] | 213 | header_libs: [ |
| 214 | "avb_headers", |
| 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: [ |
Yifan Hong | d976cc5 | 2020-02-25 14:51:42 -0800 | [diff] [blame] | 227 | "libstatslog", |
Yifan Hong | 212d795 | 2020-02-04 11:08:08 -0800 | [diff] [blame] | 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: [ |
Yifan Hong | fd6640f | 2020-08-27 19:13:17 -0700 | [diff] [blame] | 263 | "libkver", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 264 | "libpayload_consumer", |
| 265 | "libupdate_engine_boot_control", |
| 266 | ], |
| 267 | shared_libs: [ |
| 268 | "libandroid_net", |
| 269 | "libbase", |
| 270 | "libbinder", |
| 271 | "libbinderwrapper", |
| 272 | "libbootloader_message", |
| 273 | "libbrillo-binder", |
| 274 | "libcurl", |
| 275 | "libcutils", |
Yifan Hong | 2562cf2 | 2020-07-21 19:28:44 -0700 | [diff] [blame] | 276 | "libupdate_engine_stable-cpp", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 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", |
Yifan Hong | 2562cf2 | 2020-07-21 19:28:44 -0700 | [diff] [blame] | 303 | "binder_service_stable_android.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 304 | "certificate_checker.cc", |
Amin Hassani | 565331e | 2019-06-24 14:11:29 -0700 | [diff] [blame] | 305 | "daemon_android.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 306 | "daemon_state_android.cc", |
| 307 | "hardware_android.cc", |
| 308 | "libcurl_http_fetcher.cc", |
Yifan Hong | c80de2d | 2020-02-25 17:13:53 -0800 | [diff] [blame] | 309 | "logging_android.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 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 | |
Kelvin Zhang | a6e1812 | 2020-08-06 15:53:25 -0400 | [diff] [blame] | 334 | srcs: ["main.cc", "metrics_reporter_android.cc"], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 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", |
Yifan Hong | e757420 | 2020-04-06 15:08:24 -0700 | [diff] [blame] | 360 | "logging_android.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 361 | "metrics_reporter_stub.cc", |
| 362 | "metrics_utils.cc", |
| 363 | "network_selector_stub.cc", |
| 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", |
Yifan Hong | fd6640f | 2020-08-27 19:13:17 -0700 | [diff] [blame] | 393 | "libkver", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 394 | ], |
| 395 | target: { |
| 396 | recovery: { |
| 397 | exclude_shared_libs: [ |
| 398 | "libprotobuf-cpp-lite", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 399 | "libbrillo-stream", |
| 400 | "libbrillo", |
| 401 | "libchrome", |
| 402 | ], |
| 403 | }, |
| 404 | }, |
| 405 | |
Tao Bao | 1e1c86c | 2019-04-18 10:48:32 -0700 | [diff] [blame] | 406 | required: [ |
Tianjie Xu | be4ea23 | 2019-10-15 18:08:31 -0700 | [diff] [blame] | 407 | "otacerts.recovery", |
Tao Bao | 1e1c86c | 2019-04-18 10:48:32 -0700 | [diff] [blame] | 408 | ], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 409 | } |
| 410 | |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 411 | // update_engine_client (type: executable) |
| 412 | // ======================================================== |
| 413 | // update_engine console client. |
| 414 | cc_binary { |
| 415 | name: "update_engine_client", |
| 416 | defaults: ["ue_defaults"], |
| 417 | |
| 418 | // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved |
| 419 | // out of the DBus interface. |
| 420 | include_dirs: ["external/cros/system_api/dbus"], |
| 421 | |
| 422 | shared_libs: [ |
| 423 | "libbinder", |
| 424 | "libbinderwrapper", |
| 425 | "libbrillo-binder", |
| 426 | "libutils", |
| 427 | ], |
| 428 | |
| 429 | aidl: { |
| 430 | local_include_dirs: ["binder_bindings"], |
| 431 | }, |
| 432 | |
| 433 | srcs: [ |
| 434 | ":libupdate_engine_aidl", |
| 435 | "common/error_code_utils.cc", |
| 436 | "update_engine_client_android.cc", |
| 437 | "update_status_utils.cc", |
| 438 | ], |
| 439 | } |
| 440 | |
| 441 | // libpayload_generator (type: static_library) |
| 442 | // ======================================================== |
| 443 | // server-side code. This is used for delta_generator and unittests but not |
| 444 | // for any client code. |
| 445 | cc_defaults { |
| 446 | name: "libpayload_generator_exports", |
| 447 | defaults: [ |
| 448 | "libpayload_consumer_exports", |
| 449 | "update_metadata-protos_exports", |
| 450 | ], |
| 451 | |
Tianjie | 37ae856 | 2020-03-25 15:16:01 -0700 | [diff] [blame] | 452 | header_libs: [ |
| 453 | "bootimg_headers", |
| 454 | ], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 455 | static_libs: [ |
| 456 | "libavb", |
| 457 | "libbrotli", |
| 458 | "libbsdiff", |
| 459 | "libdivsufsort", |
| 460 | "libdivsufsort64", |
| 461 | "liblzma", |
| 462 | "libpayload_consumer", |
| 463 | "libpuffdiff", |
| 464 | "libverity_tree", |
| 465 | "update_metadata-protos", |
| 466 | ], |
| 467 | shared_libs: [ |
| 468 | "libbase", |
| 469 | "libext2fs", |
| 470 | ], |
| 471 | } |
| 472 | |
| 473 | cc_library_static { |
David Anderson | c1c9305 | 2020-08-26 18:22:09 +0000 | [diff] [blame] | 474 | name: "libpayload_extent_ranges", |
| 475 | defaults: [ |
| 476 | "ue_defaults", |
| 477 | ], |
| 478 | host_supported: true, |
| 479 | srcs: [ |
| 480 | "payload_generator/extent_ranges.cc", |
| 481 | ], |
| 482 | static_libs: [ |
| 483 | "update_metadata-protos", |
| 484 | ], |
| 485 | } |
| 486 | |
| 487 | cc_library_static { |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 488 | name: "libpayload_generator", |
| 489 | defaults: [ |
| 490 | "ue_defaults", |
| 491 | "libpayload_generator_exports", |
| 492 | ], |
| 493 | host_supported: true, |
| 494 | |
| 495 | srcs: [ |
| 496 | "payload_generator/ab_generator.cc", |
| 497 | "payload_generator/annotated_operation.cc", |
| 498 | "payload_generator/blob_file_writer.cc", |
| 499 | "payload_generator/block_mapping.cc", |
| 500 | "payload_generator/boot_img_filesystem.cc", |
| 501 | "payload_generator/bzip.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 502 | "payload_generator/deflate_utils.cc", |
| 503 | "payload_generator/delta_diff_generator.cc", |
| 504 | "payload_generator/delta_diff_utils.cc", |
| 505 | "payload_generator/ext2_filesystem.cc", |
| 506 | "payload_generator/extent_ranges.cc", |
| 507 | "payload_generator/extent_utils.cc", |
| 508 | "payload_generator/full_update_generator.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 509 | "payload_generator/mapfile_filesystem.cc", |
Tianjie | e9156ec | 2020-08-11 11:13:54 -0700 | [diff] [blame] | 510 | "payload_generator/merge_sequence_generator.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 511 | "payload_generator/payload_file.cc", |
| 512 | "payload_generator/payload_generation_config_android.cc", |
| 513 | "payload_generator/payload_generation_config.cc", |
Amin Hassani | 7982100 | 2019-05-06 17:40:49 -0700 | [diff] [blame] | 514 | "payload_generator/payload_properties.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 515 | "payload_generator/payload_signer.cc", |
| 516 | "payload_generator/raw_filesystem.cc", |
| 517 | "payload_generator/squashfs_filesystem.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 518 | "payload_generator/xz_android.cc", |
| 519 | ], |
| 520 | } |
| 521 | |
| 522 | // delta_generator (type: executable) |
| 523 | // ======================================================== |
| 524 | // server-side delta generator. |
| 525 | cc_binary_host { |
| 526 | name: "delta_generator", |
| 527 | defaults: [ |
| 528 | "ue_defaults", |
| 529 | "libpayload_generator_exports", |
| 530 | "libpayload_consumer_exports", |
| 531 | ], |
| 532 | |
| 533 | static_libs: [ |
| 534 | "libavb_host_sysdeps", |
| 535 | "libpayload_consumer", |
| 536 | "libpayload_generator", |
| 537 | ], |
| 538 | |
| 539 | srcs: ["payload_generator/generate_delta_main.cc"], |
| 540 | } |
| 541 | |
| 542 | cc_test { |
| 543 | name: "ue_unittest_delta_generator", |
| 544 | defaults: [ |
| 545 | "ue_defaults", |
| 546 | "libpayload_generator_exports", |
| 547 | "libpayload_consumer_exports", |
| 548 | ], |
| 549 | |
| 550 | static_libs: [ |
| 551 | "libpayload_consumer", |
| 552 | "libpayload_generator", |
| 553 | ], |
| 554 | |
| 555 | srcs: ["payload_generator/generate_delta_main.cc"], |
| 556 | |
| 557 | gtest: false, |
| 558 | stem: "delta_generator", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 559 | } |
| 560 | |
| 561 | // test_http_server (type: executable) |
| 562 | // ======================================================== |
| 563 | // Test HTTP Server. |
| 564 | cc_test { |
| 565 | name: "test_http_server", |
| 566 | defaults: ["ue_defaults"], |
| 567 | srcs: [ |
| 568 | "common/http_common.cc", |
| 569 | "test_http_server.cc", |
| 570 | ], |
| 571 | |
| 572 | gtest: false, |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 573 | } |
| 574 | |
| 575 | // test_subprocess (type: executable) |
| 576 | // ======================================================== |
| 577 | // Test helper subprocess program. |
| 578 | cc_test { |
| 579 | name: "test_subprocess", |
| 580 | defaults: ["ue_defaults"], |
| 581 | srcs: ["test_subprocess.cc"], |
| 582 | |
| 583 | gtest: false, |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 584 | } |
| 585 | |
| 586 | // Public keys for unittests. |
| 587 | // ======================================================== |
| 588 | genrule { |
| 589 | name: "ue_unittest_keys", |
| 590 | 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] | 591 | "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] | 592 | "openssl rsa -in $(location unittest_key_RSA4096.pem) -pubout -out $(location unittest_key_RSA4096.pub.pem) &&" + |
| 593 | "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] | 594 | srcs: [ |
| 595 | "unittest_key.pem", |
| 596 | "unittest_key2.pem", |
xunchang | cda3c03 | 2019-03-26 15:41:14 -0700 | [diff] [blame] | 597 | "unittest_key_RSA4096.pem", |
Tianjie Xu | 7bbe015 | 2019-10-09 18:11:15 -0700 | [diff] [blame] | 598 | "unittest_key_EC.pem", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 599 | ], |
| 600 | out: [ |
| 601 | "unittest_key.pub.pem", |
| 602 | "unittest_key2.pub.pem", |
xunchang | cda3c03 | 2019-03-26 15:41:14 -0700 | [diff] [blame] | 603 | "unittest_key_RSA4096.pub.pem", |
Tianjie Xu | 7bbe015 | 2019-10-09 18:11:15 -0700 | [diff] [blame] | 604 | "unittest_key_EC.pub.pem", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 605 | ], |
| 606 | } |
| 607 | |
| 608 | // Sample images for unittests. |
| 609 | // ======================================================== |
| 610 | // Extract sample image from the compressed sample_images.tar.bz2 file used by |
| 611 | // the unittests. |
| 612 | genrule { |
| 613 | name: "ue_unittest_disk_imgs", |
| 614 | cmd: "tar -jxf $(in) -C $(genDir)/gen disk_ext2_1k.img disk_ext2_4k.img disk_ext2_4k_empty.img disk_ext2_unittest.img", |
| 615 | srcs: ["sample_images/sample_images.tar.bz2"], |
| 616 | out: [ |
| 617 | "gen/disk_ext2_1k.img", |
| 618 | "gen/disk_ext2_4k.img", |
| 619 | "gen/disk_ext2_4k_empty.img", |
| 620 | "gen/disk_ext2_unittest.img", |
| 621 | ], |
| 622 | } |
| 623 | |
| 624 | // update_engine_unittests (type: executable) |
| 625 | // ======================================================== |
| 626 | // Main unittest file. |
| 627 | cc_test { |
| 628 | name: "update_engine_unittests", |
| 629 | defaults: [ |
| 630 | "ue_defaults", |
| 631 | "libpayload_generator_exports", |
| 632 | "libupdate_engine_android_exports", |
| 633 | ], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 634 | |
| 635 | static_libs: [ |
| 636 | "libpayload_generator", |
| 637 | "libbrillo-test-helpers", |
| 638 | "libgmock", |
| 639 | "libchrome_test_helpers", |
| 640 | "libupdate_engine_android", |
Tianjie Xu | 173e619 | 2019-12-10 10:56:01 -0800 | [diff] [blame] | 641 | "libdm", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 642 | ], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 643 | |
Yifan Hong | 87ea73f | 2019-09-12 13:07:37 -0700 | [diff] [blame] | 644 | header_libs: [ |
| 645 | "libstorage_literals_headers", |
| 646 | ], |
| 647 | |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 648 | data: [ |
Tao Bao | 9456b6f | 2019-04-29 18:14:58 -0700 | [diff] [blame] | 649 | ":test_http_server", |
| 650 | ":test_subprocess", |
| 651 | ":ue_unittest_delta_generator", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 652 | ":ue_unittest_disk_imgs", |
| 653 | ":ue_unittest_keys", |
Tianjie Xu | 7a78d63 | 2019-10-08 16:32:39 -0700 | [diff] [blame] | 654 | "otacerts.zip", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 655 | "unittest_key.pem", |
| 656 | "unittest_key2.pem", |
xunchang | cda3c03 | 2019-03-26 15:41:14 -0700 | [diff] [blame] | 657 | "unittest_key_RSA4096.pem", |
Tianjie Xu | 7bbe015 | 2019-10-09 18:11:15 -0700 | [diff] [blame] | 658 | "unittest_key_EC.pem", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 659 | "update_engine.conf", |
| 660 | ], |
| 661 | |
Tao Bao | 9456b6f | 2019-04-29 18:14:58 -0700 | [diff] [blame] | 662 | // We cannot use the default generated AndroidTest.xml because of the use of helper modules |
| 663 | // (i.e. test_http_server, test_subprocess, ue_unittest_delta_generator). |
| 664 | test_config: "test_config.xml", |
| 665 | test_suites: ["device-tests"], |
| 666 | |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 667 | srcs: [ |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 668 | "certificate_checker_unittest.cc", |
| 669 | "common/action_pipe_unittest.cc", |
| 670 | "common/action_processor_unittest.cc", |
| 671 | "common/action_unittest.cc", |
| 672 | "common/cpu_limiter_unittest.cc", |
| 673 | "common/fake_prefs.cc", |
| 674 | "common/file_fetcher_unittest.cc", |
| 675 | "common/hash_calculator_unittest.cc", |
| 676 | "common/http_fetcher_unittest.cc", |
| 677 | "common/hwid_override_unittest.cc", |
| 678 | "common/mock_http_fetcher.cc", |
| 679 | "common/prefs_unittest.cc", |
| 680 | "common/proxy_resolver_unittest.cc", |
| 681 | "common/subprocess_unittest.cc", |
| 682 | "common/terminator_unittest.cc", |
| 683 | "common/test_utils.cc", |
| 684 | "common/utils_unittest.cc", |
Yifan Hong | c049f93 | 2019-07-23 15:06:05 -0700 | [diff] [blame] | 685 | "dynamic_partition_control_android_unittest.cc", |
Jae Hoon Kim | 0ae8fe1 | 2019-06-26 14:32:50 -0700 | [diff] [blame] | 686 | "libcurl_http_fetcher_unittest.cc", |
Yifan Hong | fd6640f | 2020-08-27 19:13:17 -0700 | [diff] [blame] | 687 | "hardware_android_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 | 9dd9305 | 2020-07-21 17:31:19 -0400 | [diff] [blame] | 693 | "payload_consumer/download_action_android_unittest.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 694 | "payload_consumer/extent_reader_unittest.cc", |
| 695 | "payload_consumer/extent_writer_unittest.cc", |
| 696 | "payload_consumer/fake_file_descriptor.cc", |
| 697 | "payload_consumer/file_descriptor_utils_unittest.cc", |
| 698 | "payload_consumer/file_writer_unittest.cc", |
| 699 | "payload_consumer/filesystem_verifier_action_unittest.cc", |
Tianjie | 99d570d | 2020-06-04 14:57:19 -0700 | [diff] [blame] | 700 | "payload_consumer/partition_update_generator_android_unittest.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 701 | "payload_consumer/postinstall_runner_action_unittest.cc", |
| 702 | "payload_consumer/verity_writer_android_unittest.cc", |
| 703 | "payload_consumer/xz_extent_writer_unittest.cc", |
| 704 | "payload_generator/ab_generator_unittest.cc", |
| 705 | "payload_generator/blob_file_writer_unittest.cc", |
| 706 | "payload_generator/block_mapping_unittest.cc", |
| 707 | "payload_generator/boot_img_filesystem_unittest.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 708 | "payload_generator/deflate_utils_unittest.cc", |
| 709 | "payload_generator/delta_diff_utils_unittest.cc", |
| 710 | "payload_generator/ext2_filesystem_unittest.cc", |
| 711 | "payload_generator/extent_ranges_unittest.cc", |
| 712 | "payload_generator/extent_utils_unittest.cc", |
| 713 | "payload_generator/fake_filesystem.cc", |
| 714 | "payload_generator/full_update_generator_unittest.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 715 | "payload_generator/mapfile_filesystem_unittest.cc", |
Tianjie | 87af6c0 | 2020-08-11 15:06:26 -0700 | [diff] [blame] | 716 | "payload_generator/merge_sequence_generator_unittest.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 717 | "payload_generator/payload_file_unittest.cc", |
| 718 | "payload_generator/payload_generation_config_android_unittest.cc", |
| 719 | "payload_generator/payload_generation_config_unittest.cc", |
Jae Hoon Kim | 4b6d126 | 2019-06-20 10:41:18 -0700 | [diff] [blame] | 720 | "payload_generator/payload_properties_unittest.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 721 | "payload_generator/payload_signer_unittest.cc", |
| 722 | "payload_generator/squashfs_filesystem_unittest.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 723 | "payload_generator/zip_unittest.cc", |
| 724 | "testrunner.cc", |
| 725 | "update_attempter_android_unittest.cc", |
Jae Hoon Kim | 916af85 | 2019-08-01 17:45:30 -0700 | [diff] [blame] | 726 | "update_status_utils_unittest.cc", |
Kelvin Zhang | a6e1812 | 2020-08-06 15:53:25 -0400 | [diff] [blame] | 727 | "metrics_reporter_stub.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 728 | ], |
| 729 | } |
| 730 | |
| 731 | // Brillo update payload generation script |
| 732 | // ======================================================== |
Martin Stjernholm | 18e9f3c | 2020-09-08 13:56:59 +0100 | [diff] [blame] | 733 | sh_binary { |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 734 | name: "brillo_update_payload", |
| 735 | device_supported: false, |
| 736 | host_supported: true, |
| 737 | |
Martin Stjernholm | 18e9f3c | 2020-09-08 13:56:59 +0100 | [diff] [blame] | 738 | src: "scripts/brillo_update_payload", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 739 | required: [ |
| 740 | "delta_generator", |
| 741 | "shflags", |
| 742 | "simg2img", |
| 743 | ], |
| 744 | |
| 745 | target: { |
| 746 | darwin: { |
| 747 | enabled: false, |
| 748 | }, |
| 749 | }, |
Colin Cross | 606913a | 2017-11-14 13:05:37 -0800 | [diff] [blame] | 750 | } |
Yifan Hong | d51738c | 2020-07-23 17:06:25 -0700 | [diff] [blame] | 751 | |
| 752 | // update_engine header library |
| 753 | cc_library_headers { |
| 754 | name: "libupdate_engine_headers", |
| 755 | export_include_dirs: ["."], |
| 756 | apex_available: [ |
| 757 | "com.android.gki.*", |
David Anderson | 5e6dfe3 | 2020-09-17 15:50:33 -0700 | [diff] [blame^] | 758 | "//apex_available:platform", |
Yifan Hong | d51738c | 2020-07-23 17:06:25 -0700 | [diff] [blame] | 759 | ], |
David Anderson | c1c9305 | 2020-08-26 18:22:09 +0000 | [diff] [blame] | 760 | host_supported: true, |
David Anderson | 5e6dfe3 | 2020-09-17 15:50:33 -0700 | [diff] [blame^] | 761 | recovery_available: true, |
| 762 | ramdisk_available: true, |
| 763 | |
| 764 | target: { |
| 765 | darwin: { |
| 766 | enabled: false, |
| 767 | }, |
| 768 | } |
Yifan Hong | d51738c | 2020-07-23 17:06:25 -0700 | [diff] [blame] | 769 | } |