• 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
17package {
18    default_applicable_licenses: [
19        "Android-Apache-2.0",
20        "system_core_fs_mgr_license",
21    ],
22}
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: [
42        "SPDX-license-identifier-MIT",
43    ],
44    license_text: ["NOTICE"],
45}
46
47cc_defaults {
48    name: "fs_mgr_defaults",
49    sanitize: {
50        misc_undefined: ["integer"],
51    },
52    cflags: [
53        "-Wall",
54        "-Werror",
55    ],
56}
57
58cc_defaults {
59    name: "libfs_mgr_defaults",
60    defaults: ["fs_mgr_defaults"],
61    export_include_dirs: ["include"],
62    local_include_dirs: ["include/"],
63    cflags: [
64        "-D_FILE_OFFSET_BITS=64",
65    ],
66    srcs: [
67        "blockdev.cpp",
68        "file_wait.cpp",
69        "fs_mgr.cpp",
70        "fs_mgr_format.cpp",
71        "fs_mgr_dm_linear.cpp",
72        "fs_mgr_roots.cpp",
73        "fs_mgr_overlayfs_control.cpp",
74        "fs_mgr_overlayfs_mount.cpp",
75        "fs_mgr_vendor_overlay.cpp",
76        ":libfiemap_srcs",
77    ],
78    shared_libs: [
79        "libbase",
80        "libcrypto",
81        "libcrypto_utils",
82        "libcutils",
83        "libext4_utils",
84        "libfec",
85        "liblog",
86        "liblp",
87        "libselinux",
88    ],
89    static_libs: [
90        "libavb",
91        "libfs_avb",
92        "libgsi",
93    ],
94    export_static_lib_headers: [
95        "libfs_avb",
96        "libfstab",
97        "libdm",
98    ],
99    export_shared_lib_headers: [
100        "liblp",
101    ],
102    whole_static_libs: [
103        "liblogwrap",
104        "libdm",
105        "libext2_uuid",
106        "libfscrypt",
107        "libfstab",
108    ],
109    cppflags: [
110        "-DALLOW_ADBD_DISABLE_VERITY=0",
111    ],
112    product_variables: {
113        debuggable: {
114            cppflags: [
115                "-UALLOW_ADBD_DISABLE_VERITY",
116                "-DALLOW_ADBD_DISABLE_VERITY=1",
117            ],
118        },
119    },
120    header_libs: [
121        "libfiemap_headers",
122        "libstorage_literals_headers",
123    ],
124    export_header_lib_headers: [
125        "libfiemap_headers",
126    ],
127    target: {
128        platform: {
129            required: [
130                "e2freefrag",
131                "e2fsdroid",
132            ],
133        },
134        recovery: {
135            required: [
136                "e2fsdroid.recovery",
137            ],
138        },
139    },
140}
141
142// Two variants of libfs_mgr are provided: libfs_mgr and libfs_mgr_binder.
143// Use libfs_mgr in recovery, first-stage-init, or when libfiemap or overlayfs
144// is not used.
145//
146// Use libfs_mgr_binder when not in recovery/first-stage init, or when overlayfs
147// or libfiemap is needed. In this case, libfiemap will proxy over binder to
148// gsid.
149cc_library {
150    // Do not ever allow this library to be vendor_available as a shared library.
151    // It does not have a stable interface.
152    name: "libfs_mgr",
153    ramdisk_available: true,
154    vendor_ramdisk_available: true,
155    recovery_available: true,
156    defaults: [
157        "libfs_mgr_defaults",
158    ],
159    srcs: [
160        ":libfiemap_passthrough_srcs",
161    ],
162}
163
164cc_library {
165    // Do not ever allow this library to be vendor_available as a shared library.
166    // It does not have a stable interface.
167    name: "libfs_mgr_binder",
168    defaults: [
169        "libfs_mgr_defaults",
170        "libfiemap_binder_defaults",
171    ],
172}
173
174cc_library_static {
175    name: "libfs_mgr_file_wait",
176    defaults: ["fs_mgr_defaults"],
177    export_include_dirs: ["include"],
178    cflags: [
179        "-D_FILE_OFFSET_BITS=64",
180    ],
181    srcs: [
182        "file_wait.cpp",
183    ],
184    shared_libs: [
185        "libbase",
186    ],
187    host_supported: true,
188    ramdisk_available: true,
189    vendor_ramdisk_available: true,
190    recovery_available: true,
191}
192
193cc_binary {
194    name: "remount",
195    defaults: ["fs_mgr_defaults"],
196    static_libs: [
197        "libavb_user",
198        "libgsid",
199        "libvold_binder",
200    ],
201    shared_libs: [
202        "libbootloader_message",
203        "libbase",
204        "libbinder",
205        "libcutils",
206        "libcrypto",
207        "libext4_utils",
208        "libfs_mgr_binder",
209        "liblog",
210        "liblp",
211        "libselinux",
212        "libutils",
213    ],
214    header_libs: [
215        "libcutils_headers",
216    ],
217    srcs: [
218        "fs_mgr_remount.cpp",
219    ],
220    cppflags: [
221        "-DALLOW_ADBD_DISABLE_VERITY=0",
222    ],
223    product_variables: {
224        debuggable: {
225            cppflags: [
226                "-UALLOW_ADBD_DISABLE_VERITY",
227                "-DALLOW_ADBD_DISABLE_VERITY=1",
228            ],
229            init_rc: [
230                "clean_scratch_files.rc",
231            ],
232        },
233    },
234    symlinks: [
235        "clean_scratch_files",
236        "disable-verity",
237        "enable-verity",
238        "set-verity-state",
239    ],
240}
241