This change implements DeviceMapper::LoadTableAndActivate by serializing
the given DmTable and issuing DM_TABLE_LOAD and DM_DEV_SUSPEND ioctls.
In addition, this makes the CreateDevice() method private, and
introduces a separate method for creating a device and loading a table
as a single operation. This will obviate the need for separate inactive
device cleanup logic later.
Note that this change does not yet implement DmTable::Serialize().
Bug: 110035986
Test: N/A
Change-Id: Ic8affe591db4930ce672b00db989978b57ca8cbf
This places libdm includes into a libdm folder, to match how many other
library includes are organized.
Bug: 110035986
Test: N/A
Change-Id: I430b0cf749c8d16265481864f1f33927fd740a53
This change removes unnecessary malloc() calls for dm_ioctls. It also
simplifies and fixes line endings on some error messages.
Bug: 110035986
Test: N/A
Change-Id: I2f56e5dab7f25cd9b2f80896f80101db56228981
Currently, init can create logical partitions by hardcoding them in
fs_mgr or by specifying them in device-tree. This change allows init to
also create logical partitions by using liblp, which stores partition
tables in a physical partition. The current name for this partition is
"android".
Two aspects of this code will change long-term. One, the prototype code
using device-tree will be deleted once fastboot supports logical
partitions. Two, libdm will obsolete most of the code in
fs_mgr_dm_linear.cpp. For now however we preserve how the prototype code
functions and we layer liblp on top of the existing dm_linear logic.
Bug: 79173901
Test: N/A
Change-Id: If014a109da78fa12269bf0df0dda39028ac2d1aa
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
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
* changes:
fs_mgr: libdm: Add support to list existing device mapper devices
fs_mgr: libdm: add support to create and delete device mapper devices.
fs_mgr: device mapper: Add libdm and 'dmctl' tool to use it.
Test: dmctl create system; dmctl delete system
Test: verify that ueventd creates /dev/block/dm-X and verify the dm
device name from /sys/block/dm-X/dm/name
Bug: 110035986
Change-Id: I2a08e2ea7007c0c13fe64d444f0d6618784edae7
Signed-off-by: Sandeep Patil <sspatil@google.com>
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>
The params in kernel cmdline is expected to be consumed by kernel.
For bootloader <--> userland communication, we're moving it to
device-tree or system property.
Bug: 78615592
Test: boot a device
Change-Id: I26bc2ea4cda91241242eb9fd0210b5b10659a297
fs_mgr gets androidboot.vbmeta.{size, hash_alg, digest} from kernel
cmdline to assure the integrity of all vbmeta structs. This CL Allows
fs_mgr to get those parameters from device tree because they're only
consumed by userland instead of kernel.
https://android.googlesource.com/platform/external/avb/+/master#The-VBMeta-Digest
Bootloader could construct a device tree overlay at run time then merge
it into main device tree. e.g.,
firmware {
android {
vbmeta.size = "5245";
vbmeta.hash_alg = "sha256";
vbmeta.digest = "0c51233ca3ecaa...63c6d912e79b709";
};
};
Bug: 80168311
Test: boot a device using AVB
Change-Id: I6cf151713af04e6cf554d593e9f0b43e9e214d8c
Spans quoted with " are dealt with atomically, and are stripped from
the key/value results when parsing the kernel cmdline.
Test: compile, device boot, fs_mgr_unit_test
Bug: 109821005
Change-Id: I45f3d7395f34295edefdeaafa4c15c6ee25cc4da
Switch from open-coded parsing of /proc/cmdline to built-in
fs_mgr_get_boot_config_from_kernel_cmdline function.
Test: compile and smoke boot test
Bug: 109821005
Change-Id: I935d2e76c76ad417cbcee398e2afbf9b061d1719
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
During uevent processing, some "by-name" symlinks will be created.
/dev/block/<type>/<device>/by-name/<partition>
<type> can be: platform, pci or vbd.
<device> might be: soc.0/f9824900.sdhci, soc.0/f9824900.sdhci, etc.
<partition> might be: system, vendor, system_a, system_b, etc.
e.g., on a non-A/B device:
/dev/block/platform/soc.0/f9824900.sdhci/by-name/system
/dev/block/platform/soc.0/f9824900.sdhci/by-name/vendor
On a A/B device:
/dev/block/platform/soc/1da4000.ufshc/by-name/system_a
/dev/block/platform/soc/1da4000.ufshc/by-name/system_b
/dev/block/platform/soc/1da4000.ufshc/by-name/vendor_a
/dev/block/platform/soc/1da4000.ufshc/by-name/vendor_b
However, those symlinks are "device-specific".
This change adds the "generic" symlinks in ueventd, in addition to
the existing symlinks, when the possible "boot devices" are specified
in device tree. e.g.,
&firmware_android {
compatible = "android,firmware";
boot_devices ="soc/1da4000.ufshc,soc.0/f9824900.sdhci";
}
The following symlinks will then be created on the aforementioned non-A/B
and A/B devices, respectively.
/dev/block/by-name/system
/dev/block/by-name/vendor
/dev/block/by-name/system_a
/dev/block/by-name/system_b
/dev/block/by-name/vendor_a
/dev/block/by-name/vendor_b
Note that both <type> and <device> are skipped in the newly create symlinks.
It assumes there is no more than one devices with the same <partition>,
which is the assumption of current first stage mount flow.
Finally, when 'boot_devices' in DT is absent, it fallbacks to extract
'boot_devices' from fstab settings. e.g., using 'soc/1da4000.ufshc',
'soc.0/f9824900.sdhci' for a fstab with the following content:
/dev/block/platform/soc/1da4000.ufshc/by-name/system
/dev/block/platform/soc.0/f9824900.sdhci/by-name/vendor
Bug: 78613232
Test: adb shell ls /dev/block/by-name
Change-Id: Iec920b5a72409b6a2bdbeeb290f0a3acd2046b5d
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
Remove "verity" from device-mapper helper functions so it's clear they can be
re-used for non-verity targets.
Bug: 78914864
Test: AVB device still boots
Change-Id: Id8474b2c6e23e828eff563263ebb409031cde17e
DM_READONLY_FLAG should only be used when loading tables, and
DM_STATUS_TABLE_FLAG should only be used when querying a table's status. This
patch cleans up how we set flags to reflect when the kernel actually cares
about them.
Bug: 78914864
Test: AVB device still boots
Change-Id: I809d8c2ef2105849ebdd095bbe7f08f15ae63465
The total sectors that we want to format is used in different meanings from
various users. This notifies its size based on 4096 bytes explicitly.
Bug: 76407663
Change-Id: I4e00f2e2289c1381f0238d2a4acb606a0ab551a9
Merged-In: I4e00f2e2289c1381f0238d2a4acb606a0ab551a9
Reported-by: katao@xiaomi.com
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Test: Modified Pixel to support and use Speck encryption, booted.
Bug: 77227248
Change-Id: I6ec272db5e4f16e9dd4f759203c14ad2a8772cd1
Merged-In: I6ec272db5e4f16e9dd4f759203c14ad2a8772cd1
With treble, the vendor kernel and ramdisk are supposed to be used.
But vendors always find new and interesting ways to break things:
$ cat /proc/device-tree/firmware/android/fstab/system/dev; echo
/by-name/system_a
$
Change-Id: I826a96ebd625b52563d3cc970bf99d9b26dc093e
This patch adds sysfs_path=%s in fstab to get the sysfs entry path.
One example is that vold is able to conduct UFS-specific operations given the
below fstab entry.
/dev/block/bootdevice/by-name/userdata /data f2fs noatime,nosuid,nodev,discard
latemount,wait,check,fileencryption=ice,quota,formattable,sysfs_path=/sys/devices/platform/soc/1d84000.ufshc
Bug: 63264275
Bug: 68721792
Change-Id: I5097873893948f12296ac5eaa0c2a59a6e6dd9e1
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Don't use the FDE flow to support metadata encryption; just use the
vold service which directly mounts the volume.
Bug: 63927601
Test: Boot Taimen to SUW with and without metadata encryption.
Change-Id: Idf9c27a69872cd7a9e2fb76df09a91d8e5ef4896
If we're setting up the number of reserved blocks, we also want to
set our new AID_DISK_RESERVED as the GID that's allowed to use those
blocks.
Test: builds, boots
Bug: 62024591
Change-Id: Iaabfa7d63ad9ff0b9732e2b9996937607d622fe2
Some devices, such as android on chromebooks, don't need an fstab.
Test: Ensure no error messages are seen from fs_mgr when fstab is
missing.
Change-Id: Ifadb2193743a61d03f1becefd6bc81a61eb45081
The fstab struct wasn't properly being freed.
Test: Ensure a user of fs_mgr (vold) runs without errors.
Change-Id: I4dcb8ae2ab3e831fbdb13372eb31a67a5d9fb735
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
The client of FirstStageMount class should check the existence of fstab
in device-tree prior to using it. So raising a FATAL error inside
FirstStageMount when failed to parsing the fstab, in order to expose
more accurate error messages.
Also fixing a comment in fs_mgr, where it might happen in either
non-A/B or A/B.
Bug: 69102431
Test: boot sailfish
Change-Id: Ifb525beaa3423b118644778bfe0f84bff9465303