blob: ac784b249a9232bbb18d12dcb2c297c0119d782c [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
17cc_defaults {
18 name: "fs_mgr_defaults",
19 sanitize: {
20 misc_undefined: ["integer"],
21 },
22 local_include_dirs: ["include/"],
Chih-Hung Hsieh122352d2017-10-02 15:20:07 -070023 cflags: [
24 "-Wall",
25 "-Werror",
Chih-Hung Hsieh122352d2017-10-02 15:20:07 -070026 ],
Tom Cherry37b5ada2017-05-12 17:05:22 -070027}
28
David Anderson43482de2019-12-18 08:01:32 -080029cc_defaults {
30 name: "libfs_mgr_defaults",
Tom Cherry37b5ada2017-05-12 17:05:22 -070031 defaults: ["fs_mgr_defaults"],
32 export_include_dirs: ["include"],
33 include_dirs: ["system/vold"],
David Anderson43482de2019-12-18 08:01:32 -080034 cflags: [
35 "-D_FILE_OFFSET_BITS=64",
36 ],
Tom Cherry37b5ada2017-05-12 17:05:22 -070037 srcs: [
David Andersonc6512132019-06-10 19:03:01 -070038 "file_wait.cpp",
Tom Cherry37b5ada2017-05-12 17:05:22 -070039 "fs_mgr.cpp",
Tom Cherry37b5ada2017-05-12 17:05:22 -070040 "fs_mgr_format.cpp",
Tom Cherry37b5ada2017-05-12 17:05:22 -070041 "fs_mgr_verity.cpp",
David Anderson62e5b202018-05-01 17:09:17 -070042 "fs_mgr_dm_linear.cpp",
Mark Salyzynb28389f2018-06-06 13:10:40 -070043 "fs_mgr_overlayfs.cpp",
Yifan Hongbf80e7d2018-12-03 13:46:56 -080044 "fs_mgr_roots.cpp",
Justin Yun6bab0a92018-10-29 18:31:48 +090045 "fs_mgr_vendor_overlay.cpp",
David Anderson43482de2019-12-18 08:01:32 -080046 ":libfiemap_srcs",
Jiyong Parke7df1f72017-06-28 11:17:30 +090047 ],
Tao Baoa9fad6c2018-07-25 13:07:31 -070048 shared_libs: [
Jiyong Parke7df1f72017-06-28 11:17:30 +090049 "libbase",
Jiyong Parke7df1f72017-06-28 11:17:30 +090050 "libcrypto",
Tao Bao7aa46082018-08-13 22:25:34 -070051 "libcrypto_utils",
Tao Baoa9fad6c2018-07-25 13:07:31 -070052 "libcutils",
Jiyong Parke7df1f72017-06-28 11:17:30 +090053 "libext4_utils",
Tao Bao7aa46082018-08-13 22:25:34 -070054 "libfec",
Tao Baoa9fad6c2018-07-25 13:07:31 -070055 "liblog",
David Andersonf792e412018-07-27 16:05:31 -070056 "liblp",
Tao Bao7aa46082018-08-13 22:25:34 -070057 "libselinux",
Tao Baoa9fad6c2018-07-25 13:07:31 -070058 ],
59 static_libs: [
Jiyong Parke7df1f72017-06-28 11:17:30 +090060 "libavb",
Bowgo Tsaic1bc2812018-11-26 17:49:23 +080061 "libfs_avb",
Jiyong Parke7df1f72017-06-28 11:17:30 +090062 "libfstab",
Sandeep Patil59f04ee2018-05-30 13:46:55 -070063 "libdm",
David Anderson0e330f12019-01-03 18:16:56 -080064 "libgsi",
Jiyong Parke7df1f72017-06-28 11:17:30 +090065 ],
66 export_static_lib_headers: [
Bowgo Tsaic1bc2812018-11-26 17:49:23 +080067 "libfs_avb",
Jiyong Parke7df1f72017-06-28 11:17:30 +090068 "libfstab",
Sandeep Patil59f04ee2018-05-30 13:46:55 -070069 "libdm",
David Andersonf792e412018-07-27 16:05:31 -070070 ],
71 export_shared_lib_headers: [
David Andersonea3b8ac2018-06-07 15:36:09 -070072 "liblp",
Jiyong Parke7df1f72017-06-28 11:17:30 +090073 ],
74 whole_static_libs: [
Jin Qian42d81372017-04-21 16:56:34 -070075 "liblogwrap",
Sandeep Patil59f04ee2018-05-30 13:46:55 -070076 "libdm",
David Anderson924858c2019-06-26 17:00:00 -070077 "libext2_uuid",
Paul Crowley7160fc12019-10-25 17:12:45 -070078 "libfscrypt",
Jiyong Parke7df1f72017-06-28 11:17:30 +090079 "libfstab",
Tom Cherry37b5ada2017-05-12 17:05:22 -070080 ],
Tom Cherry31121ca2017-10-10 13:30:57 -070081 cppflags: [
Tom Cherry31121ca2017-10-10 13:30:57 -070082 "-DALLOW_ADBD_DISABLE_VERITY=0",
83 ],
Tom Cherry37b5ada2017-05-12 17:05:22 -070084 product_variables: {
85 debuggable: {
Tom Cherry31121ca2017-10-10 13:30:57 -070086 cppflags: [
87 "-UALLOW_ADBD_DISABLE_VERITY",
88 "-DALLOW_ADBD_DISABLE_VERITY=1",
89 ],
Tom Cherry37b5ada2017-05-12 17:05:22 -070090 },
Tom Cherry37b5ada2017-05-12 17:05:22 -070091 },
David Anderson43482de2019-12-18 08:01:32 -080092 header_libs: [
93 "libfiemap_headers",
David Andersonc13586f2019-12-17 21:06:15 -080094 "libstorage_literals_headers",
David Anderson43482de2019-12-18 08:01:32 -080095 ],
96 export_header_lib_headers: [
97 "libfiemap_headers",
98 ],
Alessio Balsini843820e2020-01-24 16:08:28 +000099 required: [
100 "e2freefrag",
101 "e2fsdroid",
102 ],
David Anderson43482de2019-12-18 08:01:32 -0800103}
104
105// Two variants of libfs_mgr are provided: libfs_mgr and libfs_mgr_binder.
106// Use libfs_mgr in recovery, first-stage-init, or when libfiemap or overlayfs
107// is not used.
108//
109// Use libfs_mgr_binder when not in recovery/first-stage init, or when overlayfs
110// or libfiemap is needed. In this case, libfiemap will proxy over binder to
111// gsid.
112cc_library {
113 // Do not ever allow this library to be vendor_available as a shared library.
114 // It does not have a stable interface.
115 name: "libfs_mgr",
116 recovery_available: true,
117 defaults: [
118 "libfs_mgr_defaults",
119 ],
120 srcs: [
121 ":libfiemap_passthrough_srcs",
122 ],
123}
124
125cc_library {
126 // Do not ever allow this library to be vendor_available as a shared library.
127 // It does not have a stable interface.
128 name: "libfs_mgr_binder",
129 defaults: [
130 "libfs_mgr_defaults",
131 "libfiemap_binder_defaults",
132 ],
Tom Cherry37b5ada2017-05-12 17:05:22 -0700133}
Jiyong Parke7df1f72017-06-28 11:17:30 +0900134
135cc_library_static {
Tom Cherry066fcdf2018-08-14 12:57:05 -0700136 // Do not ever make this a shared library as long as it is vendor_available.
137 // It does not have a stable interface.
Jiyong Parke7df1f72017-06-28 11:17:30 +0900138 name: "libfstab",
139 vendor_available: true,
Jiyong Parka0e75042018-05-24 14:11:00 +0900140 recovery_available: true,
Bowgo Tsaifa416f92019-01-07 15:30:27 +0800141 host_supported: true,
Jiyong Parke7df1f72017-06-28 11:17:30 +0900142 defaults: ["fs_mgr_defaults"],
143 srcs: [
144 "fs_mgr_fstab.cpp",
145 "fs_mgr_boot_config.cpp",
146 "fs_mgr_slotselect.cpp",
147 ],
bohu91c4bd72019-01-11 14:25:58 -0800148 target: {
149 darwin: {
150 enabled: false,
151 },
Hung-ying Tyane7cb09d2020-07-03 14:26:59 +0800152 vendor: {
153 cflags: [
154 // Skipping entries in fstab should only be done in a system
155 // process as the config file is in /system_ext.
156 // Remove the op from the vendor variant.
157 "-DNO_SKIP_MOUNT",
158 ],
159 },
bohu91c4bd72019-01-11 14:25:58 -0800160 },
Jiyong Parke7df1f72017-06-28 11:17:30 +0900161 export_include_dirs: ["include_fstab"],
David Anderson0e330f12019-01-03 18:16:56 -0800162 header_libs: [
163 "libbase_headers",
164 "libgsi_headers",
165 ],
Jiyong Parke7df1f72017-06-28 11:17:30 +0900166}
Mark Salyzyn6b3f5872019-02-20 08:32:36 -0800167
168cc_binary {
169 name: "remount",
170 defaults: ["fs_mgr_defaults"],
Mark Salyzyn1188ce42019-01-25 11:05:40 -0800171 static_libs: [
172 "libavb_user",
David Anderson8696a5d2020-06-10 23:50:02 -0700173 "libutils",
174 "libvold_binder",
Mark Salyzyn1188ce42019-01-25 11:05:40 -0800175 ],
Mark Salyzyn6b3f5872019-02-20 08:32:36 -0800176 shared_libs: [
Mark Salyzyn1188ce42019-01-25 11:05:40 -0800177 "libbootloader_message",
Mark Salyzyn6b3f5872019-02-20 08:32:36 -0800178 "libbase",
David Anderson8696a5d2020-06-10 23:50:02 -0700179 "libbinder",
Mark Salyzync3fc2aa2019-04-30 13:21:04 -0700180 "libcutils",
Mark Salyzyn4469fb12019-01-30 10:19:15 -0800181 "libcrypto",
Mark Salyzync3fc2aa2019-04-30 13:21:04 -0700182 "libext4_utils",
Mark Salyzyn4469fb12019-01-30 10:19:15 -0800183 "libfec",
David Andersonc13586f2019-12-17 21:06:15 -0800184 "libfs_mgr_binder",
Mark Salyzync3fc2aa2019-04-30 13:21:04 -0700185 "liblog",
186 "liblp",
187 "libselinux",
Mark Salyzyn6b3f5872019-02-20 08:32:36 -0800188 ],
Mark Salyzyn1188ce42019-01-25 11:05:40 -0800189 header_libs: [
190 "libcutils_headers",
191 ],
Mark Salyzyn6b3f5872019-02-20 08:32:36 -0800192 srcs: [
193 "fs_mgr_remount.cpp",
194 ],
195 cppflags: [
196 "-DALLOW_ADBD_DISABLE_VERITY=0",
197 ],
198 product_variables: {
199 debuggable: {
200 cppflags: [
201 "-UALLOW_ADBD_DISABLE_VERITY",
202 "-DALLOW_ADBD_DISABLE_VERITY=1",
203 ],
204 },
205 },
David Andersonc13586f2019-12-17 21:06:15 -0800206 required: [
207 "clean_scratch_files",
208 ],
209}
210
211cc_binary {
212 name: "clean_scratch_files",
213 defaults: ["fs_mgr_defaults"],
214 shared_libs: [
215 "libbase",
216 "libfs_mgr_binder",
217 ],
218 srcs: [
219 "clean_scratch_files.cpp",
220 ],
221 product_variables: {
222 debuggable: {
223 init_rc: [
224 "clean_scratch_files.rc",
225 ],
226 },
227 },
Mark Salyzyn6b3f5872019-02-20 08:32:36 -0800228}