2017-05-13 02:05:22 +02:00
|
|
|
//
|
|
|
|
// Copyright (C) 2017 The Android Open Source Project
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
//
|
|
|
|
|
|
|
|
cc_defaults {
|
|
|
|
name: "fs_mgr_defaults",
|
|
|
|
sanitize: {
|
|
|
|
misc_undefined: ["integer"],
|
|
|
|
},
|
|
|
|
local_include_dirs: ["include/"],
|
2017-10-03 00:20:07 +02:00
|
|
|
cflags: [
|
|
|
|
"-Wall",
|
|
|
|
"-Werror",
|
|
|
|
],
|
2017-05-13 02:05:22 +02:00
|
|
|
}
|
|
|
|
|
2019-12-18 17:01:32 +01:00
|
|
|
cc_defaults {
|
|
|
|
name: "libfs_mgr_defaults",
|
2017-05-13 02:05:22 +02:00
|
|
|
defaults: ["fs_mgr_defaults"],
|
|
|
|
export_include_dirs: ["include"],
|
|
|
|
include_dirs: ["system/vold"],
|
2019-12-18 17:01:32 +01:00
|
|
|
cflags: [
|
|
|
|
"-D_FILE_OFFSET_BITS=64",
|
|
|
|
],
|
2017-05-13 02:05:22 +02:00
|
|
|
srcs: [
|
2019-06-11 04:03:01 +02:00
|
|
|
"file_wait.cpp",
|
2017-05-13 02:05:22 +02:00
|
|
|
"fs_mgr.cpp",
|
|
|
|
"fs_mgr_format.cpp",
|
|
|
|
"fs_mgr_verity.cpp",
|
init/fs_mgr: prototype first-stage dm-linear support
This adds an API to fs_mgr for reading dm-linear tables out of device trees
and issuing device-mapper ioctls. The device tree code will be
implemented separately. The dm-linear structures in fs_mgr are organized
assuming we may want to pull them from sources other than DT (for
example, text files, binary blobs, or something hardcoded for testing).
File systems which are mounted from these logical partitions have
specific fstab requirements. The block device must be a partition name,
and if Verified Boot is used, that name must match the vbmeta partition name.
Second, the entry must have the "logical" fs_mgr flag. Example fstab
entry:
vendor /vendor ext4 ro wait,logical
Example fstab entry in device tree:
vendor {
compatible = "android,fstab";
dev = "vendor";
type = "ext4";
mnt_flags = "ro";
fs_mgr_flags = "wait,slotselect,avb,logical";
};
Bug: 78914864
Test: N/A
Change-Id: I4d8878ea8858f26310119616cadc3ee0dd08566c
2018-05-02 02:09:17 +02:00
|
|
|
"fs_mgr_dm_linear.cpp",
|
2018-06-06 22:10:40 +02:00
|
|
|
"fs_mgr_overlayfs.cpp",
|
2018-12-03 22:46:56 +01:00
|
|
|
"fs_mgr_roots.cpp",
|
2018-10-29 10:31:48 +01:00
|
|
|
"fs_mgr_vendor_overlay.cpp",
|
2019-12-18 17:01:32 +01:00
|
|
|
":libfiemap_srcs",
|
2017-06-28 04:17:30 +02:00
|
|
|
],
|
2018-07-25 22:07:31 +02:00
|
|
|
shared_libs: [
|
2017-06-28 04:17:30 +02:00
|
|
|
"libbase",
|
|
|
|
"libcrypto",
|
2018-08-14 07:25:34 +02:00
|
|
|
"libcrypto_utils",
|
2018-07-25 22:07:31 +02:00
|
|
|
"libcutils",
|
2017-06-28 04:17:30 +02:00
|
|
|
"libext4_utils",
|
2018-08-14 07:25:34 +02:00
|
|
|
"libfec",
|
2018-07-25 22:07:31 +02:00
|
|
|
"liblog",
|
2018-07-28 01:05:31 +02:00
|
|
|
"liblp",
|
2018-08-14 07:25:34 +02:00
|
|
|
"libselinux",
|
2018-07-25 22:07:31 +02:00
|
|
|
],
|
|
|
|
static_libs: [
|
2017-06-28 04:17:30 +02:00
|
|
|
"libavb",
|
2018-11-26 10:49:23 +01:00
|
|
|
"libfs_avb",
|
2017-06-28 04:17:30 +02:00
|
|
|
"libfstab",
|
2018-05-30 22:46:55 +02:00
|
|
|
"libdm",
|
2019-01-04 03:16:56 +01:00
|
|
|
"libgsi",
|
2017-06-28 04:17:30 +02:00
|
|
|
],
|
|
|
|
export_static_lib_headers: [
|
2018-11-26 10:49:23 +01:00
|
|
|
"libfs_avb",
|
2017-06-28 04:17:30 +02:00
|
|
|
"libfstab",
|
2018-05-30 22:46:55 +02:00
|
|
|
"libdm",
|
2018-07-28 01:05:31 +02:00
|
|
|
],
|
|
|
|
export_shared_lib_headers: [
|
2018-06-08 00:36:09 +02:00
|
|
|
"liblp",
|
2017-06-28 04:17:30 +02:00
|
|
|
],
|
|
|
|
whole_static_libs: [
|
2017-04-22 01:56:34 +02:00
|
|
|
"liblogwrap",
|
2018-05-30 22:46:55 +02:00
|
|
|
"libdm",
|
libdm: Improve the reliability of dm device paths.
This fixes a race condition where WaitForFile() after
GetDmDevicePathByName appears to succeed, but a subsequent operation on
the path fails. This can happen when CreateDevice() is called
immediately after a call to DeleteDevice (from any process), and the
path is re-used, enqueuing udev events to remove and re-add the block
device.
The fix for this is to introduce a new variant of CreateDevice() that
has a timeout parameter. When the timeout is positive, CreateDevice()
will wait for a /dev/block/mapper/by-uuid symlink to be created, which
signals that ueventd has finished processing the operation.
ueventd will now create these by-uuid symlinks for device-mapper nodes.
Unfortunately, the uuid is only available during "change" events, so we
have to special case device-mapper symlink creation. And since the uuid
is not available during "remove" events, we simply find matching links
to remove them.
This ensures that callers of CreateDevice() can use the device path
knowing that no asynchronous removals are pending. Code that uses the
old CreateDevice+WaitForFile pattern will be transitioned to the new
method.
Note that it is safe to ignore the timeout, or to use the "unsafe"
CreateDevice, if the caller ensures the path by other means. For example
first-stage init has no device removal, and regenerates uevents until
it has acquired all the paths it needs.
Finally, since libdm now inspects sysfs unconditionally, libdm consumers
need r_dir_file perms for sysfs_dm in their sepolicy. Additionally
linking to libdm now requires linking to libext2_uuid.
Bug: 135771280
Test: libdm_test
device flashes, boots
Change-Id: If5a7383ea38f32a7fbbcf24842dce6a668050a70
2019-06-27 02:00:00 +02:00
|
|
|
"libext2_uuid",
|
2019-10-26 02:12:45 +02:00
|
|
|
"libfscrypt",
|
2017-06-28 04:17:30 +02:00
|
|
|
"libfstab",
|
2017-05-13 02:05:22 +02:00
|
|
|
],
|
2017-10-10 22:30:57 +02:00
|
|
|
cppflags: [
|
|
|
|
"-DALLOW_ADBD_DISABLE_VERITY=0",
|
|
|
|
],
|
2017-05-13 02:05:22 +02:00
|
|
|
product_variables: {
|
|
|
|
debuggable: {
|
2017-10-10 22:30:57 +02:00
|
|
|
cppflags: [
|
|
|
|
"-UALLOW_ADBD_DISABLE_VERITY",
|
|
|
|
"-DALLOW_ADBD_DISABLE_VERITY=1",
|
|
|
|
],
|
2017-05-13 02:05:22 +02:00
|
|
|
},
|
|
|
|
},
|
2019-12-18 17:01:32 +01:00
|
|
|
header_libs: [
|
|
|
|
"libfiemap_headers",
|
2019-12-18 06:06:15 +01:00
|
|
|
"libstorage_literals_headers",
|
2019-12-18 17:01:32 +01:00
|
|
|
],
|
|
|
|
export_header_lib_headers: [
|
|
|
|
"libfiemap_headers",
|
|
|
|
],
|
2020-01-24 17:08:28 +01:00
|
|
|
required: [
|
|
|
|
"e2freefrag",
|
|
|
|
"e2fsdroid",
|
|
|
|
],
|
2019-12-18 17:01:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Two variants of libfs_mgr are provided: libfs_mgr and libfs_mgr_binder.
|
|
|
|
// Use libfs_mgr in recovery, first-stage-init, or when libfiemap or overlayfs
|
|
|
|
// is not used.
|
|
|
|
//
|
|
|
|
// Use libfs_mgr_binder when not in recovery/first-stage init, or when overlayfs
|
|
|
|
// or libfiemap is needed. In this case, libfiemap will proxy over binder to
|
|
|
|
// gsid.
|
|
|
|
cc_library {
|
|
|
|
// Do not ever allow this library to be vendor_available as a shared library.
|
|
|
|
// It does not have a stable interface.
|
|
|
|
name: "libfs_mgr",
|
|
|
|
recovery_available: true,
|
|
|
|
defaults: [
|
|
|
|
"libfs_mgr_defaults",
|
|
|
|
],
|
|
|
|
srcs: [
|
|
|
|
":libfiemap_passthrough_srcs",
|
|
|
|
],
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
// Do not ever allow this library to be vendor_available as a shared library.
|
|
|
|
// It does not have a stable interface.
|
|
|
|
name: "libfs_mgr_binder",
|
|
|
|
defaults: [
|
|
|
|
"libfs_mgr_defaults",
|
|
|
|
"libfiemap_binder_defaults",
|
|
|
|
],
|
2017-05-13 02:05:22 +02:00
|
|
|
}
|
2017-06-28 04:17:30 +02:00
|
|
|
|
|
|
|
cc_library_static {
|
2018-08-14 21:57:05 +02:00
|
|
|
// Do not ever make this a shared library as long as it is vendor_available.
|
|
|
|
// It does not have a stable interface.
|
2017-06-28 04:17:30 +02:00
|
|
|
name: "libfstab",
|
|
|
|
vendor_available: true,
|
2018-05-24 07:11:00 +02:00
|
|
|
recovery_available: true,
|
2019-01-07 08:30:27 +01:00
|
|
|
host_supported: true,
|
2017-06-28 04:17:30 +02:00
|
|
|
defaults: ["fs_mgr_defaults"],
|
|
|
|
srcs: [
|
|
|
|
"fs_mgr_fstab.cpp",
|
|
|
|
"fs_mgr_boot_config.cpp",
|
|
|
|
"fs_mgr_slotselect.cpp",
|
|
|
|
],
|
2019-01-11 23:25:58 +01:00
|
|
|
target: {
|
|
|
|
darwin: {
|
|
|
|
enabled: false,
|
|
|
|
},
|
2020-07-03 08:26:59 +02:00
|
|
|
vendor: {
|
|
|
|
cflags: [
|
|
|
|
// Skipping entries in fstab should only be done in a system
|
|
|
|
// process as the config file is in /system_ext.
|
|
|
|
// Remove the op from the vendor variant.
|
|
|
|
"-DNO_SKIP_MOUNT",
|
|
|
|
],
|
|
|
|
},
|
2019-01-11 23:25:58 +01:00
|
|
|
},
|
2017-06-28 04:17:30 +02:00
|
|
|
export_include_dirs: ["include_fstab"],
|
2019-01-04 03:16:56 +01:00
|
|
|
header_libs: [
|
|
|
|
"libbase_headers",
|
|
|
|
"libgsi_headers",
|
|
|
|
],
|
2017-06-28 04:17:30 +02:00
|
|
|
}
|
2019-02-20 17:32:36 +01:00
|
|
|
|
|
|
|
cc_binary {
|
|
|
|
name: "remount",
|
|
|
|
defaults: ["fs_mgr_defaults"],
|
2019-01-25 20:05:40 +01:00
|
|
|
static_libs: [
|
|
|
|
"libavb_user",
|
2021-01-21 11:14:47 +01:00
|
|
|
"libgsid",
|
2020-06-11 08:50:02 +02:00
|
|
|
"libutils",
|
|
|
|
"libvold_binder",
|
2019-01-25 20:05:40 +01:00
|
|
|
],
|
2019-02-20 17:32:36 +01:00
|
|
|
shared_libs: [
|
2019-01-25 20:05:40 +01:00
|
|
|
"libbootloader_message",
|
2019-02-20 17:32:36 +01:00
|
|
|
"libbase",
|
2020-06-11 08:50:02 +02:00
|
|
|
"libbinder",
|
2019-04-30 22:21:04 +02:00
|
|
|
"libcutils",
|
2019-01-30 19:19:15 +01:00
|
|
|
"libcrypto",
|
2019-04-30 22:21:04 +02:00
|
|
|
"libext4_utils",
|
2019-01-30 19:19:15 +01:00
|
|
|
"libfec",
|
2019-12-18 06:06:15 +01:00
|
|
|
"libfs_mgr_binder",
|
2019-04-30 22:21:04 +02:00
|
|
|
"liblog",
|
|
|
|
"liblp",
|
|
|
|
"libselinux",
|
2019-02-20 17:32:36 +01:00
|
|
|
],
|
2019-01-25 20:05:40 +01:00
|
|
|
header_libs: [
|
|
|
|
"libcutils_headers",
|
|
|
|
],
|
2019-02-20 17:32:36 +01:00
|
|
|
srcs: [
|
|
|
|
"fs_mgr_remount.cpp",
|
|
|
|
],
|
|
|
|
cppflags: [
|
|
|
|
"-DALLOW_ADBD_DISABLE_VERITY=0",
|
|
|
|
],
|
|
|
|
product_variables: {
|
|
|
|
debuggable: {
|
|
|
|
cppflags: [
|
|
|
|
"-UALLOW_ADBD_DISABLE_VERITY",
|
|
|
|
"-DALLOW_ADBD_DISABLE_VERITY=1",
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2019-12-18 06:06:15 +01:00
|
|
|
required: [
|
|
|
|
"clean_scratch_files",
|
|
|
|
],
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_binary {
|
|
|
|
name: "clean_scratch_files",
|
|
|
|
defaults: ["fs_mgr_defaults"],
|
|
|
|
shared_libs: [
|
|
|
|
"libbase",
|
|
|
|
"libfs_mgr_binder",
|
|
|
|
],
|
|
|
|
srcs: [
|
|
|
|
"clean_scratch_files.cpp",
|
|
|
|
],
|
|
|
|
product_variables: {
|
|
|
|
debuggable: {
|
|
|
|
init_rc: [
|
|
|
|
"clean_scratch_files.rc",
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2019-02-20 17:32:36 +01:00
|
|
|
}
|