blob: 0a836e43295ff58667dd53edd9e99ec9d5329d6a [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 },
Chih-Hung Hsieh122352d2017-10-02 15:20:07 -070052 cflags: [
53 "-Wall",
54 "-Werror",
Chih-Hung Hsieh122352d2017-10-02 15:20:07 -070055 ],
Tom Cherry37b5ada2017-05-12 17:05:22 -070056}
57
David Anderson43482de2019-12-18 08:01:32 -080058cc_defaults {
59 name: "libfs_mgr_defaults",
Tom Cherry37b5ada2017-05-12 17:05:22 -070060 defaults: ["fs_mgr_defaults"],
61 export_include_dirs: ["include"],
David Anderson07339002023-07-14 12:30:35 -070062 local_include_dirs: ["include/"],
Tom Cherry37b5ada2017-05-12 17:05:22 -070063 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: [
Bart Van Assche0223cd82021-08-06 10:21:12 -070068 "blockdev.cpp",
David Andersonc6512132019-06-10 19:03:01 -070069 "file_wait.cpp",
Tom Cherry37b5ada2017-05-12 17:05:22 -070070 "fs_mgr.cpp",
Tom Cherry37b5ada2017-05-12 17:05:22 -070071 "fs_mgr_format.cpp",
David Anderson62e5b202018-05-01 17:09:17 -070072 "fs_mgr_dm_linear.cpp",
Yifan Hongbf80e7d2018-12-03 13:46:56 -080073 "fs_mgr_roots.cpp",
David Andersonf8f3b622023-07-13 09:25:11 -070074 "fs_mgr_overlayfs_control.cpp",
75 "fs_mgr_overlayfs_mount.cpp",
Justin Yun6bab0a92018-10-29 18:31:48 +090076 "fs_mgr_vendor_overlay.cpp",
David Anderson43482de2019-12-18 08:01:32 -080077 ":libfiemap_srcs",
Jiyong Parke7df1f72017-06-28 11:17:30 +090078 ],
Tao Baoa9fad6c2018-07-25 13:07:31 -070079 shared_libs: [
Jiyong Parke7df1f72017-06-28 11:17:30 +090080 "libbase",
Jiyong Parke7df1f72017-06-28 11:17:30 +090081 "libcrypto",
Tao Bao7aa46082018-08-13 22:25:34 -070082 "libcrypto_utils",
Tao Baoa9fad6c2018-07-25 13:07:31 -070083 "libcutils",
Jiyong Parke7df1f72017-06-28 11:17:30 +090084 "libext4_utils",
Tao Bao7aa46082018-08-13 22:25:34 -070085 "libfec",
Tao Baoa9fad6c2018-07-25 13:07:31 -070086 "liblog",
David Andersonf792e412018-07-27 16:05:31 -070087 "liblp",
Tao Bao7aa46082018-08-13 22:25:34 -070088 "libselinux",
Tao Baoa9fad6c2018-07-25 13:07:31 -070089 ],
90 static_libs: [
Jiyong Parke7df1f72017-06-28 11:17:30 +090091 "libavb",
Bowgo Tsaic1bc2812018-11-26 17:49:23 +080092 "libfs_avb",
Jiyong Parke7df1f72017-06-28 11:17:30 +090093 "libfstab",
Sandeep Patil59f04ee2018-05-30 13:46:55 -070094 "libdm",
David Anderson0e330f12019-01-03 18:16:56 -080095 "libgsi",
Jiyong Parke7df1f72017-06-28 11:17:30 +090096 ],
97 export_static_lib_headers: [
Bowgo Tsaic1bc2812018-11-26 17:49:23 +080098 "libfs_avb",
Jiyong Parke7df1f72017-06-28 11:17:30 +090099 "libfstab",
Sandeep Patil59f04ee2018-05-30 13:46:55 -0700100 "libdm",
David Andersonf792e412018-07-27 16:05:31 -0700101 ],
102 export_shared_lib_headers: [
David Andersonea3b8ac2018-06-07 15:36:09 -0700103 "liblp",
Jiyong Parke7df1f72017-06-28 11:17:30 +0900104 ],
105 whole_static_libs: [
Jin Qian42d81372017-04-21 16:56:34 -0700106 "liblogwrap",
Sandeep Patil59f04ee2018-05-30 13:46:55 -0700107 "libdm",
David Anderson924858c2019-06-26 17:00:00 -0700108 "libext2_uuid",
Paul Crowley7160fc12019-10-25 17:12:45 -0700109 "libfscrypt",
Jiyong Parke7df1f72017-06-28 11:17:30 +0900110 "libfstab",
Tom Cherry37b5ada2017-05-12 17:05:22 -0700111 ],
Tom Cherry31121ca2017-10-10 13:30:57 -0700112 cppflags: [
Tom Cherry31121ca2017-10-10 13:30:57 -0700113 "-DALLOW_ADBD_DISABLE_VERITY=0",
114 ],
Tom Cherry37b5ada2017-05-12 17:05:22 -0700115 product_variables: {
116 debuggable: {
Tom Cherry31121ca2017-10-10 13:30:57 -0700117 cppflags: [
118 "-UALLOW_ADBD_DISABLE_VERITY",
119 "-DALLOW_ADBD_DISABLE_VERITY=1",
120 ],
Tom Cherry37b5ada2017-05-12 17:05:22 -0700121 },
Tom Cherry37b5ada2017-05-12 17:05:22 -0700122 },
David Anderson43482de2019-12-18 08:01:32 -0800123 header_libs: [
124 "libfiemap_headers",
David Andersonc13586f2019-12-17 21:06:15 -0800125 "libstorage_literals_headers",
David Anderson43482de2019-12-18 08:01:32 -0800126 ],
127 export_header_lib_headers: [
128 "libfiemap_headers",
129 ],
Yi-Yo Chiangdb819f52021-07-30 22:22:29 +0800130 target: {
131 platform: {
132 required: [
133 "e2freefrag",
134 "e2fsdroid",
135 ],
136 },
137 recovery: {
138 required: [
139 "e2fsdroid.recovery",
140 ],
141 },
142 },
David Anderson43482de2019-12-18 08:01:32 -0800143}
144
145// Two variants of libfs_mgr are provided: libfs_mgr and libfs_mgr_binder.
146// Use libfs_mgr in recovery, first-stage-init, or when libfiemap or overlayfs
147// is not used.
148//
149// Use libfs_mgr_binder when not in recovery/first-stage init, or when overlayfs
150// or libfiemap is needed. In this case, libfiemap will proxy over binder to
151// gsid.
152cc_library {
153 // Do not ever allow this library to be vendor_available as a shared library.
154 // It does not have a stable interface.
155 name: "libfs_mgr",
Inseob Kim2e200582021-06-11 12:58:53 +0900156 ramdisk_available: true,
David Andersona07503a2021-07-23 10:50:24 -0700157 vendor_ramdisk_available: true,
David Anderson43482de2019-12-18 08:01:32 -0800158 recovery_available: true,
159 defaults: [
160 "libfs_mgr_defaults",
161 ],
162 srcs: [
163 ":libfiemap_passthrough_srcs",
164 ],
165}
166
167cc_library {
168 // Do not ever allow this library to be vendor_available as a shared library.
169 // It does not have a stable interface.
170 name: "libfs_mgr_binder",
171 defaults: [
172 "libfs_mgr_defaults",
173 "libfiemap_binder_defaults",
174 ],
Tom Cherry37b5ada2017-05-12 17:05:22 -0700175}
Jiyong Parke7df1f72017-06-28 11:17:30 +0900176
177cc_library_static {
Tom Cherry066fcdf2018-08-14 12:57:05 -0700178 // Do not ever make this a shared library as long as it is vendor_available.
179 // It does not have a stable interface.
Jiyong Parke7df1f72017-06-28 11:17:30 +0900180 name: "libfstab",
181 vendor_available: true,
Inseob Kim2e200582021-06-11 12:58:53 +0900182 ramdisk_available: true,
David Andersona07503a2021-07-23 10:50:24 -0700183 vendor_ramdisk_available: true,
Jiyong Parka0e75042018-05-24 14:11:00 +0900184 recovery_available: true,
Jiakai Zhangcf16f4d2023-06-23 11:04:17 +0100185 apex_available: [
186 "//apex_available:anyapex",
187 "//apex_available:platform",
188 ],
Bowgo Tsaifa416f92019-01-07 15:30:27 +0800189 host_supported: true,
Jiyong Parke7df1f72017-06-28 11:17:30 +0900190 defaults: ["fs_mgr_defaults"],
David Anderson07339002023-07-14 12:30:35 -0700191 local_include_dirs: ["include/"],
Jiyong Parke7df1f72017-06-28 11:17:30 +0900192 srcs: [
193 "fs_mgr_fstab.cpp",
194 "fs_mgr_boot_config.cpp",
195 "fs_mgr_slotselect.cpp",
196 ],
bohu91c4bd72019-01-11 14:25:58 -0800197 target: {
198 darwin: {
199 enabled: false,
200 },
Hung-ying Tyane7cb09d2020-07-03 14:26:59 +0800201 vendor: {
202 cflags: [
203 // Skipping entries in fstab should only be done in a system
204 // process as the config file is in /system_ext.
205 // Remove the op from the vendor variant.
206 "-DNO_SKIP_MOUNT",
207 ],
208 },
bohu91c4bd72019-01-11 14:25:58 -0800209 },
Jiyong Parke7df1f72017-06-28 11:17:30 +0900210 export_include_dirs: ["include_fstab"],
David Anderson0e330f12019-01-03 18:16:56 -0800211 header_libs: [
212 "libbase_headers",
213 "libgsi_headers",
214 ],
Jiakai Zhangcf16f4d2023-06-23 11:04:17 +0100215 min_sdk_version: "31",
Jiyong Parke7df1f72017-06-28 11:17:30 +0900216}
Mark Salyzyn6b3f5872019-02-20 08:32:36 -0800217
218cc_binary {
219 name: "remount",
220 defaults: ["fs_mgr_defaults"],
Mark Salyzyn1188ce42019-01-25 11:05:40 -0800221 static_libs: [
222 "libavb_user",
Yo Chiangd5429102021-01-21 18:14:47 +0800223 "libgsid",
David Anderson8696a5d2020-06-10 23:50:02 -0700224 "libvold_binder",
Mark Salyzyn1188ce42019-01-25 11:05:40 -0800225 ],
Mark Salyzyn6b3f5872019-02-20 08:32:36 -0800226 shared_libs: [
Mark Salyzyn1188ce42019-01-25 11:05:40 -0800227 "libbootloader_message",
Mark Salyzyn6b3f5872019-02-20 08:32:36 -0800228 "libbase",
David Anderson8696a5d2020-06-10 23:50:02 -0700229 "libbinder",
Mark Salyzync3fc2aa2019-04-30 13:21:04 -0700230 "libcutils",
Mark Salyzyn4469fb12019-01-30 10:19:15 -0800231 "libcrypto",
Mark Salyzync3fc2aa2019-04-30 13:21:04 -0700232 "libext4_utils",
David Andersonc13586f2019-12-17 21:06:15 -0800233 "libfs_mgr_binder",
Mark Salyzync3fc2aa2019-04-30 13:21:04 -0700234 "liblog",
235 "liblp",
236 "libselinux",
Pirama Arumuga Nainarcdf919d2021-08-25 22:14:50 -0700237 "libutils",
Mark Salyzyn6b3f5872019-02-20 08:32:36 -0800238 ],
Mark Salyzyn1188ce42019-01-25 11:05:40 -0800239 header_libs: [
240 "libcutils_headers",
241 ],
Mark Salyzyn6b3f5872019-02-20 08:32:36 -0800242 srcs: [
243 "fs_mgr_remount.cpp",
244 ],
245 cppflags: [
246 "-DALLOW_ADBD_DISABLE_VERITY=0",
247 ],
248 product_variables: {
249 debuggable: {
250 cppflags: [
251 "-UALLOW_ADBD_DISABLE_VERITY",
252 "-DALLOW_ADBD_DISABLE_VERITY=1",
253 ],
David Andersonc13586f2019-12-17 21:06:15 -0800254 init_rc: [
255 "clean_scratch_files.rc",
256 ],
257 },
258 },
Yi-Yo Chiang6455f272021-11-02 21:37:03 +0800259 symlinks: [
260 "clean_scratch_files",
Yi-Yo Chiangad06b402022-09-21 22:10:33 +0800261 "disable-verity",
Yi-Yo Chiange8d85b52022-10-31 19:45:11 +0800262 "enable-verity",
263 "set-verity-state",
Yi-Yo Chiangad06b402022-09-21 22:10:33 +0800264 ],
265}