blob: d4fc2b9376912c1bd7ea9a1a021dc79b7abcccfe [file] [log] [blame]
Tom Cherry37b5ada2017-05-12 17:05:22 -07001//
2// Copyright (C) 2017 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
Bob Badourd69ad692021-02-16 19:02:14 -080017package {
Bowgo Tsaia8c6b9d2021-06-29 16:05:53 +080018 default_applicable_licenses: [
19 "Android-Apache-2.0",
20 "system_core_fs_mgr_license",
21 ],
Bob Badourd69ad692021-02-16 19:02:14 -080022}
23
24// Added automatically by a large-scale-change that took the approach of
25// 'apply every license found to every target'. While this makes sure we respect
26// every license restriction, it may not be entirely correct.
27//
28// e.g. GPL in an MIT project might only apply to the contrib/ directory.
29//
30// Please consider splitting the single license below into multiple licenses,
31// taking care not to lose any license_kind information, and overriding the
32// default license using the 'licenses: [...]' property on targets as needed.
33//
34// For unused files, consider creating a 'fileGroup' with "//visibility:private"
35// to attach the license to, and including a comment whether the files may be
36// used in the current project.
37// See: http://go/android-license-faq
38license {
39 name: "system_core_fs_mgr_license",
40 visibility: [":__subpackages__"],
41 license_kinds: [
Bob Badourd69ad692021-02-16 19:02:14 -080042 "SPDX-license-identifier-MIT",
43 ],
Bowgo Tsaia8c6b9d2021-06-29 16:05:53 +080044 license_text: ["NOTICE"],
Bob Badourd69ad692021-02-16 19:02:14 -080045}
46
Tom Cherry37b5ada2017-05-12 17:05:22 -070047cc_defaults {
48 name: "fs_mgr_defaults",
49 sanitize: {
50 misc_undefined: ["integer"],
51 },
52 local_include_dirs: ["include/"],
Chih-Hung Hsieh122352d2017-10-02 15:20:07 -070053 cflags: [
54 "-Wall",
55 "-Werror",
Chih-Hung Hsieh122352d2017-10-02 15:20:07 -070056 ],
Tom Cherry37b5ada2017-05-12 17:05:22 -070057}
58
David Anderson43482de2019-12-18 08:01:32 -080059cc_defaults {
60 name: "libfs_mgr_defaults",
Tom Cherry37b5ada2017-05-12 17:05:22 -070061 defaults: ["fs_mgr_defaults"],
62 export_include_dirs: ["include"],
63 include_dirs: ["system/vold"],
David Anderson43482de2019-12-18 08:01:32 -080064 cflags: [
65 "-D_FILE_OFFSET_BITS=64",
66 ],
Tom Cherry37b5ada2017-05-12 17:05:22 -070067 srcs: [
David Andersonc6512132019-06-10 19:03:01 -070068 "file_wait.cpp",
Tom Cherry37b5ada2017-05-12 17:05:22 -070069 "fs_mgr.cpp",
Tom Cherry37b5ada2017-05-12 17:05:22 -070070 "fs_mgr_format.cpp",
Tom Cherry37b5ada2017-05-12 17:05:22 -070071 "fs_mgr_verity.cpp",
David Anderson62e5b202018-05-01 17:09:17 -070072 "fs_mgr_dm_linear.cpp",
Mark Salyzynb28389f2018-06-06 13:10:40 -070073 "fs_mgr_overlayfs.cpp",
Yifan Hongbf80e7d2018-12-03 13:46:56 -080074 "fs_mgr_roots.cpp",
Justin Yun6bab0a92018-10-29 18:31:48 +090075 "fs_mgr_vendor_overlay.cpp",
David Anderson43482de2019-12-18 08:01:32 -080076 ":libfiemap_srcs",
Jiyong Parke7df1f72017-06-28 11:17:30 +090077 ],
Tao Baoa9fad6c2018-07-25 13:07:31 -070078 shared_libs: [
Jiyong Parke7df1f72017-06-28 11:17:30 +090079 "libbase",
Jiyong Parke7df1f72017-06-28 11:17:30 +090080 "libcrypto",
Tao Bao7aa46082018-08-13 22:25:34 -070081 "libcrypto_utils",
Tao Baoa9fad6c2018-07-25 13:07:31 -070082 "libcutils",
Jiyong Parke7df1f72017-06-28 11:17:30 +090083 "libext4_utils",
Tao Bao7aa46082018-08-13 22:25:34 -070084 "libfec",
Tao Baoa9fad6c2018-07-25 13:07:31 -070085 "liblog",
David Andersonf792e412018-07-27 16:05:31 -070086 "liblp",
Tao Bao7aa46082018-08-13 22:25:34 -070087 "libselinux",
Tao Baoa9fad6c2018-07-25 13:07:31 -070088 ],
89 static_libs: [
Jiyong Parke7df1f72017-06-28 11:17:30 +090090 "libavb",
Bowgo Tsaic1bc2812018-11-26 17:49:23 +080091 "libfs_avb",
Jiyong Parke7df1f72017-06-28 11:17:30 +090092 "libfstab",
Sandeep Patil59f04ee2018-05-30 13:46:55 -070093 "libdm",
David Anderson0e330f12019-01-03 18:16:56 -080094 "libgsi",
Jiyong Parke7df1f72017-06-28 11:17:30 +090095 ],
96 export_static_lib_headers: [
Bowgo Tsaic1bc2812018-11-26 17:49:23 +080097 "libfs_avb",
Jiyong Parke7df1f72017-06-28 11:17:30 +090098 "libfstab",
Sandeep Patil59f04ee2018-05-30 13:46:55 -070099 "libdm",
David Andersonf792e412018-07-27 16:05:31 -0700100 ],
101 export_shared_lib_headers: [
David Andersonea3b8ac2018-06-07 15:36:09 -0700102 "liblp",
Jiyong Parke7df1f72017-06-28 11:17:30 +0900103 ],
104 whole_static_libs: [
Jin Qian42d81372017-04-21 16:56:34 -0700105 "liblogwrap",
Sandeep Patil59f04ee2018-05-30 13:46:55 -0700106 "libdm",
David Anderson924858c2019-06-26 17:00:00 -0700107 "libext2_uuid",
Paul Crowley7160fc12019-10-25 17:12:45 -0700108 "libfscrypt",
Jiyong Parke7df1f72017-06-28 11:17:30 +0900109 "libfstab",
Tom Cherry37b5ada2017-05-12 17:05:22 -0700110 ],
Tom Cherry31121ca2017-10-10 13:30:57 -0700111 cppflags: [
Tom Cherry31121ca2017-10-10 13:30:57 -0700112 "-DALLOW_ADBD_DISABLE_VERITY=0",
113 ],
Tom Cherry37b5ada2017-05-12 17:05:22 -0700114 product_variables: {
115 debuggable: {
Tom Cherry31121ca2017-10-10 13:30:57 -0700116 cppflags: [
117 "-UALLOW_ADBD_DISABLE_VERITY",
118 "-DALLOW_ADBD_DISABLE_VERITY=1",
119 ],
Tom Cherry37b5ada2017-05-12 17:05:22 -0700120 },
Tom Cherry37b5ada2017-05-12 17:05:22 -0700121 },
David Anderson43482de2019-12-18 08:01:32 -0800122 header_libs: [
123 "libfiemap_headers",
David Andersonc13586f2019-12-17 21:06:15 -0800124 "libstorage_literals_headers",
David Anderson43482de2019-12-18 08:01:32 -0800125 ],
126 export_header_lib_headers: [
127 "libfiemap_headers",
128 ],
Alessio Balsini843820e2020-01-24 16:08:28 +0000129 required: [
130 "e2freefrag",
131 "e2fsdroid",
132 ],
David Anderson43482de2019-12-18 08:01:32 -0800133}
134
135// Two variants of libfs_mgr are provided: libfs_mgr and libfs_mgr_binder.
136// Use libfs_mgr in recovery, first-stage-init, or when libfiemap or overlayfs
137// is not used.
138//
139// Use libfs_mgr_binder when not in recovery/first-stage init, or when overlayfs
140// or libfiemap is needed. In this case, libfiemap will proxy over binder to
141// gsid.
142cc_library {
143 // Do not ever allow this library to be vendor_available as a shared library.
144 // It does not have a stable interface.
145 name: "libfs_mgr",
Inseob Kim2e200582021-06-11 12:58:53 +0900146 ramdisk_available: true,
David Andersona07503a2021-07-23 10:50:24 -0700147 vendor_ramdisk_available: true,
David Anderson43482de2019-12-18 08:01:32 -0800148 recovery_available: true,
149 defaults: [
150 "libfs_mgr_defaults",
151 ],
152 srcs: [
153 ":libfiemap_passthrough_srcs",
154 ],
155}
156
157cc_library {
158 // Do not ever allow this library to be vendor_available as a shared library.
159 // It does not have a stable interface.
160 name: "libfs_mgr_binder",
161 defaults: [
162 "libfs_mgr_defaults",
163 "libfiemap_binder_defaults",
164 ],
Tom Cherry37b5ada2017-05-12 17:05:22 -0700165}
Jiyong Parke7df1f72017-06-28 11:17:30 +0900166
167cc_library_static {
Tom Cherry066fcdf2018-08-14 12:57:05 -0700168 // Do not ever make this a shared library as long as it is vendor_available.
169 // It does not have a stable interface.
Jiyong Parke7df1f72017-06-28 11:17:30 +0900170 name: "libfstab",
171 vendor_available: true,
Inseob Kim2e200582021-06-11 12:58:53 +0900172 ramdisk_available: true,
David Andersona07503a2021-07-23 10:50:24 -0700173 vendor_ramdisk_available: true,
Jiyong Parka0e75042018-05-24 14:11:00 +0900174 recovery_available: true,
Bowgo Tsaifa416f92019-01-07 15:30:27 +0800175 host_supported: true,
Jiyong Parke7df1f72017-06-28 11:17:30 +0900176 defaults: ["fs_mgr_defaults"],
177 srcs: [
178 "fs_mgr_fstab.cpp",
179 "fs_mgr_boot_config.cpp",
180 "fs_mgr_slotselect.cpp",
181 ],
bohu91c4bd72019-01-11 14:25:58 -0800182 target: {
183 darwin: {
184 enabled: false,
185 },
Hung-ying Tyane7cb09d2020-07-03 14:26:59 +0800186 vendor: {
187 cflags: [
188 // Skipping entries in fstab should only be done in a system
189 // process as the config file is in /system_ext.
190 // Remove the op from the vendor variant.
191 "-DNO_SKIP_MOUNT",
192 ],
193 },
bohu91c4bd72019-01-11 14:25:58 -0800194 },
Jiyong Parke7df1f72017-06-28 11:17:30 +0900195 export_include_dirs: ["include_fstab"],
David Anderson0e330f12019-01-03 18:16:56 -0800196 header_libs: [
197 "libbase_headers",
198 "libgsi_headers",
199 ],
Jiyong Parke7df1f72017-06-28 11:17:30 +0900200}
Mark Salyzyn6b3f5872019-02-20 08:32:36 -0800201
202cc_binary {
203 name: "remount",
204 defaults: ["fs_mgr_defaults"],
Mark Salyzyn1188ce42019-01-25 11:05:40 -0800205 static_libs: [
206 "libavb_user",
Yo Chiangd5429102021-01-21 18:14:47 +0800207 "libgsid",
David Anderson8696a5d2020-06-10 23:50:02 -0700208 "libutils",
209 "libvold_binder",
Mark Salyzyn1188ce42019-01-25 11:05:40 -0800210 ],
Mark Salyzyn6b3f5872019-02-20 08:32:36 -0800211 shared_libs: [
Mark Salyzyn1188ce42019-01-25 11:05:40 -0800212 "libbootloader_message",
Mark Salyzyn6b3f5872019-02-20 08:32:36 -0800213 "libbase",
David Anderson8696a5d2020-06-10 23:50:02 -0700214 "libbinder",
Mark Salyzync3fc2aa2019-04-30 13:21:04 -0700215 "libcutils",
Mark Salyzyn4469fb12019-01-30 10:19:15 -0800216 "libcrypto",
Mark Salyzync3fc2aa2019-04-30 13:21:04 -0700217 "libext4_utils",
Mark Salyzyn4469fb12019-01-30 10:19:15 -0800218 "libfec",
David Andersonc13586f2019-12-17 21:06:15 -0800219 "libfs_mgr_binder",
Mark Salyzync3fc2aa2019-04-30 13:21:04 -0700220 "liblog",
221 "liblp",
222 "libselinux",
Mark Salyzyn6b3f5872019-02-20 08:32:36 -0800223 ],
Mark Salyzyn1188ce42019-01-25 11:05:40 -0800224 header_libs: [
225 "libcutils_headers",
226 ],
Mark Salyzyn6b3f5872019-02-20 08:32:36 -0800227 srcs: [
228 "fs_mgr_remount.cpp",
229 ],
230 cppflags: [
231 "-DALLOW_ADBD_DISABLE_VERITY=0",
232 ],
233 product_variables: {
234 debuggable: {
235 cppflags: [
236 "-UALLOW_ADBD_DISABLE_VERITY",
237 "-DALLOW_ADBD_DISABLE_VERITY=1",
238 ],
239 },
240 },
David Andersonc13586f2019-12-17 21:06:15 -0800241 required: [
242 "clean_scratch_files",
243 ],
244}
245
246cc_binary {
247 name: "clean_scratch_files",
248 defaults: ["fs_mgr_defaults"],
249 shared_libs: [
250 "libbase",
251 "libfs_mgr_binder",
252 ],
253 srcs: [
254 "clean_scratch_files.cpp",
255 ],
256 product_variables: {
257 debuggable: {
258 init_rc: [
259 "clean_scratch_files.rc",
260 ],
261 },
262 },
Mark Salyzyn6b3f5872019-02-20 08:32:36 -0800263}