General partition layout (installation image)
/dev/installp1 # label: pmOS_boot (contains kernel, initramfs, initramfs-extra) /dev/installp2 # label: pmOS_root (can be encrypted, when --fde is specified)
This is the least awkward layout - both partitions from above get directly created on the SD card. If your device has a sdcard slot, it is recommended to use it. Because then you don't wear down the internal flash storage of the device and don't need to worry about the phone's internal storage partition layout.
$ ./pmbootstrap.py install --sdcard /dev/mmcblkX
Android internal storage
We don't want to modify the partition layout on the internal storage of Android systems. Because this seems somewhat risky, and then users couldn't simply install another ROM such as LineageOS anymore. So we came up with the following:
The Android internal storage is already partitioned - the layout seems to be different for every device, as well as the numbers they have assigned. But most notably the devices have the following partitions:
boot system userdata
We usually flash a
boot.img file (which is the kernel + initramfs) to Android's
boot partition (see also: deviceinfo_flash_methods) - because that is what works and what all other ROMs do. Now the interesting part is the system partition, where we flash our installation image (rootfs). But the installation image already has a partition layout and own partitions! So you will have subpartitions. In the end, it will look like this:
systemp1 # pmOS boot partition, only initramfs-extra gets used from there systemp2 # pmOS (un)encrypted root filesystem
The initramfs (in the
boot.img file!) will automatically find and mount the pmOS boot and root partition, load the
initramfs-extra (which contains additional files, it was split to save space) and take care of booting through until OpenRC takes over.
Flashing to "userdata"
userdata partition is not used yet (proposal to do that is in #60). But as we are pretty flexible, you can also flash pmOS to the
userdata partition, if it has more space and you can't fit it on the
system partition. The initramfs will detect it anyway. Just make sure, that you don't have it flashed to both partitions!
To flash to the
userdata partition instead of the
system partition, use
pmbootstrap flasher flash_rootfs --partition=USERDATA.
If you had flashed postmarketOS to the system partition before, make sure to format it with
fastboot format system.
There might be scenarios, in which the partition type of the
system partition can not be changed through the flasher, because it only allows yaffs2 or simg with ext4 support (during research for the mozilla flame, we found that to be the case (#299) - however, it also has an SD slot, so we did not continue this way (#337)).
A proposal we have for that case, is to have one big ext4/yaffs partition, and include the whole system image file inside that. Then we would adjust the initramfs code to find the boot and root partitions inside that, and teach it how to resize the whole thing to the maximum partition size. We already did some experiments, and so far everything worked (talk to drebrez or ollieparanoid).