• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
17cc_defaults {
18    name: "fs_mgr_defaults",
19    sanitize: {
20        misc_undefined: ["integer"],
21    },
22    local_include_dirs: ["include/"],
23    cflags: [
24        "-Wall",
25        "-Werror",
26    ],
27}
28
29cc_defaults {
30    name: "libfs_mgr_defaults",
31    defaults: ["fs_mgr_defaults"],
32    export_include_dirs: ["include"],
33    include_dirs: ["system/vold"],
34    cflags: [
35        "-D_FILE_OFFSET_BITS=64",
36    ],
37    srcs: [
38        "file_wait.cpp",
39        "fs_mgr.cpp",
40        "fs_mgr_format.cpp",
41        "fs_mgr_verity.cpp",
42        "fs_mgr_dm_linear.cpp",
43        "fs_mgr_overlayfs.cpp",
44        "fs_mgr_roots.cpp",
45        "fs_mgr_vendor_overlay.cpp",
46        ":libfiemap_srcs",
47    ],
48    shared_libs: [
49        "libbase",
50        "libcrypto",
51        "libcrypto_utils",
52        "libcutils",
53        "libext4_utils",
54        "libfec",
55        "liblog",
56        "liblp",
57        "libselinux",
58    ],
59    static_libs: [
60        "libavb",
61        "libfs_avb",
62        "libfstab",
63        "libdm",
64        "libgsi",
65    ],
66    export_static_lib_headers: [
67        "libfs_avb",
68        "libfstab",
69        "libdm",
70    ],
71    export_shared_lib_headers: [
72        "liblp",
73    ],
74    whole_static_libs: [
75        "liblogwrap",
76        "libdm",
77        "libext2_uuid",
78        "libfscrypt",
79        "libfstab",
80    ],
81    cppflags: [
82        "-DALLOW_ADBD_DISABLE_VERITY=0",
83    ],
84    product_variables: {
85        debuggable: {
86            cppflags: [
87                "-UALLOW_ADBD_DISABLE_VERITY",
88                "-DALLOW_ADBD_DISABLE_VERITY=1",
89            ],
90        },
91    },
92    header_libs: [
93        "libfiemap_headers",
94        "libstorage_literals_headers",
95    ],
96    export_header_lib_headers: [
97        "libfiemap_headers",
98    ],
99    required: [
100        "e2freefrag",
101        "e2fsdroid",
102    ],
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.
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    ],
133}
134
135cc_library_static {
136    // Do not ever make this a shared library as long as it is vendor_available.
137    // It does not have a stable interface.
138    name: "libfstab",
139    vendor_available: true,
140    recovery_available: true,
141    host_supported: true,
142    defaults: ["fs_mgr_defaults"],
143    srcs: [
144        "fs_mgr_fstab.cpp",
145        "fs_mgr_boot_config.cpp",
146        "fs_mgr_slotselect.cpp",
147    ],
148    target: {
149        darwin: {
150            enabled: false,
151        },
152        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        },
160    },
161    export_include_dirs: ["include_fstab"],
162    header_libs: [
163        "libbase_headers",
164        "libgsi_headers",
165    ],
166}
167
168cc_binary {
169    name: "remount",
170    defaults: ["fs_mgr_defaults"],
171    static_libs: [
172        "libavb_user",
173        "libutils",
174        "libvold_binder",
175    ],
176    shared_libs: [
177        "libbootloader_message",
178        "libbase",
179        "libbinder",
180        "libcutils",
181        "libcrypto",
182        "libext4_utils",
183        "libfec",
184        "libfs_mgr_binder",
185        "liblog",
186        "liblp",
187        "libselinux",
188    ],
189    header_libs: [
190        "libcutils_headers",
191    ],
192    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    },
206    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    },
228}
229