| Tom Cherry | 37b5ada | 2017-05-12 17:05:22 -0700 | [diff] [blame] | 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 |  | 
 | 17 | cc_defaults { | 
 | 18 |     name: "fs_mgr_defaults", | 
 | 19 |     sanitize: { | 
 | 20 |         misc_undefined: ["integer"], | 
 | 21 |     }, | 
 | 22 |     local_include_dirs: ["include/"], | 
| Chih-Hung Hsieh | 122352d | 2017-10-02 15:20:07 -0700 | [diff] [blame] | 23 |     cflags: [ | 
 | 24 |         "-Wall", | 
 | 25 |         "-Werror", | 
| Chih-Hung Hsieh | 122352d | 2017-10-02 15:20:07 -0700 | [diff] [blame] | 26 |     ], | 
| Tom Cherry | 37b5ada | 2017-05-12 17:05:22 -0700 | [diff] [blame] | 27 | } | 
 | 28 |  | 
| David Anderson | 43482de | 2019-12-18 08:01:32 -0800 | [diff] [blame] | 29 | cc_defaults { | 
 | 30 |     name: "libfs_mgr_defaults", | 
| Tom Cherry | 37b5ada | 2017-05-12 17:05:22 -0700 | [diff] [blame] | 31 |     defaults: ["fs_mgr_defaults"], | 
 | 32 |     export_include_dirs: ["include"], | 
 | 33 |     include_dirs: ["system/vold"], | 
| David Anderson | 43482de | 2019-12-18 08:01:32 -0800 | [diff] [blame] | 34 |     cflags: [ | 
 | 35 |         "-D_FILE_OFFSET_BITS=64", | 
 | 36 |     ], | 
| Tom Cherry | 37b5ada | 2017-05-12 17:05:22 -0700 | [diff] [blame] | 37 |     srcs: [ | 
| David Anderson | c651213 | 2019-06-10 19:03:01 -0700 | [diff] [blame] | 38 |         "file_wait.cpp", | 
| Tom Cherry | 37b5ada | 2017-05-12 17:05:22 -0700 | [diff] [blame] | 39 |         "fs_mgr.cpp", | 
| Tom Cherry | 37b5ada | 2017-05-12 17:05:22 -0700 | [diff] [blame] | 40 |         "fs_mgr_format.cpp", | 
| Tom Cherry | 37b5ada | 2017-05-12 17:05:22 -0700 | [diff] [blame] | 41 |         "fs_mgr_verity.cpp", | 
| David Anderson | 62e5b20 | 2018-05-01 17:09:17 -0700 | [diff] [blame] | 42 |         "fs_mgr_dm_linear.cpp", | 
| Mark Salyzyn | b28389f | 2018-06-06 13:10:40 -0700 | [diff] [blame] | 43 |         "fs_mgr_overlayfs.cpp", | 
| Yifan Hong | bf80e7d | 2018-12-03 13:46:56 -0800 | [diff] [blame] | 44 |         "fs_mgr_roots.cpp", | 
| Justin Yun | 6bab0a9 | 2018-10-29 18:31:48 +0900 | [diff] [blame] | 45 |         "fs_mgr_vendor_overlay.cpp", | 
| David Anderson | 43482de | 2019-12-18 08:01:32 -0800 | [diff] [blame] | 46 |         ":libfiemap_srcs", | 
| Jiyong Park | e7df1f7 | 2017-06-28 11:17:30 +0900 | [diff] [blame] | 47 |     ], | 
| Tao Bao | a9fad6c | 2018-07-25 13:07:31 -0700 | [diff] [blame] | 48 |     shared_libs: [ | 
| Jiyong Park | e7df1f7 | 2017-06-28 11:17:30 +0900 | [diff] [blame] | 49 |         "libbase", | 
| Jiyong Park | e7df1f7 | 2017-06-28 11:17:30 +0900 | [diff] [blame] | 50 |         "libcrypto", | 
| Tao Bao | 7aa4608 | 2018-08-13 22:25:34 -0700 | [diff] [blame] | 51 |         "libcrypto_utils", | 
| Tao Bao | a9fad6c | 2018-07-25 13:07:31 -0700 | [diff] [blame] | 52 |         "libcutils", | 
| Jiyong Park | e7df1f7 | 2017-06-28 11:17:30 +0900 | [diff] [blame] | 53 |         "libext4_utils", | 
| Tao Bao | 7aa4608 | 2018-08-13 22:25:34 -0700 | [diff] [blame] | 54 |         "libfec", | 
| Tao Bao | a9fad6c | 2018-07-25 13:07:31 -0700 | [diff] [blame] | 55 |         "liblog", | 
| David Anderson | f792e41 | 2018-07-27 16:05:31 -0700 | [diff] [blame] | 56 |         "liblp", | 
| Tao Bao | 7aa4608 | 2018-08-13 22:25:34 -0700 | [diff] [blame] | 57 |         "libselinux", | 
| Tao Bao | a9fad6c | 2018-07-25 13:07:31 -0700 | [diff] [blame] | 58 |     ], | 
 | 59 |     static_libs: [ | 
| Jiyong Park | e7df1f7 | 2017-06-28 11:17:30 +0900 | [diff] [blame] | 60 |         "libavb", | 
| Bowgo Tsai | c1bc281 | 2018-11-26 17:49:23 +0800 | [diff] [blame] | 61 |         "libfs_avb", | 
| Jiyong Park | e7df1f7 | 2017-06-28 11:17:30 +0900 | [diff] [blame] | 62 |         "libfstab", | 
| Sandeep Patil | 59f04ee | 2018-05-30 13:46:55 -0700 | [diff] [blame] | 63 |         "libdm", | 
| David Anderson | 0e330f1 | 2019-01-03 18:16:56 -0800 | [diff] [blame] | 64 |         "libgsi", | 
| Jiyong Park | e7df1f7 | 2017-06-28 11:17:30 +0900 | [diff] [blame] | 65 |     ], | 
 | 66 |     export_static_lib_headers: [ | 
| Bowgo Tsai | c1bc281 | 2018-11-26 17:49:23 +0800 | [diff] [blame] | 67 |         "libfs_avb", | 
| Jiyong Park | e7df1f7 | 2017-06-28 11:17:30 +0900 | [diff] [blame] | 68 |         "libfstab", | 
| Sandeep Patil | 59f04ee | 2018-05-30 13:46:55 -0700 | [diff] [blame] | 69 |         "libdm", | 
| David Anderson | f792e41 | 2018-07-27 16:05:31 -0700 | [diff] [blame] | 70 |     ], | 
 | 71 |     export_shared_lib_headers: [ | 
| David Anderson | ea3b8ac | 2018-06-07 15:36:09 -0700 | [diff] [blame] | 72 |         "liblp", | 
| Jiyong Park | e7df1f7 | 2017-06-28 11:17:30 +0900 | [diff] [blame] | 73 |     ], | 
 | 74 |     whole_static_libs: [ | 
| Jin Qian | 42d8137 | 2017-04-21 16:56:34 -0700 | [diff] [blame] | 75 |         "liblogwrap", | 
| Sandeep Patil | 59f04ee | 2018-05-30 13:46:55 -0700 | [diff] [blame] | 76 |         "libdm", | 
| David Anderson | 924858c | 2019-06-26 17:00:00 -0700 | [diff] [blame] | 77 |         "libext2_uuid", | 
| Paul Crowley | 7160fc1 | 2019-10-25 17:12:45 -0700 | [diff] [blame] | 78 |         "libfscrypt", | 
| Jiyong Park | e7df1f7 | 2017-06-28 11:17:30 +0900 | [diff] [blame] | 79 |         "libfstab", | 
| Tom Cherry | 37b5ada | 2017-05-12 17:05:22 -0700 | [diff] [blame] | 80 |     ], | 
| Tom Cherry | 31121ca | 2017-10-10 13:30:57 -0700 | [diff] [blame] | 81 |     cppflags: [ | 
| Tom Cherry | 31121ca | 2017-10-10 13:30:57 -0700 | [diff] [blame] | 82 |         "-DALLOW_ADBD_DISABLE_VERITY=0", | 
 | 83 |     ], | 
| Tom Cherry | 37b5ada | 2017-05-12 17:05:22 -0700 | [diff] [blame] | 84 |     product_variables: { | 
 | 85 |         debuggable: { | 
| Tom Cherry | 31121ca | 2017-10-10 13:30:57 -0700 | [diff] [blame] | 86 |             cppflags: [ | 
 | 87 |                 "-UALLOW_ADBD_DISABLE_VERITY", | 
 | 88 |                 "-DALLOW_ADBD_DISABLE_VERITY=1", | 
 | 89 |             ], | 
| Tom Cherry | 37b5ada | 2017-05-12 17:05:22 -0700 | [diff] [blame] | 90 |         }, | 
| Tom Cherry | 37b5ada | 2017-05-12 17:05:22 -0700 | [diff] [blame] | 91 |     }, | 
| David Anderson | 43482de | 2019-12-18 08:01:32 -0800 | [diff] [blame] | 92 |     header_libs: [ | 
 | 93 |         "libfiemap_headers", | 
| David Anderson | c13586f | 2019-12-17 21:06:15 -0800 | [diff] [blame] | 94 |         "libstorage_literals_headers", | 
| David Anderson | 43482de | 2019-12-18 08:01:32 -0800 | [diff] [blame] | 95 |     ], | 
 | 96 |     export_header_lib_headers: [ | 
 | 97 |         "libfiemap_headers", | 
 | 98 |     ], | 
| Alessio Balsini | 843820e | 2020-01-24 16:08:28 +0000 | [diff] [blame] | 99 |     required: [ | 
 | 100 |         "e2freefrag", | 
 | 101 |         "e2fsdroid", | 
 | 102 |     ], | 
| David Anderson | 43482de | 2019-12-18 08:01:32 -0800 | [diff] [blame] | 103 | } | 
 | 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. | 
 | 112 | cc_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 |  | 
 | 125 | cc_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 Cherry | 37b5ada | 2017-05-12 17:05:22 -0700 | [diff] [blame] | 133 | } | 
