Tao Bao | d2f2ad6 | 2018-03-23 23:24:25 -0700 | [diff] [blame] | 1 | // Copyright (C) 2018 The Android Open Source Project |
Steve Kondik | a8db483 | 2013-10-19 19:49:20 -0700 | [diff] [blame] | 2 | // Copyright (C) 2019 The LineageOS Project |
Tao Bao | d2f2ad6 | 2018-03-23 23:24:25 -0700 | [diff] [blame] | 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 | |
Bob Badour | 29be3f6 | 2021-02-12 18:00:57 -0800 | [diff] [blame] | 16 | // *** THIS PACKAGE HAS SPECIAL LICENSING CONDITIONS. PLEASE |
| 17 | // CONSULT THE OWNERS AND opensource-licensing@google.com BEFORE |
| 18 | // DEPENDING ON IT IN YOUR PROJECT. *** |
| 19 | package { |
| 20 | default_applicable_licenses: ["bootable_recovery_license"], |
| 21 | } |
| 22 | |
| 23 | // Added automatically by a large-scale-change that took the approach of |
| 24 | // 'apply every license found to every target'. While this makes sure we respect |
| 25 | // every license restriction, it may not be entirely correct. |
| 26 | // |
| 27 | // e.g. GPL in an MIT project might only apply to the contrib/ directory. |
| 28 | // |
| 29 | // Please consider splitting the single license below into multiple licenses, |
| 30 | // taking care not to lose any license_kind information, and overriding the |
| 31 | // default license using the 'licenses: [...]' property on targets as needed. |
| 32 | // |
| 33 | // For unused files, consider creating a 'fileGroup' with "//visibility:private" |
| 34 | // to attach the license to, and including a comment whether the files may be |
| 35 | // used in the current project. |
| 36 | // See: http://go/android-license-faq |
| 37 | license { |
| 38 | name: "bootable_recovery_license", |
Kelvin Zhang | c7ebad5 | 2024-04-05 09:48:10 -0700 | [diff] [blame] | 39 | visibility: [ |
| 40 | ":__subpackages__", |
| 41 | "//bootable/deprecated-ota:__subpackages__", |
| 42 | ], |
Bob Badour | 29be3f6 | 2021-02-12 18:00:57 -0800 | [diff] [blame] | 43 | license_kinds: [ |
| 44 | "SPDX-license-identifier-Apache-2.0", |
| 45 | "SPDX-license-identifier-MIT", |
| 46 | "SPDX-license-identifier-OFL", // by exception only |
| 47 | ], |
| 48 | license_text: [ |
| 49 | "NOTICE", |
| 50 | ], |
| 51 | } |
| 52 | |
Nelson Li | 6f85be0 | 2024-10-23 03:52:54 +0000 | [diff] [blame] | 53 | soong_config_module_type { |
| 54 | name: "recovery_cc_defaults", |
| 55 | module_type: "cc_defaults", |
| 56 | config_namespace: "recovery", |
| 57 | value_variables: ["recovery_api_version"], |
| 58 | properties: [ |
| 59 | "cflags", |
| 60 | ], |
| 61 | } |
| 62 | |
| 63 | recovery_cc_defaults { |
Tao Bao | d2f2ad6 | 2018-03-23 23:24:25 -0700 | [diff] [blame] | 64 | name: "recovery_defaults", |
| 65 | |
Nelson Li | 6f85be0 | 2024-10-23 03:52:54 +0000 | [diff] [blame] | 66 | soong_config_variables: { |
| 67 | recovery_api_version: { |
| 68 | cflags: [ |
| 69 | "-D_FILE_OFFSET_BITS=64", |
| 70 | // Must be the same as RECOVERY_API_VERSION. |
| 71 | "-DRECOVERY_API_VERSION=%s", |
| 72 | "-Wall", |
| 73 | "-Werror", |
| 74 | ], |
| 75 | }, |
| 76 | }, |
Tao Bao | d2f2ad6 | 2018-03-23 23:24:25 -0700 | [diff] [blame] | 77 | } |
| 78 | |
Hridya Valsaraju | 20c81b3 | 2018-07-27 22:09:12 -0700 | [diff] [blame] | 79 | cc_library_static { |
| 80 | name: "librecovery_fastboot", |
| 81 | recovery_available: true, |
| 82 | defaults: [ |
| 83 | "recovery_defaults", |
| 84 | ], |
| 85 | |
| 86 | srcs: [ |
| 87 | "fastboot/fastboot.cpp", |
| 88 | ], |
| 89 | |
| 90 | shared_libs: [ |
| 91 | "libbase", |
| 92 | "libbootloader_message", |
| 93 | "libcutils", |
| 94 | "liblog", |
Tianjie Xu | 8f39730 | 2018-08-20 13:40:47 -0700 | [diff] [blame] | 95 | "librecovery_ui", |
Hridya Valsaraju | 20c81b3 | 2018-07-27 22:09:12 -0700 | [diff] [blame] | 96 | ], |
| 97 | |
| 98 | static_libs: [ |
| 99 | "librecovery_ui_default", |
| 100 | ], |
| 101 | } |
| 102 | |
Tao Bao | 5fc72a1 | 2018-08-07 14:38:51 -0700 | [diff] [blame] | 103 | cc_defaults { |
| 104 | name: "librecovery_defaults", |
| 105 | |
| 106 | defaults: [ |
| 107 | "recovery_defaults", |
| 108 | ], |
| 109 | |
| 110 | shared_libs: [ |
David Anderson | 89d2d05 | 2019-10-15 13:22:20 -0700 | [diff] [blame] | 111 | "android.hardware.boot@1.0", |
| 112 | "android.hardware.boot@1.1", |
Kelvin Zhang | fa554fe | 2022-04-01 14:17:10 -0700 | [diff] [blame] | 113 | "android.hardware.boot-V1-ndk", |
| 114 | "libboot_control_client", |
Tao Bao | 5fc72a1 | 2018-08-07 14:38:51 -0700 | [diff] [blame] | 115 | "libbase", |
| 116 | "libbootloader_message", |
| 117 | "libcrypto", |
Tao Bao | 5fc72a1 | 2018-08-07 14:38:51 -0700 | [diff] [blame] | 118 | "libcutils", |
Tao Bao | 5fc72a1 | 2018-08-07 14:38:51 -0700 | [diff] [blame] | 119 | "libfs_mgr", |
David Anderson | 89d2d05 | 2019-10-15 13:22:20 -0700 | [diff] [blame] | 120 | "liblp", |
Tao Bao | 5fc72a1 | 2018-08-07 14:38:51 -0700 | [diff] [blame] | 121 | "liblog", |
David Anderson | 89d2d05 | 2019-10-15 13:22:20 -0700 | [diff] [blame] | 122 | "libprotobuf-cpp-lite", |
Tao Bao | 5fc72a1 | 2018-08-07 14:38:51 -0700 | [diff] [blame] | 123 | "libziparchive", |
Tom Marshall | aecfe0e | 2019-01-04 14:37:31 -0800 | [diff] [blame] | 124 | "libvolume_manager", |
Tao Bao | 5fc72a1 | 2018-08-07 14:38:51 -0700 | [diff] [blame] | 125 | ], |
| 126 | |
| 127 | static_libs: [ |
Tao Bao | 0deed33 | 2019-04-08 11:26:11 -0700 | [diff] [blame] | 128 | "libinstall", |
Hridya Valsaraju | 20c81b3 | 2018-07-27 22:09:12 -0700 | [diff] [blame] | 129 | "librecovery_fastboot", |
Tao Bao | 5fc72a1 | 2018-08-07 14:38:51 -0700 | [diff] [blame] | 130 | "libminui", |
Tao Bao | e3f09a7 | 2019-10-01 11:55:36 -0700 | [diff] [blame] | 131 | "librecovery_utils", |
Tao Bao | 5fc72a1 | 2018-08-07 14:38:51 -0700 | [diff] [blame] | 132 | "libotautil", |
David Anderson | 89d2d05 | 2019-10-15 13:22:20 -0700 | [diff] [blame] | 133 | "libsnapshot_nobinder", |
Kelvin Zhang | 58bbe3c | 2022-04-12 10:46:56 -0700 | [diff] [blame] | 134 | "libsnapshot_cow", |
| 135 | "liblz4", |
Kelvin Zhang | 04a9449 | 2023-02-15 16:59:29 -0800 | [diff] [blame] | 136 | "libzstd", |
Yifan Hong | acf7d1b | 2020-04-16 11:04:10 -0700 | [diff] [blame] | 137 | "update_metadata-protos", |
Tao Bao | 5fc72a1 | 2018-08-07 14:38:51 -0700 | [diff] [blame] | 138 | ], |
| 139 | } |
| 140 | |
| 141 | cc_library_static { |
| 142 | name: "librecovery", |
| 143 | recovery_available: true, |
| 144 | |
| 145 | defaults: [ |
| 146 | "librecovery_defaults", |
| 147 | ], |
| 148 | |
| 149 | srcs: [ |
Tao Bao | 5fc72a1 | 2018-08-07 14:38:51 -0700 | [diff] [blame] | 150 | "recovery.cpp", |
Tao Bao | 5fc72a1 | 2018-08-07 14:38:51 -0700 | [diff] [blame] | 151 | ], |
| 152 | |
Tianjie Xu | 8f39730 | 2018-08-20 13:40:47 -0700 | [diff] [blame] | 153 | shared_libs: [ |
| 154 | "librecovery_ui", |
| 155 | ], |
xunchang | 37304f3 | 2019-03-12 12:40:14 -0700 | [diff] [blame] | 156 | } |
| 157 | |
Tom Cherry | 24dd314 | 2019-11-04 15:17:17 -0800 | [diff] [blame] | 158 | prebuilt_etc { |
| 159 | name: "init_recovery.rc", |
| 160 | filename: "init.rc", |
| 161 | src: "etc/init.rc", |
| 162 | sub_dir: "init/hw", |
| 163 | recovery: true, |
| 164 | } |
| 165 | |
Tao Bao | 5fc72a1 | 2018-08-07 14:38:51 -0700 | [diff] [blame] | 166 | cc_binary { |
| 167 | name: "recovery", |
| 168 | recovery: true, |
| 169 | |
| 170 | defaults: [ |
xunchang | 2478885 | 2019-03-22 16:08:52 -0700 | [diff] [blame] | 171 | "libinstall_defaults", |
Tao Bao | 5fc72a1 | 2018-08-07 14:38:51 -0700 | [diff] [blame] | 172 | "librecovery_defaults", |
Tao Bao | 832c9cd | 2019-09-27 23:32:00 -0700 | [diff] [blame] | 173 | "librecovery_utils_defaults", |
Tao Bao | 5fc72a1 | 2018-08-07 14:38:51 -0700 | [diff] [blame] | 174 | ], |
| 175 | |
| 176 | srcs: [ |
Tao Bao | 5fc72a1 | 2018-08-07 14:38:51 -0700 | [diff] [blame] | 177 | "recovery_main.cpp", |
Tom Marshall | aecfe0e | 2019-01-04 14:37:31 -0800 | [diff] [blame] | 178 | "volclient.cpp", |
Tao Bao | 5fc72a1 | 2018-08-07 14:38:51 -0700 | [diff] [blame] | 179 | ], |
| 180 | |
| 181 | shared_libs: [ |
Daniel Zheng | b6a2170 | 2024-11-12 14:31:20 -0800 | [diff] [blame] | 182 | "android.hardware.health-V4-ndk", // from librecovery_utils |
Kelvin Zhang | fa554fe | 2022-04-01 14:17:10 -0700 | [diff] [blame] | 183 | "android.hardware.boot-V1-ndk", |
Tao Bao | 5fc72a1 | 2018-08-07 14:38:51 -0700 | [diff] [blame] | 184 | "librecovery_ui", |
| 185 | ], |
| 186 | |
| 187 | static_libs: [ |
Steve Kondik | a8db483 | 2013-10-19 19:49:20 -0700 | [diff] [blame] | 188 | "libc++fs", |
Tao Bao | 5fc72a1 | 2018-08-07 14:38:51 -0700 | [diff] [blame] | 189 | "librecovery", |
| 190 | "librecovery_ui_default", |
| 191 | ], |
| 192 | |
| 193 | required: [ |
| 194 | "e2fsdroid.recovery", |
Tom Cherry | 24dd314 | 2019-11-04 15:17:17 -0800 | [diff] [blame] | 195 | "init_recovery.rc", |
Tao Bao | 5fc72a1 | 2018-08-07 14:38:51 -0700 | [diff] [blame] | 196 | "librecovery_ui_ext", |
xunchang | 34690ce | 2019-04-05 16:16:07 -0700 | [diff] [blame] | 197 | "minadbd", |
Tao Bao | 7c074d9 | 2018-08-21 12:31:51 -0700 | [diff] [blame] | 198 | "mke2fs.conf.recovery", |
Tao Bao | 5fc72a1 | 2018-08-07 14:38:51 -0700 | [diff] [blame] | 199 | "mke2fs.recovery", |
Steve Kondik | a8db483 | 2013-10-19 19:49:20 -0700 | [diff] [blame] | 200 | "mkshrc.recovery", |
| 201 | "reboot.recovery", |
Tao Bao | 5fc72a1 | 2018-08-07 14:38:51 -0700 | [diff] [blame] | 202 | "recovery_deps", |
Tom Cherry | 24dd314 | 2019-11-04 15:17:17 -0800 | [diff] [blame] | 203 | "ueventd.rc.recovery", |
Tao Bao | 5fc72a1 | 2018-08-07 14:38:51 -0700 | [diff] [blame] | 204 | ], |
| 205 | } |
| 206 | |
Tao Bao | d2f2ad6 | 2018-03-23 23:24:25 -0700 | [diff] [blame] | 207 | // The dynamic executable that runs after /data mounts. |
| 208 | cc_binary { |
| 209 | name: "recovery-persist", |
| 210 | |
| 211 | defaults: [ |
| 212 | "recovery_defaults", |
| 213 | ], |
| 214 | |
| 215 | srcs: [ |
| 216 | "recovery-persist.cpp", |
Tao Bao | d2f2ad6 | 2018-03-23 23:24:25 -0700 | [diff] [blame] | 217 | ], |
| 218 | |
| 219 | shared_libs: [ |
| 220 | "libbase", |
| 221 | "liblog", |
| 222 | ], |
| 223 | |
Jerry Zhang | 152933a | 2018-05-02 16:56:00 -0700 | [diff] [blame] | 224 | static_libs: [ |
Tao Bao | e3f09a7 | 2019-10-01 11:55:36 -0700 | [diff] [blame] | 225 | "librecovery_utils", |
Jerry Zhang | 152933a | 2018-05-02 16:56:00 -0700 | [diff] [blame] | 226 | ], |
| 227 | |
Tao Bao | d2f2ad6 | 2018-03-23 23:24:25 -0700 | [diff] [blame] | 228 | init_rc: [ |
| 229 | "recovery-persist.rc", |
| 230 | ], |
| 231 | } |
| 232 | |
| 233 | // The dynamic executable that runs at init. |
| 234 | cc_binary { |
| 235 | name: "recovery-refresh", |
| 236 | |
| 237 | defaults: [ |
| 238 | "recovery_defaults", |
| 239 | ], |
| 240 | |
| 241 | srcs: [ |
| 242 | "recovery-refresh.cpp", |
Tao Bao | d2f2ad6 | 2018-03-23 23:24:25 -0700 | [diff] [blame] | 243 | ], |
| 244 | |
| 245 | shared_libs: [ |
| 246 | "libbase", |
| 247 | "liblog", |
| 248 | ], |
| 249 | |
Jerry Zhang | 152933a | 2018-05-02 16:56:00 -0700 | [diff] [blame] | 250 | static_libs: [ |
Tao Bao | e3f09a7 | 2019-10-01 11:55:36 -0700 | [diff] [blame] | 251 | "librecovery_utils", |
Jerry Zhang | 152933a | 2018-05-02 16:56:00 -0700 | [diff] [blame] | 252 | ], |
| 253 | |
Tao Bao | d2f2ad6 | 2018-03-23 23:24:25 -0700 | [diff] [blame] | 254 | init_rc: [ |
| 255 | "recovery-refresh.rc", |
| 256 | ], |
| 257 | } |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 258 | |
| 259 | filegroup { |
| 260 | name: "res-testdata", |
| 261 | |
| 262 | srcs: [ |
| 263 | "res-*/images/*_text.png", |
| 264 | ], |
| 265 | } |
Nelson Li | facf3f6 | 2024-11-25 09:12:38 +0000 | [diff] [blame] | 266 | |
| 267 | // recovery_deps: A phony target that's depended on by `recovery`, which |
| 268 | // builds additional modules conditionally based on Makefile variables. |
| 269 | phony { |
| 270 | name: "recovery_deps", |
Jihoon Kang | 1a98f01 | 2024-12-06 00:35:53 +0000 | [diff] [blame] | 271 | recovery: true, |
Nelson Li | facf3f6 | 2024-11-25 09:12:38 +0000 | [diff] [blame] | 272 | required: [ |
Michael Bestas | c9dc5cc | 2025-03-09 04:40:14 +0200 | [diff] [blame] | 273 | "e2fsck.recovery", |
| 274 | "resize2fs.recovery", |
| 275 | "tune2fs.recovery", |
Nelson Li | facf3f6 | 2024-11-25 09:12:38 +0000 | [diff] [blame] | 276 | "mkfs.erofs.recovery", |
| 277 | "dump.erofs.recovery", |
| 278 | "fsck.erofs.recovery", |
| 279 | // On A/B devices recovery-persist reads the recovery related file from the persist storage and |
| 280 | // copies them into /data/misc/recovery. Then, for both A/B and non-A/B devices, recovery-persist |
| 281 | // parses the last_install file and reports the embedded update metrics. Also, the last_install file |
| 282 | // will be deteleted after the report. |
| 283 | "recovery-persist", |
| 284 | ] + select(soong_config_variable("recovery", "target_userimages_use_f2fs"), { |
| 285 | true: [ |
| 286 | "make_f2fs.recovery", |
| 287 | "fsck.f2fs.recovery", |
| 288 | "sload_f2fs.recovery", |
| 289 | ], |
| 290 | default: [], |
| 291 | }) + select(soong_config_variable("recovery", "has_board_cacheimage_partition_size"), { |
| 292 | false: ["recovery-refresh"], |
| 293 | default: [], |
| 294 | }), |
| 295 | } |
Nelson Li | e93314f | 2024-11-22 08:52:23 +0000 | [diff] [blame] | 296 | |
| 297 | cc_library_shared { |
| 298 | name: "librecovery_ui_ext", |
| 299 | recovery: true, |
| 300 | install_in_root: true, |
| 301 | multilib: { |
| 302 | lib32: { |
| 303 | relative_install_path: "system/lib", |
| 304 | }, |
| 305 | lib64: { |
| 306 | relative_install_path: "system/lib64", |
| 307 | }, |
| 308 | }, |
| 309 | shared_libs: [ |
| 310 | "libbase", |
| 311 | "liblog", |
| 312 | "librecovery_ui", |
| 313 | ], |
| 314 | // TARGET_RECOVERY_UI_LIB should be one of librecovery_ui_{default,wear,vr,ethernet} or a |
| 315 | // device-specific module that defines make_device() and the exact RecoveryUI class for the |
| 316 | // target. It defaults to librecovery_ui_default, which uses ScreenRecoveryUI. |
| 317 | whole_static_libs: select(soong_config_variable("recovery", "target_recovery_ui_lib"), { |
| 318 | any @ libs: libs, |
| 319 | default: ["librecovery_ui_default"], |
| 320 | }), |
| 321 | } |