1// Copyright (C) 2018 The Android Open Source Project 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15// *** THIS PACKAGE HAS SPECIAL LICENSING CONDITIONS. PLEASE 16// CONSULT THE OWNERS AND [email protected] BEFORE 17// DEPENDING ON IT IN YOUR PROJECT. *** 18package { 19 default_applicable_licenses: ["bootable_recovery_license"], 20} 21 22// Added automatically by a large-scale-change that took the approach of 23// 'apply every license found to every target'. While this makes sure we respect 24// every license restriction, it may not be entirely correct. 25// 26// e.g. GPL in an MIT project might only apply to the contrib/ directory. 27// 28// Please consider splitting the single license below into multiple licenses, 29// taking care not to lose any license_kind information, and overriding the 30// default license using the 'licenses: [...]' property on targets as needed. 31// 32// For unused files, consider creating a 'fileGroup' with "//visibility:private" 33// to attach the license to, and including a comment whether the files may be 34// used in the current project. 35// See: http://go/android-license-faq 36license { 37 name: "bootable_recovery_license", 38 visibility: [ 39 ":__subpackages__", 40 "//bootable/deprecated-ota:__subpackages__", 41 ], 42 license_kinds: [ 43 "SPDX-license-identifier-Apache-2.0", 44 "SPDX-license-identifier-MIT", 45 "SPDX-license-identifier-OFL", // by exception only 46 ], 47 license_text: [ 48 "NOTICE", 49 ], 50} 51 52soong_config_module_type { 53 name: "recovery_cc_defaults", 54 module_type: "cc_defaults", 55 config_namespace: "recovery", 56 value_variables: ["recovery_api_version"], 57 properties: [ 58 "cflags", 59 ], 60} 61 62recovery_cc_defaults { 63 name: "recovery_defaults", 64 65 soong_config_variables: { 66 recovery_api_version: { 67 cflags: [ 68 "-D_FILE_OFFSET_BITS=64", 69 // Must be the same as RECOVERY_API_VERSION. 70 "-DRECOVERY_API_VERSION=%s", 71 "-Wall", 72 "-Werror", 73 ], 74 }, 75 }, 76} 77 78cc_library_static { 79 name: "librecovery_fastboot", 80 recovery_available: true, 81 defaults: [ 82 "recovery_defaults", 83 ], 84 85 srcs: [ 86 "fastboot/fastboot.cpp", 87 ], 88 89 shared_libs: [ 90 "libbase", 91 "libbootloader_message", 92 "libcutils", 93 "liblog", 94 "librecovery_ui", 95 ], 96 97 static_libs: [ 98 "librecovery_ui_default", 99 ], 100} 101 102cc_defaults { 103 name: "librecovery_defaults", 104 105 defaults: [ 106 "recovery_defaults", 107 ], 108 109 shared_libs: [ 110 "[email protected]", 111 "[email protected]", 112 "android.hardware.boot-V1-ndk", 113 "libboot_control_client", 114 "libbase", 115 "libbootloader_message", 116 "libcrypto", 117 "libcutils", 118 "libfs_mgr", 119 "liblp", 120 "liblog", 121 "libprotobuf-cpp-lite", 122 "libziparchive", 123 ], 124 125 static_libs: [ 126 "libinstall", 127 "librecovery_fastboot", 128 "libminui", 129 "librecovery_utils", 130 "libotautil", 131 "libsnapshot_nobinder", 132 "libsnapshot_cow", 133 "liblz4", 134 "libzstd", 135 "update_metadata-protos", 136 ], 137} 138 139cc_library_static { 140 name: "librecovery", 141 recovery_available: true, 142 143 defaults: [ 144 "librecovery_defaults", 145 ], 146 147 srcs: [ 148 "recovery.cpp", 149 ], 150 151 shared_libs: [ 152 "librecovery_ui", 153 ], 154} 155 156prebuilt_etc { 157 name: "init_recovery.rc", 158 filename: "init.rc", 159 src: "etc/init.rc", 160 sub_dir: "init/hw", 161 recovery: true, 162} 163 164cc_binary { 165 name: "recovery", 166 recovery: true, 167 168 defaults: [ 169 "libinstall_defaults", 170 "librecovery_defaults", 171 "librecovery_utils_defaults", 172 ], 173 174 srcs: [ 175 "recovery_main.cpp", 176 ], 177 178 shared_libs: [ 179 "android.hardware.health-V4-ndk", // from librecovery_utils 180 "android.hardware.boot-V1-ndk", 181 "librecovery_ui", 182 ], 183 184 static_libs: [ 185 "librecovery", 186 "librecovery_ui_default", 187 ], 188 189 required: [ 190 "e2fsdroid.recovery", 191 "init_recovery.rc", 192 "librecovery_ui_ext", 193 "minadbd", 194 "mke2fs.conf.recovery", 195 "mke2fs.recovery", 196 "recovery_deps", 197 "ueventd.rc.recovery", 198 ], 199} 200 201// The dynamic executable that runs after /data mounts. 202cc_binary { 203 name: "recovery-persist", 204 205 defaults: [ 206 "recovery_defaults", 207 ], 208 209 srcs: [ 210 "recovery-persist.cpp", 211 ], 212 213 shared_libs: [ 214 "libbase", 215 "liblog", 216 ], 217 218 static_libs: [ 219 "librecovery_utils", 220 ], 221 222 init_rc: [ 223 "recovery-persist.rc", 224 ], 225} 226 227// The dynamic executable that runs at init. 228cc_binary { 229 name: "recovery-refresh", 230 231 defaults: [ 232 "recovery_defaults", 233 ], 234 235 srcs: [ 236 "recovery-refresh.cpp", 237 ], 238 239 shared_libs: [ 240 "libbase", 241 "liblog", 242 ], 243 244 static_libs: [ 245 "librecovery_utils", 246 ], 247 248 init_rc: [ 249 "recovery-refresh.rc", 250 ], 251} 252 253filegroup { 254 name: "res-testdata", 255 256 srcs: [ 257 "res-*/images/*_text.png", 258 ], 259} 260 261// recovery_deps: A phony target that's depended on by `recovery`, which 262// builds additional modules conditionally based on Makefile variables. 263phony { 264 name: "recovery_deps", 265 recovery: true, 266 required: [ 267 "mkfs.erofs.recovery", 268 "dump.erofs.recovery", 269 "fsck.erofs.recovery", 270 // On A/B devices recovery-persist reads the recovery related file from the persist storage and 271 // copies them into /data/misc/recovery. Then, for both A/B and non-A/B devices, recovery-persist 272 // parses the last_install file and reports the embedded update metrics. Also, the last_install file 273 // will be deteleted after the report. 274 "recovery-persist", 275 ] + select(soong_config_variable("recovery", "target_userimages_use_f2fs"), { 276 true: [ 277 "make_f2fs.recovery", 278 "fsck.f2fs.recovery", 279 "sload_f2fs.recovery", 280 ], 281 default: [], 282 }) + select(soong_config_variable("recovery", "has_board_cacheimage_partition_size"), { 283 false: ["recovery-refresh"], 284 default: [], 285 }), 286} 287 288cc_library_shared { 289 name: "librecovery_ui_ext", 290 recovery: true, 291 install_in_root: true, 292 multilib: { 293 lib32: { 294 relative_install_path: "system/lib", 295 }, 296 lib64: { 297 relative_install_path: "system/lib64", 298 }, 299 }, 300 shared_libs: [ 301 "libbase", 302 "liblog", 303 "librecovery_ui", 304 ], 305 // TARGET_RECOVERY_UI_LIB should be one of librecovery_ui_{default,wear,vr,ethernet} or a 306 // device-specific module that defines make_device() and the exact RecoveryUI class for the 307 // target. It defaults to librecovery_ui_default, which uses ScreenRecoveryUI. 308 whole_static_libs: select(soong_config_variable("recovery", "target_recovery_ui_lib"), { 309 any @ libs: libs, 310 default: ["librecovery_ui_default"], 311 }), 312} 313