Thanks for all your suggestions and for mentioning AVB (Android Verified Boot),
see here: Android Verified Boot 2.0.
I read up on it and now learned this:
vbmeta
There is a parition called “vbmeta” (seems the FP5 additionally uses “vbmeta_system”) containing hashes for partitions used to boot Android. The bootloader of your phone will verify the partitions against these hashes and if they match the boot is “verified”, meaning the system is considered coming from a trusted source.
If your phone is LOCKED then the boot process will halt if it is not verified.
If your phone is UNLOCKED then the boot process will continue either way.
I downloaded the FairphoneOS and the /e/OS images and both flash the “vbmeta” and “vbmeta_system” partitions.
avb_custom_key
There is another feature described in the AVB documentation linked above:
“[..] the boot loader supports a virtual partition with the name avb_custom_key. Flashing and erasing this partition only works in the UNLOCKED state. [..]
When the custom key is set and the device is in the LOCKED state it will boot images signed with both the built-in key as well as the custom key. All other security features (including rollback-protection) are in effect, e.g. the only difference is the root of trust to use.
When booting an image signed with a custom key, a yellow screen will be shown as part of the boot process to remind the user that the custom key is in use.”
The iodéOS image flashes the “avb_custom_key” partition (excerpt from their flash script):
$fastboot erase avb_custom_key
$fastboot flash avb_custom_key avb_custom_key-FP5.bin
$fastboot flash [..] (flashes a whole lot of paritions here)
$fastboot reboot-bootloader
sleep 5
$fastboot flashing lock
LineageOS does not seem to flash “vbmeta” or “avb_custom_key” so locking the phone will not find a valid hash for the system and other partitions and fail to boot if LOCKED.
Seems to me any OS writing either a valid “vbmeta*” parition or “avb_custom_key” can be locked and if the hashes are correct it will boot.
But, the header is still : if, for whatever reason, avb keys partition isn’t flashed, you can only relock on stock or official /e/
My take is this is not always true. If for whatever reason the “vbmeta” and “vbmeta_system” partition are not flashed correctly or contain invalid data you can not boot FairphoneOS or /e/OS when LOCKED.
And of course there is still ARB (Anti-Rollback-Protection) to consider and i do not fully understand how A/B partitions come into play here.
My current plan for moving from CalyxOS to iodéOS is this:
- Flash FairphoneOS, but keeeping everything UNLOCKED
- Flash iodéOS and then LOCK
- Before flashing make sure the images use the same or a newer security patch level than the image flashed before to avoid running into ARB (Anti-Rollback-Protection).
Flashing FairphoneOS does not seem to be neccessary according to others in the forum, but my hope is since it flashes A and B partitions and iodéOS seems to only flash one partition, if something goes wrong for one OS i can still boot the other.
What do you think?