Enable overlayFS on DSU system

Enable overlayFS (adb remount) within DSU only if the DM device
scratch_gsi exists. Under DSU mode the backing scratch device of
overlayFS must be scratch_gsi. The scratch_gsi partition must be
created by gsid on the host system and initialized during
first-stage-init. fs_mgr_overlayfs mustn't create any scratch device
for DSU, instead it should just check the existence of the dm node
and initialize the scratch partition (if any).

Bug: 165925766
Test: (In host)
  adb shell gsi_tool create-partition --partition system \
      --size $(du -b system.img | cut -f1) <system.img
  adb shell gsi_tool create-partition --readwirte --partition userdata \
      --size $((8 * 1024 * 1024 * 1024))
  adb shell gsi_tool create-partition --readwirte --partition scratch \
      --size $((200 * 1024 * 1024))
  adb reboot
Test: (In DSU guest)
  # Ensure next reboot is still DSU
  adb shell gsi_tool enable
  adb remount -R
  # Check the output of "adb shell mount"; "/system", "/vendor" ...
  # should be remounted as RW.
Test: adb-remount-test.sh in DSU system
Test: adb-remount-test.sh in normal system
Change-Id: I3267f551313e6b4d4ee63a4f1021040076126e6b
1 file changed