1// 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 17package { 18 default_applicable_licenses: ["system_core_fs_mgr_license"], 19} 20 21// Added automatically by a large-scale-change that took the approach of 22// 'apply every license found to every target'. While this makes sure we respect 23// every license restriction, it may not be entirely correct. 24// 25// e.g. GPL in an MIT project might only apply to the contrib/ directory. 26// 27// Please consider splitting the single license below into multiple licenses, 28// taking care not to lose any license_kind information, and overriding the 29// default license using the 'licenses: [...]' property on targets as needed. 30// 31// For unused files, consider creating a 'fileGroup' with "//visibility:private" 32// to attach the license to, and including a comment whether the files may be 33// used in the current project. 34// See: http://go/android-license-faq 35license { 36 name: "system_core_fs_mgr_license", 37 visibility: [":__subpackages__"], 38 license_kinds: [ 39 "SPDX-license-identifier-Apache-2.0", 40 "SPDX-license-identifier-MIT", 41 ], 42 // large-scale-change unable to identify any license_text files 43} 44 45cc_defaults { 46 name: "fs_mgr_defaults", 47 sanitize: { 48 misc_undefined: ["integer"], 49 }, 50 local_include_dirs: ["include/"], 51 cflags: [ 52 "-Wall", 53 "-Werror", 54 ], 55} 56 57cc_defaults { 58 name: "libfs_mgr_defaults", 59 defaults: ["fs_mgr_defaults"], 60 export_include_dirs: ["include"], 61 include_dirs: ["system/vold"], 62 cflags: [ 63 "-D_FILE_OFFSET_BITS=64", 64 ], 65 srcs: [ 66 "blockdev.cpp", 67 "file_wait.cpp", 68 "fs_mgr.cpp", 69 "fs_mgr_format.cpp", 70 "fs_mgr_verity.cpp", 71 "fs_mgr_dm_linear.cpp", 72 "fs_mgr_overlayfs.cpp", 73 "fs_mgr_roots.cpp", 74 "fs_mgr_vendor_overlay.cpp", 75 ":libfiemap_srcs", 76 ], 77 shared_libs: [ 78 "libbase", 79 "libcrypto", 80 "libcrypto_utils", 81 "libcutils", 82 "libext4_utils", 83 "libfec", 84 "liblog", 85 "liblp", 86 "libselinux", 87 ], 88 static_libs: [ 89 "libavb", 90 "libfs_avb", 91 "libfstab", 92 "libdm", 93 "libgsi", 94 ], 95 export_static_lib_headers: [ 96 "libfs_avb", 97 "libfstab", 98 "libdm", 99 ], 100 export_shared_lib_headers: [ 101 "liblp", 102 ], 103 whole_static_libs: [ 104 "liblogwrap", 105 "libdm", 106 "libext2_uuid", 107 "libfscrypt", 108 "libfstab", 109 ], 110 cppflags: [ 111 "-DALLOW_ADBD_DISABLE_VERITY=0", 112 ], 113 product_variables: { 114 debuggable: { 115 cppflags: [ 116 "-UALLOW_ADBD_DISABLE_VERITY", 117 "-DALLOW_ADBD_DISABLE_VERITY=1", 118 ], 119 }, 120 }, 121 header_libs: [ 122 "libfiemap_headers", 123 "libstorage_literals_headers", 124 ], 125 export_header_lib_headers: [ 126 "libfiemap_headers", 127 ], 128 required: [ 129 "e2freefrag", 130 "e2fsdroid", 131 ], 132} 133 134// Two variants of libfs_mgr are provided: libfs_mgr and libfs_mgr_binder. 135// Use libfs_mgr in recovery, first-stage-init, or when libfiemap or overlayfs 136// is not used. 137// 138// Use libfs_mgr_binder when not in recovery/first-stage init, or when overlayfs 139// or libfiemap is needed. In this case, libfiemap will proxy over binder to 140// gsid. 141cc_library { 142 // Do not ever allow this library to be vendor_available as a shared library. 143 // It does not have a stable interface. 144 name: "libfs_mgr", 145 recovery_available: true, 146 defaults: [ 147 "libfs_mgr_defaults", 148 ], 149 srcs: [ 150 ":libfiemap_passthrough_srcs", 151 ], 152} 153 154cc_library { 155 // Do not ever allow this library to be vendor_available as a shared library. 156 // It does not have a stable interface. 157 name: "libfs_mgr_binder", 158 defaults: [ 159 "libfs_mgr_defaults", 160 "libfiemap_binder_defaults", 161 ], 162} 163 164cc_library_static { 165 // Do not ever make this a shared library as long as it is vendor_available. 166 // It does not have a stable interface. 167 name: "libfstab", 168 vendor_available: true, 169 recovery_available: true, 170 host_supported: true, 171 defaults: ["fs_mgr_defaults"], 172 srcs: [ 173 "fs_mgr_fstab.cpp", 174 "fs_mgr_boot_config.cpp", 175 "fs_mgr_slotselect.cpp", 176 ], 177 target: { 178 darwin: { 179 enabled: false, 180 }, 181 vendor: { 182 cflags: [ 183 // Skipping entries in fstab should only be done in a system 184 // process as the config file is in /system_ext. 185 // Remove the op from the vendor variant. 186 "-DNO_SKIP_MOUNT", 187 ], 188 }, 189 }, 190 export_include_dirs: ["include_fstab"], 191 header_libs: [ 192 "libbase_headers", 193 "libgsi_headers", 194 ], 195} 196 197cc_binary { 198 name: "remount", 199 defaults: ["fs_mgr_defaults"], 200 static_libs: [ 201 "libavb_user", 202 "libgsid", 203 "libutils", 204 "libvold_binder", 205 ], 206 shared_libs: [ 207 "libbootloader_message", 208 "libbase", 209 "libbinder", 210 "libcutils", 211 "libcrypto", 212 "libext4_utils", 213 "libfec", 214 "libfs_mgr_binder", 215 "liblog", 216 "liblp", 217 "libselinux", 218 ], 219 header_libs: [ 220 "libcutils_headers", 221 ], 222 srcs: [ 223 "fs_mgr_remount.cpp", 224 ], 225 cppflags: [ 226 "-DALLOW_ADBD_DISABLE_VERITY=0", 227 ], 228 product_variables: { 229 debuggable: { 230 cppflags: [ 231 "-UALLOW_ADBD_DISABLE_VERITY", 232 "-DALLOW_ADBD_DISABLE_VERITY=1", 233 ], 234 }, 235 }, 236 required: [ 237 "clean_scratch_files", 238 ], 239} 240 241cc_binary { 242 name: "clean_scratch_files", 243 defaults: ["fs_mgr_defaults"], 244 shared_libs: [ 245 "libbase", 246 "libfs_mgr_binder", 247 ], 248 srcs: [ 249 "clean_scratch_files.cpp", 250 ], 251 product_variables: { 252 debuggable: { 253 init_rc: [ 254 "clean_scratch_files.rc", 255 ], 256 }, 257 }, 258} 259