Loading pmOS_root / boot partitions by UUID
How it currently works:
- bootloader gets the initramfs file:
- androids: initramfs is together with the kernel in boot.img
- pinephone: u-boot fork has logic to find out whether it was booted from eMMC or not
- pinephonepro: tow-boot loads grub, which then grabs the initramfs file from the boot partition
- grub detects the boot partition by label (pmOS_boot)
- problem: if pmOS is installed on eMMC and SD, it may boot the wrong one
- grub detects the boot partition by label (pmOS_boot)
- bootloader passes kernel command-line
- initramfs figures out the root partition
- pinephone: partition is in root= kernel parameter
- correctly selects the partition, even if pmOS is installed on both SD and eMMC
- all others: first encrypted partition found or by partition label (pmOS_root)
- problem if there's an encrypted SD card and it gets wrongly detected as root partition (#1485 (closed))
- problem if pmOS is installed twice (eMMC and SD)
- pinephone: partition is in root= kernel parameter
How it could be done:
- UEFI devices: generate a grub config
- boot partition
- put the UUID of the boot partition into the grub config
- root partition
- put the root partition as
root=UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
parameter into the grub config? - or maybe store the root partition's UUID as file in the initramfs since this would also work with androids?
- put the root partition as
- boot partition
- androids: maybe store the root partition's UUID as file in the initramfs?
- adjust postmarketos-mkinitfs to load the root partition by UUID if specified on kernel command-line
- I think generating the grub config would fit into boot-deploy (this gets called by postmarketos-mkinitfs already, e.g. to dd the boot.img to the right partition for androids)
- pmbootstrap install and on-device installer: must call boot-deploy after the installation and ensure it writes the right UUIDs (possibly with env vars)
Thoughts?
Edited by Administrator