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 opensource-licensing@google.com 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
52cc_defaults {
53    name: "recovery_defaults",
54
55    cflags: [
56        "-D_FILE_OFFSET_BITS=64",
57
58        // Must be the same as RECOVERY_API_VERSION.
59        "-DRECOVERY_API_VERSION=3",
60
61        "-Wall",
62        "-Werror",
63    ],
64}
65
66cc_library_static {
67    name: "librecovery_fastboot",
68    recovery_available: true,
69    defaults: [
70        "recovery_defaults",
71    ],
72
73    srcs: [
74        "fastboot/fastboot.cpp",
75    ],
76
77    shared_libs: [
78        "libbase",
79        "libbootloader_message",
80        "libcutils",
81        "liblog",
82        "librecovery_ui",
83    ],
84
85    static_libs: [
86        "librecovery_ui_default",
87    ],
88}
89
90cc_defaults {
91    name: "librecovery_defaults",
92
93    defaults: [
94        "recovery_defaults",
95    ],
96
97    shared_libs: [
98        "android.hardware.boot@1.0",
99        "android.hardware.boot@1.1",
100        "android.hardware.boot-V1-ndk",
101        "libboot_control_client",
102        "libbase",
103        "libbootloader_message",
104        "libcrypto",
105        "libcutils",
106        "libfs_mgr",
107        "liblp",
108        "liblog",
109        "libprotobuf-cpp-lite",
110        "libziparchive",
111    ],
112
113    static_libs: [
114        "libc++fs",
115        "libinstall",
116        "librecovery_fastboot",
117        "libminui",
118        "librecovery_utils",
119        "libotautil",
120        "libsnapshot_nobinder",
121        "libsnapshot_cow",
122        "liblz4",
123        "libzstd",
124        "update_metadata-protos",
125    ],
126}
127
128cc_library_static {
129    name: "librecovery",
130    recovery_available: true,
131
132    defaults: [
133        "librecovery_defaults",
134    ],
135
136    srcs: [
137        "recovery.cpp",
138    ],
139
140    shared_libs: [
141        "librecovery_ui",
142    ],
143}
144
145prebuilt_etc {
146    name: "init_recovery.rc",
147    filename: "init.rc",
148    src: "etc/init.rc",
149    sub_dir: "init/hw",
150    recovery: true,
151}
152
153cc_binary {
154    name: "recovery",
155    recovery: true,
156
157    defaults: [
158        "libinstall_defaults",
159        "librecovery_defaults",
160        "librecovery_utils_defaults",
161    ],
162
163    srcs: [
164        "recovery_main.cpp",
165    ],
166
167    shared_libs: [
168        "android.hardware.health-V3-ndk", // from librecovery_utils
169        "android.hardware.boot-V1-ndk",
170        "librecovery_ui",
171    ],
172
173    static_libs: [
174        "librecovery",
175        "librecovery_ui_default",
176    ],
177
178    required: [
179        "e2fsdroid.recovery",
180        "init_recovery.rc",
181        "librecovery_ui_ext",
182        "minadbd",
183        "mke2fs.conf.recovery",
184        "mke2fs.recovery",
185        "recovery_deps",
186        "ueventd.rc.recovery",
187    ],
188}
189
190// The dynamic executable that runs after /data mounts.
191cc_binary {
192    name: "recovery-persist",
193
194    defaults: [
195        "recovery_defaults",
196    ],
197
198    srcs: [
199        "recovery-persist.cpp",
200    ],
201
202    shared_libs: [
203        "libbase",
204        "liblog",
205    ],
206
207    static_libs: [
208        "librecovery_utils",
209    ],
210
211    init_rc: [
212        "recovery-persist.rc",
213    ],
214}
215
216// The dynamic executable that runs at init.
217cc_binary {
218    name: "recovery-refresh",
219
220    defaults: [
221        "recovery_defaults",
222    ],
223
224    srcs: [
225        "recovery-refresh.cpp",
226    ],
227
228    shared_libs: [
229        "libbase",
230        "liblog",
231    ],
232
233    static_libs: [
234        "librecovery_utils",
235    ],
236
237    init_rc: [
238        "recovery-refresh.rc",
239    ],
240}
241
242filegroup {
243    name: "res-testdata",
244
245    srcs: [
246        "res-*/images/*_text.png",
247    ],
248}
249