Android dynamic partitions
Devices running Android 10 and later versions implement the dynamic partitioning scheme. With dynamic partitioning, multiple logical partitions are defined in a single "super" partition. They behave very much like Linux LVM, being flexible and easy to change around. However, dynamic partitioning follows a different format from LVM.
PostmarketOS does not support dynamic partitioning out of the box, but it can through some changes to the device specific package.
Adding support for dynamic partitions to your port
There are a few changes you need to make to the device package:
- add
make-dynpart-mappings
to the dependencies in the APKBUILD - set
deviceinfo_super_partitions
in deviceinfo to a certain value - regenerate the checksums
- rebuild the device package and everything related to updating it
There is no single correct value for deviceinfo_super_partitions, hence the need for it as a configuration value. Below is a guide to determine the appropriate value for deviceinfo_super_partitions.
Retrofit or single super partition?
The super partitions are different for devices that launched before Android 10, called retrofit devices, and devices launching with Android 10 or higher.
Retrofit Devices
For retrofit devices, old A/B partitions are re-purposed into a single "virtual" super partition, usually the system_a, system_b, vendor_a, vendor_p and product partitions, but it can vary between devices. Which partitions are used is specified in the BOARD_SUPER_PARTITION_BLOCK_DEVICES
variable in the devices BoardConfig*.mk (see below).
Special cases
On retrofit devices, the device manufacturer has the option to specify different super partitions. If your device has a https://github.com/LineageOS/android_device_* repository, you can look for the value of BOARD_SUPER_PARTITION_METADATA_DEVICE
in the board configuration (i.e. BoardConfig*.mk). If the value is different, then replace "system" with the value you found.
Devices launching with Android 10
For devices launching with Android 10 have a single super partition called "super". If your device has A/B seamless update, or you are not sure, then you should specify the same super partition twice.
Finding the device nodes
On Android, there are symlinks to the appropriate device nodes in /dev/block/by-name/
. You can use the adb root shell to find the device node names of your super partitions:
$ adb root $ adb shell (device hostname):/# readlink /dev/block/by-name/super | basename mmcblk0p127 (device hostname):/# readlink /dev/block/by-name/system_a | basename mmcblk0p68 (device hostname):/# readlink /dev/block/by-name/system_b | basename mmcblk0p69 (device hostname):/# exit
You can then use the output to determine the appropriate value of deviceinfo_super_partitions by prepending /dev/
to each partition:
# for a retrofit device deviceinfo_super_partitions="/dev/mmcblk0p68 /dev/mmcblk0p69" # for a device with the single super partition deviceinfo_super_partitions="/dev/mmcblk0p127 /dev/mmcblk0p127"
Flashing to a device with dynamic partitioning
Dynamic partitions are only supposed to be flashed in fastbootd, as opposed to the bootloader fastboot. To get to fastbootd from the bootloader fastboot, run:
$ fastboot reboot fastboot
Since fastbootd is in userspace, it will most likely be inaccessible on the slot where you flash the postmarketOS kernel. If you want to keep flashing to dynamic partitions, you should consider flashing the kernel to the inactive slot so you still have a working fastbootd.