Commit graph

21 commits

Author SHA1 Message Date
Justin Yun
6bab0a9c23 Mount vendor overlay from the system partition
Using overlayfs, the system partition may provide files for older
version of vendor partitions by overlaying on the vendor partition.
Directories in /system/vendor_overlay will be overlaid on the
directories in /vendor to override existing files or provide new
files.

This feature works only if the kernel support overlayfs and has a
patch for override_creds. Otherwise, no-op.

Bug: 114679254
Test: Build and boot: nothing affected without overlayfs, or
                      vendor file is overrided with overlayfs

Change-Id: Iff3a308945299034123ba7bcb40dc787e102730e
2018-11-01 10:26:12 +09:00
Tao Bao
d262346b57 Merge "fs_mgr: Drop some unneeded dependencies." 2018-08-15 18:14:16 +00:00
Tom Cherry
066fcdf820 Include some warnings about vendor_available for fsmgr.
The interface to fsmgr is subpar and while we haven't had time to
revisit it, we absolutely do not want to expose this to vendors in a
way that would force us to keep this interface in the future.

Test: n/a
Change-Id: I970048aa2e45d7f7eca357d052141e90d6e01123
2018-08-14 13:11:14 -07:00
Tao Bao
7aa4608053 fs_mgr: Drop some unneeded dependencies.
libfs_mgr doesn't have direct dependencies on libfec_rs / libkeyutils /
libsquashfs_utils. They were only needed when libfec and libext4_utils
were statically linked into libfs_mgr.

Bug: 112494634
Test: `m -j installclean && m -j bootimage` with aosp_taimen-userdebug.
      Check the installed files in recovery image.
Test: `mmma -j system/core/fs_mgr`
Change-Id: I4b12c2df344fabba4942b6db943cf43a031b591d
2018-08-13 23:03:03 -07:00
Mark Salyzyn
b28389f5ee fs_mgr: add overlayfs handling for squashfs system filesystems
Logistics for adb remount on developer builds for readonly system
partitions using overlayfs to deal with not being able to remount
with read-write.

Conditions are that filesystem is squashfs, read-only, debug build,
kernel supports overlayfs.  The default is a valid /cache/overlay/
directory, with .../<mount_point>/upper and .../<mount_point>/work,
associated with each system partition <mount_point>.

Will take the sepolicy of context of lowerdir as rootcontext= option.

Add fs_mgr_overlayfs_mount_all() to recurse through
fs_mgr_read_fstab_default(), and checking against /proc/mounts to
add any acceptable overlayfs mounts.  The checking with /proc/mounts
makes sure we do not overlayfs overtop an overlayfs.

Add fs_mgr_overlayfs_setup(const char*, const char* bool*) and
fs_mgr_overlayfs_teardown(const char*, bool*) to respectively setup
or teardown the overlayfs support directories.  Return value
includes success and optional supplied change booleans.

Test: compile
Bug: 109821005
Bug: 110985612
Change-Id: Ie9b4e9ca0f2bdd9275ac2e2e905431636948e131
2018-08-08 15:38:53 -07:00
David Anderson
f792e4163d liblp: Allow building liblp as a shared library.
Bug: 79173901
Test: system image, partition_tools both build
Change-Id: I70f45d4cebfbddc39d03aa3fb3a56b6c48a20d7e
2018-07-27 19:34:56 -07:00
Tao Bao
a9fad6cd15 fs_mgr: Build and use shared libs.
Bug: 78793464
Test: `m dist`
Change-Id: I21ed5de72217c5cfa37e0217b0e79ed0a6f82031
2018-07-25 13:42:39 -07:00
David Anderson
b5acb1ac4a fs_mgr: remove fs_mgr_dm_ioctl
Bug: 110035986
Test: N/A
Change-Id: Ia35a45415f1b2bc476784890d838b44e6854d5b9
2018-06-27 12:48:29 -07:00
David Anderson
ea3b8ac9ff fs_mgr: Add a library for managing logical partitions.
This library has methods to build, read, and modify logical partition tables
based on device-mapper targets. Targets currently supported are
dm-linear and dm-zero.

Note: this is a revert of a revert, with changes to fix Mac build
bustage.

Bug: 79173901
Test: N/A
Change-Id: If89a788d1919ce8ddc6eedaecc9687a92f111dfa
2018-06-19 14:03:57 -07:00
David Anderson
89a1dca721 Revert "fs_mgr: Add a library for managing logical partitions."
This reverts commit e238358b76.

Reason for revert: Broke mac build.

Change-Id: I93390aa839d4471f328529fe5b86a498b3583d8a
2018-06-18 21:13:24 +00:00
David Anderson
e238358b76 fs_mgr: Add a library for managing logical partitions.
This library has methods to build, read, and modify logical partition tables
based on device-mapper targets. Targets currently supported are
dm-linear and dm-zero.

Bug: 79173901
Test: N/A
Change-Id: I194c6832cb53f781c396016d961386d3ca833f87
2018-06-14 17:17:23 -07:00
Sandeep Patil
59f04ee74c fs_mgr: device mapper: Add libdm and 'dmctl' tool to use it.
libdm is small static library that is intended to be the one source to
control device mapper. It is intended to have APIs to create, control
and destroy device mapper targets. Eventually, all fs_mgr implementation
that talks to device mapper will be moved to using libdm APIs.

