blob: 51d11881beb748bfbfc8fb0eced7c4f2fe7b30eb [file] [log] [blame]
Tao Baod2f2ad62018-03-23 23:24:25 -07001// Copyright (C) 2018 The Android Open Source Project
Steve Kondika8db4832013-10-19 19:49:20 -07002// Copyright (C) 2019 The LineageOS Project
Tao Baod2f2ad62018-03-23 23:24:25 -07003//
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 Badour29be3f62021-02-12 18:00:57 -080016// *** THIS PACKAGE HAS SPECIAL LICENSING CONDITIONS. PLEASE
17// CONSULT THE OWNERS AND opensource-licensing@google.com BEFORE
18// DEPENDING ON IT IN YOUR PROJECT. ***
19package {
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
37license {
38 name: "bootable_recovery_license",
Kelvin Zhangc7ebad52024-04-05 09:48:10 -070039 visibility: [
40 ":__subpackages__",
41 "//bootable/deprecated-ota:__subpackages__",
42 ],
Bob Badour29be3f62021-02-12 18:00:57 -080043 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 Li6f85be02024-10-23 03:52:54 +000053soong_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
63recovery_cc_defaults {
Tao Baod2f2ad62018-03-23 23:24:25 -070064 name: "recovery_defaults",
65
Nelson Li6f85be02024-10-23 03:52:54 +000066 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 Baod2f2ad62018-03-23 23:24:25 -070077}
78
Hridya Valsaraju20c81b32018-07-27 22:09:12 -070079cc_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 Xu8f397302018-08-20 13:40:47 -070095 "librecovery_ui",
Hridya Valsaraju20c81b32018-07-27 22:09:12 -070096 ],
97
98 static_libs: [
99 "librecovery_ui_default",
100 ],
101}
102
Tao Bao5fc72a12018-08-07 14:38:51 -0700103cc_defaults {
104 name: "librecovery_defaults",
105
106 defaults: [
107 "recovery_defaults",
108 ],
109
110 shared_libs: [
David Anderson89d2d052019-10-15 13:22:20 -0700111 "android.hardware.boot@1.0",
112 "android.hardware.boot@1.1",
Kelvin Zhangfa554fe2022-04-01 14:17:10 -0700113 "android.hardware.boot-V1-ndk",
114 "libboot_control_client",
Tao Bao5fc72a12018-08-07 14:38:51 -0700115 "libbase",
116 "libbootloader_message",
117 "libcrypto",
Tao Bao5fc72a12018-08-07 14:38:51 -0700118 "libcutils",
Tao Bao5fc72a12018-08-07 14:38:51 -0700119 "libfs_mgr",
David Anderson89d2d052019-10-15 13:22:20 -0700120 "liblp",
Tao Bao5fc72a12018-08-07 14:38:51 -0700121 "liblog",
David Anderson89d2d052019-10-15 13:22:20 -0700122 "libprotobuf-cpp-lite",
Tao Bao5fc72a12018-08-07 14:38:51 -0700123 "libziparchive",
Tom Marshallaecfe0e2019-01-04 14:37:31 -0800124 "libvolume_manager",
Tao Bao5fc72a12018-08-07 14:38:51 -0700125 ],
126
127 static_libs: [
Tao Bao0deed332019-04-08 11:26:11 -0700128 "libinstall",
Hridya Valsaraju20c81b32018-07-27 22:09:12 -0700129 "librecovery_fastboot",
Tao Bao5fc72a12018-08-07 14:38:51 -0700130 "libminui",
Tao Baoe3f09a72019-10-01 11:55:36 -0700131 "librecovery_utils",
Tao Bao5fc72a12018-08-07 14:38:51 -0700132 "libotautil",
David Anderson89d2d052019-10-15 13:22:20 -0700133 "libsnapshot_nobinder",
Kelvin Zhang58bbe3c2022-04-12 10:46:56 -0700134 "libsnapshot_cow",
135 "liblz4",
Kelvin Zhang04a94492023-02-15 16:59:29 -0800136 "libzstd",
Yifan Hongacf7d1b2020-04-16 11:04:10 -0700137 "update_metadata-protos",
Tao Bao5fc72a12018-08-07 14:38:51 -0700138 ],
139}
140
141cc_library_static {
142 name: "librecovery",
143 recovery_available: true,
144
145 defaults: [
146 "librecovery_defaults",
147 ],
148
149 srcs: [
Tao Bao5fc72a12018-08-07 14:38:51 -0700150 "recovery.cpp",
Tao Bao5fc72a12018-08-07 14:38:51 -0700151 ],
152
Tianjie Xu8f397302018-08-20 13:40:47 -0700153 shared_libs: [
154 "librecovery_ui",
155 ],
xunchang37304f32019-03-12 12:40:14 -0700156}
157
Tom Cherry24dd3142019-11-04 15:17:17 -0800158prebuilt_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 Bao5fc72a12018-08-07 14:38:51 -0700166cc_binary {
167 name: "recovery",
168 recovery: true,
169
170 defaults: [
xunchang24788852019-03-22 16:08:52 -0700171 "libinstall_defaults",
Tao Bao5fc72a12018-08-07 14:38:51 -0700172 "librecovery_defaults",
Tao Bao832c9cd2019-09-27 23:32:00 -0700173 "librecovery_utils_defaults",
Tao Bao5fc72a12018-08-07 14:38:51 -0700174 ],
175
176 srcs: [
Tao Bao5fc72a12018-08-07 14:38:51 -0700177 "recovery_main.cpp",
Tom Marshallaecfe0e2019-01-04 14:37:31 -0800178 "volclient.cpp",
Tao Bao5fc72a12018-08-07 14:38:51 -0700179 ],
180
181 shared_libs: [
Daniel Zhengb6a21702024-11-12 14:31:20 -0800182 "android.hardware.health-V4-ndk", // from librecovery_utils
Kelvin Zhangfa554fe2022-04-01 14:17:10 -0700183 "android.hardware.boot-V1-ndk",
Tao Bao5fc72a12018-08-07 14:38:51 -0700184 "librecovery_ui",
185 ],
186
187 static_libs: [
Steve Kondika8db4832013-10-19 19:49:20 -0700188 "libc++fs",
Tao Bao5fc72a12018-08-07 14:38:51 -0700189 "librecovery",
190 "librecovery_ui_default",
191 ],
192
193 required: [
194 "e2fsdroid.recovery",
Tom Cherry24dd3142019-11-04 15:17:17 -0800195 "init_recovery.rc",
Tao Bao5fc72a12018-08-07 14:38:51 -0700196 "librecovery_ui_ext",
xunchang34690ce2019-04-05 16:16:07 -0700197 "minadbd",
Tao Bao7c074d92018-08-21 12:31:51 -0700198 "mke2fs.conf.recovery",
Tao Bao5fc72a12018-08-07 14:38:51 -0700199 "mke2fs.recovery",
Steve Kondika8db4832013-10-19 19:49:20 -0700200 "mkshrc.recovery",
201 "reboot.recovery",
Tao Bao5fc72a12018-08-07 14:38:51 -0700202 "recovery_deps",
Tom Cherry24dd3142019-11-04 15:17:17 -0800203 "ueventd.rc.recovery",
Tao Bao5fc72a12018-08-07 14:38:51 -0700204 ],
205}
206
Tao Baod2f2ad62018-03-23 23:24:25 -0700207// The dynamic executable that runs after /data mounts.
208cc_binary {
209 name: "recovery-persist",
210
211 defaults: [
212 "recovery_defaults",
213 ],
214
215 srcs: [
216 "recovery-persist.cpp",
Tao Baod2f2ad62018-03-23 23:24:25 -0700217 ],
218
219 shared_libs: [
220 "libbase",
221 "liblog",
222 ],
223
Jerry Zhang152933a2018-05-02 16:56:00 -0700224 static_libs: [
Tao Baoe3f09a72019-10-01 11:55:36 -0700225 "librecovery_utils",
Jerry Zhang152933a2018-05-02 16:56:00 -0700226 ],
227
Tao Baod2f2ad62018-03-23 23:24:25 -0700228 init_rc: [
229 "recovery-persist.rc",
230 ],
231}
232
233// The dynamic executable that runs at init.
234cc_binary {
235 name: "recovery-refresh",
236
237 defaults: [
238 "recovery_defaults",
239 ],
240
241 srcs: [
242 "recovery-refresh.cpp",
Tao Baod2f2ad62018-03-23 23:24:25 -0700243 ],
244
245 shared_libs: [
246 "libbase",
247 "liblog",
248 ],
249
Jerry Zhang152933a2018-05-02 16:56:00 -0700250 static_libs: [
Tao Baoe3f09a72019-10-01 11:55:36 -0700251 "librecovery_utils",
Jerry Zhang152933a2018-05-02 16:56:00 -0700252 ],
253
Tao Baod2f2ad62018-03-23 23:24:25 -0700254 init_rc: [
255 "recovery-refresh.rc",
256 ],
257}
Tao Baoef5e38f2018-07-24 15:34:39 -0700258
259filegroup {
260 name: "res-testdata",
261
262 srcs: [
263 "res-*/images/*_text.png",
264 ],
265}
Nelson Lifacf3f62024-11-25 09:12:38 +0000266
267// recovery_deps: A phony target that's depended on by `recovery`, which
268// builds additional modules conditionally based on Makefile variables.
269phony {
270 name: "recovery_deps",
Jihoon Kang1a98f012024-12-06 00:35:53 +0000271 recovery: true,
Nelson Lifacf3f62024-11-25 09:12:38 +0000272 required: [
Michael Bestasc9dc5cc2025-03-09 04:40:14 +0200273 "e2fsck.recovery",
274 "resize2fs.recovery",
275 "tune2fs.recovery",
Nelson Lifacf3f62024-11-25 09:12:38 +0000276 "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 Lie93314f2024-11-22 08:52:23 +0000296
297cc_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}