Draft: postmarketos-mkinitfs: support booting from image file
Support for booting in "stowaway" mode, similar to what
SailfishOS uses. Rootfs image is stored in a directory
on userdata partition, mounted as loop device and
used as /
mountpoint.
Userdata partition is specified in kernel parameter
(example: PMOS_STOWAWAY=/dev/sda31
). When this parameter
is present in kernel cmdline, "stowaway" booting mode is
assumed and all autodetection for root partition labels is
skipped. Specified partition is mounted to /data
.
Then image file (default: /data/.stowaways/postmarketos.img
,
can be overriden from kernel cmdline)
from that partition is mounted as loop device and booting
is continued from there.
This way user doesn't have to erase installed Android system and A/B devices can even benefit from dual-booting with postmarketOS by switching active slot.
Non-A/B devices can just reflash boot.img (and only boot.img! nothing else!) to simulate dual-booting with Android.
With this you can port your "daily driver" phone easily without wiping anything (system partition) or doing large backups.