Added 'dmctl', a command line tool that lists the registered device
mapper targets and their corresponding version. The tool will continue
to get new features to exemplify new APIs implemented in libdm.

The library is intentionally static and folds into libfs_mgr. All
clients must link to libfs_mgr as a result.

Test: dmctl list
Bug: 110035986

Change-Id: I71e7146073a74e7523524bf3b20d0be6d06f9fad
Signed-off-by: Sandeep Patil <sspatil@google.com>
2018-06-13 13:35:44 -07:00
Jiyong Park
a0e75045e6 Build adbd for recovery
adbd (and its dependencies) are marked as recovery_available:true so
that recovery version of the binary is built separately from the one for
system partition. This allows us to stop copying the system version to
the recovery partition and also opens up the way to enable shared
libraries in the recovery partition. Then we can also build adbd as a
dynamic executable.

Bug: 79146551
Test: m -j adbd.recovery
Change-Id: Ib95614c7435f9d0afc02a0c7d5ae1a94e439e32a
2018-05-24 14:11:11 +09:00
David Anderson
62e5b20b50 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-14 12:43:42 -07:00
Bowgo Tsai
8028189499 first stage mount: support mount points like /vendor/abc
Current syntax of the fstab in device tree (fstab_dt) assumes the
node name is the mount point, which doesn't allow subdir:

    vendor {   <== using "vendor/abc" leads to syntax error in device tree
        compatible = "android,vendor";
        dev = "/dev/block/platform/soc.0/f9824900.sdhci/by-name/vendor";
        type = "ext4";
        mnt_flags = "ro,barrier=1,inode_readahead_blks=8";
        fsmgr_flags = "wait";
    };

This CL adds a new field "mnt_point" in the fstab_dt configuration:

    vendor_abc {
        compatible = "android,vendor_abc";
        dev = "/dev/block/platform/soc.0/f9824900.sdhci/by-name/abc";
        type = "ext4";
        mnt_flags = "ro,barrier=1,inode_readahead_blks=8";
        mnt_point = "/vendor/abc";                          <== new field
        fsmgr_flags = "wait";
    };

The new field is optional and will fallback to using node name as mount
point if it is absent.

Note that this CL also sorts fstab_dt by mount point, because
/vendor needs to be mounted first, which contains a directory
/vendor/abc, before /vendor/abc can be mounted.

Bug: 69955336
Test: first stage mount /vendor/abc on a device
Change-Id: Ie2e519f9801f211a7a221622f32c82bedd00353f
2017-12-14 09:48:26 +08:00
Chih-Hung Hsieh
122352d983 Use -Werror in system/core
* Move -Wall -Werror from cppflags to cflags.
* Fix/suppress warning on unused variables.

Bug: 66996870
Test: build with WITH_TIDY=1
Change-Id: I1e05e96a1d0bcb2ccef1ce456504b3af57167cc5
2017-11-01 11:32:55 -07:00
Bowgo Tsai
744361fc57 fs_mgr: removing is_device_secure()
Previously there is no vboot 1.0 metadata for ENG builds. It relies on
is_device_secure() to query "ro.secure" and skip setting up dm-verity
if the value is 0 (meaning ENG build).

This change will be submitted together with other changes to add vboot
1.0 metadata for ENG builds with a "disable magic". The resulting
metadata will be the same as triggering an "adb disable-verity" on an
USERDEBUG image.

Bug: 63056044
Test: boot sailfish eng/userdebug builds

Change-Id: I35eef771e1b30bfc6d01b8ed76b40c942fe7b783
2017-10-13 06:34:12 +08:00
Tom Cherry
31121cafec Move some properties users to __system_property_read_callback()
This is needed if they will ever handle ro. properties that have
values longer than 92 characters.

Bug: 23102347
Bug: 34954705
Test: read and write properties with value length > 92 characters
Change-Id: I44aa135c97ec010f12162c30f743387810ae2c5d
2017-10-10 15:03:33 -07:00
Jin Qian
42d8137da8 fs_mgr: replace make_ext4 api with e2fsprogs
Execute mke2fs to create empty ext4 filesystem.
Execute e2fsdroid to initialize selinux context.

Test: zero-out first 4k of data partition and reboot,
      fs_mgr successfully formats /data.
Bug: 35219933
Change-Id: If6f72f62c618c64be703b83f0114a4dd0a2b079f
(cherry picked from commit f71bc0c152)
2017-09-11 18:34:32 +00:00
Jiyong Park
e7df1f7623 fs_mgr: add libfstab for vendor
libfstab is a subset of libfs_mgr, intended for vendors to use. It
exposes APIs for reading fstab. Note this 'visible to vendor' does not
mean that the API should be stable forever. The API can be changed in
later releases of Android, ,but the newer Android must not cause
run-time error when there is an older version of this static library
being used somewhere.

Bug: 62990533
Test: BOARD_VNDK_VERSION=current m -j libfstab.vendor
Change-Id: I371174fa1f6b4de6d6dd437b84ce4ed1e8740672
Merged-In: If8fc73e4ae4c2f8281c41a12f1c18079aab8baa2
2017-06-28 11:24:25 +09:00
Tom Cherry
37b5ada05e fs_mgr: convert libfs_mgr to Android.bp
Test: Build
Change-Id: Ieda384745adbd119020e90c76bcc649ffdffef5f
2017-05-12 17:06:55 -07:00