| Jiyong Park | e7df1f7 | 2017-06-28 11:17:30 +0900 | [diff] [blame] | 134 |  | 
 | 135 | cc_library_static { | 
| Tom Cherry | 066fcdf | 2018-08-14 12:57:05 -0700 | [diff] [blame] | 136 |     // Do not ever make this a shared library as long as it is vendor_available. | 
 | 137 |     // It does not have a stable interface. | 
| Jiyong Park | e7df1f7 | 2017-06-28 11:17:30 +0900 | [diff] [blame] | 138 |     name: "libfstab", | 
 | 139 |     vendor_available: true, | 
| Jiyong Park | a0e7504 | 2018-05-24 14:11:00 +0900 | [diff] [blame] | 140 |     recovery_available: true, | 
| Bowgo Tsai | fa416f9 | 2019-01-07 15:30:27 +0800 | [diff] [blame] | 141 |     host_supported: true, | 
| Jiyong Park | e7df1f7 | 2017-06-28 11:17:30 +0900 | [diff] [blame] | 142 |     defaults: ["fs_mgr_defaults"], | 
 | 143 |     srcs: [ | 
 | 144 |         "fs_mgr_fstab.cpp", | 
 | 145 |         "fs_mgr_boot_config.cpp", | 
 | 146 |         "fs_mgr_slotselect.cpp", | 
 | 147 |     ], | 
| bohu | 91c4bd7 | 2019-01-11 14:25:58 -0800 | [diff] [blame] | 148 |     target: { | 
 | 149 |         darwin: { | 
 | 150 |             enabled: false, | 
 | 151 |         }, | 
 | 152 |     }, | 
| Jiyong Park | e7df1f7 | 2017-06-28 11:17:30 +0900 | [diff] [blame] | 153 |     export_include_dirs: ["include_fstab"], | 
| David Anderson | 0e330f1 | 2019-01-03 18:16:56 -0800 | [diff] [blame] | 154 |     header_libs: [ | 
 | 155 |         "libbase_headers", | 
 | 156 |         "libgsi_headers", | 
 | 157 |     ], | 
| Jiyong Park | e7df1f7 | 2017-06-28 11:17:30 +0900 | [diff] [blame] | 158 | } | 
| Mark Salyzyn | 6b3f587 | 2019-02-20 08:32:36 -0800 | [diff] [blame] | 159 |  | 
 | 160 | cc_binary { | 
 | 161 |     name: "remount", | 
 | 162 |     defaults: ["fs_mgr_defaults"], | 
| Mark Salyzyn | 1188ce4 | 2019-01-25 11:05:40 -0800 | [diff] [blame] | 163 |     static_libs: [ | 
 | 164 |         "libavb_user", | 
 | 165 |     ], | 
| Mark Salyzyn | 6b3f587 | 2019-02-20 08:32:36 -0800 | [diff] [blame] | 166 |     shared_libs: [ | 
| Mark Salyzyn | 1188ce4 | 2019-01-25 11:05:40 -0800 | [diff] [blame] | 167 |         "libbootloader_message", | 
| Mark Salyzyn | 6b3f587 | 2019-02-20 08:32:36 -0800 | [diff] [blame] | 168 |         "libbase", | 
| Mark Salyzyn | c3fc2aa | 2019-04-30 13:21:04 -0700 | [diff] [blame] | 169 |         "libcutils", | 
| Mark Salyzyn | 4469fb1 | 2019-01-30 10:19:15 -0800 | [diff] [blame] | 170 |         "libcrypto", | 
| Mark Salyzyn | c3fc2aa | 2019-04-30 13:21:04 -0700 | [diff] [blame] | 171 |         "libext4_utils", | 
| Mark Salyzyn | 4469fb1 | 2019-01-30 10:19:15 -0800 | [diff] [blame] | 172 |         "libfec", | 
| David Anderson | c13586f | 2019-12-17 21:06:15 -0800 | [diff] [blame] | 173 |         "libfs_mgr_binder", | 
| Mark Salyzyn | c3fc2aa | 2019-04-30 13:21:04 -0700 | [diff] [blame] | 174 |         "liblog", | 
 | 175 |         "liblp", | 
 | 176 |         "libselinux", | 
| Mark Salyzyn | 6b3f587 | 2019-02-20 08:32:36 -0800 | [diff] [blame] | 177 |     ], | 
| Mark Salyzyn | 1188ce4 | 2019-01-25 11:05:40 -0800 | [diff] [blame] | 178 |     header_libs: [ | 
 | 179 |         "libcutils_headers", | 
 | 180 |     ], | 
| Mark Salyzyn | 6b3f587 | 2019-02-20 08:32:36 -0800 | [diff] [blame] | 181 |     srcs: [ | 
 | 182 |         "fs_mgr_remount.cpp", | 
 | 183 |     ], | 
 | 184 |     cppflags: [ | 
 | 185 |         "-DALLOW_ADBD_DISABLE_VERITY=0", | 
 | 186 |     ], | 
 | 187 |     product_variables: { | 
 | 188 |         debuggable: { | 
 | 189 |             cppflags: [ | 
 | 190 |                 "-UALLOW_ADBD_DISABLE_VERITY", | 
 | 191 |                 "-DALLOW_ADBD_DISABLE_VERITY=1", | 
 | 192 |             ], | 
 | 193 |         }, | 
 | 194 |     }, | 
| David Anderson | c13586f | 2019-12-17 21:06:15 -0800 | [diff] [blame] | 195 |     required: [ | 
 | 196 |         "clean_scratch_files", | 
 | 197 |     ], | 
 | 198 | } | 
 | 199 |  | 
 | 200 | cc_binary { | 
 | 201 |     name: "clean_scratch_files", | 
 | 202 |     defaults: ["fs_mgr_defaults"], | 
 | 203 |     shared_libs: [ | 
 | 204 |         "libbase", | 
 | 205 |         "libfs_mgr_binder", | 
 | 206 |     ], | 
 | 207 |     srcs: [ | 
 | 208 |         "clean_scratch_files.cpp", | 
 | 209 |     ], | 
 | 210 |     product_variables: { | 
 | 211 |         debuggable: { | 
 | 212 |             init_rc: [ | 
 | 213 |                 "clean_scratch_files.rc", | 
 | 214 |             ], | 
 | 215 |         }, | 
 | 216 |     }, | 
| Mark Salyzyn | 6b3f587 | 2019-02-20 08:32:36 -0800 | [diff] [blame] | 217 | } |