platform_system_core/fs_mgr
Bowgo Tsai 8eec38f4e4 Adds /dev/block/by-name/<partition> symlinks
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
2018-05-19 07:57:35 +08:00
..
include init/fs_mgr: prototype first-stage dm-linear support 2018-05-14 12:43:42 -07:00
include_fstab/fstab Adds /dev/block/by-name/<partition> symlinks 2018-05-19 07:57:35 +08:00
.clang-format Fix-up coding style 2017-02-18 12:33:36 +08:00
Android.bp init/fs_mgr: prototype first-stage dm-linear support 2018-05-14 12:43:42 -07:00
fs_mgr.cpp init/fs_mgr: prototype first-stage dm-linear support 2018-05-14 12:43:42 -07:00
fs_mgr_avb.cpp init/fs_mgr: prototype first-stage dm-linear support 2018-05-14 12:43:42 -07:00
fs_mgr_avb_ops.cpp fs_mgr: Adding logs when failing to wait for a device file 2017-07-06 09:51:02 +08:00
fs_mgr_boot_config.cpp Allow the use of a custom Android DT directory 2017-07-28 11:10:48 +08:00
fs_mgr_dm_ioctl.cpp fs_mgr: target-agnostic device-mapper helpers 2018-05-03 16:35:09 -07:00
fs_mgr_dm_linear.cpp init/fs_mgr: prototype first-stage dm-linear support 2018-05-14 12:43:42 -07:00
fs_mgr_format.cpp make_f2fs: specify sector size for target image size and missing options 2018-04-04 09:24:24 -07:00
fs_mgr_fstab.cpp Adds /dev/block/by-name/<partition> symlinks 2018-05-19 07:57:35 +08:00
fs_mgr_priv.h init/fs_mgr: prototype first-stage dm-linear support 2018-05-14 12:43:42 -07:00
fs_mgr_priv_avb_ops.h fs_mgr: Update for new libavb API. 2017-05-15 12:04:18 -04:00
fs_mgr_priv_boot_config.h Allow the use of a custom Android DT directory 2017-07-28 11:10:48 +08:00
fs_mgr_priv_dm_ioctl.h fs_mgr: target-agnostic device-mapper helpers 2018-05-03 16:35:09 -07:00
fs_mgr_priv_sha.h fs_mgr_avb: refactors how vbmeta is loaded 2017-04-14 21:50:55 +08:00
fs_mgr_slotselect.cpp init/fs_mgr: prototype first-stage dm-linear support 2018-05-14 12:43:42 -07:00
fs_mgr_verity.cpp fs_mgr: target-agnostic device-mapper helpers 2018-05-03 16:35:09 -07:00
OWNERS Add OWNERS. 2017-12-07 13:30:03 -08:00