mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
BSDRP images are built with "poudriere image -t firmware", which puts gptboot.efi on the ESP instead of loader.efi. gptboot.efi reads the GPT bootme attribute, picks the active system partition (BSDRP1 or BSDRP2), chainloads /boot/loader.efi from it and hands loader.efi that partition in LoadedImage->DeviceHandle (stand/efi/boot1/boot1.c:try_boot). Sincece9bfd7816("loader.efi: Refactor try_boot_device_partitions"), find_currdev() no longer tries that device: try_boot_device_partitions() walks the parent disk while explicitly skipping dp->pd_handle, on the assumption that the boot image always comes from an ESP holding no root filesystem. When chainloaded, the partition gptboot.efi selected is therefore the one partition never considered, and loader.efi falls through to the first other UFS partition on the disk - the previous system. Every A/B upgrade silently boots the old slice. Commit1c85c5eea0, which introduced try_boot_device_partitions(), did try dp itself before its siblings; the refactor dropped it. Restore it, keeping the sibling walk as the fallback for the normal ESP case. Fixes:ce9bfd7816Assisted-by: Claude Code (Fable 5, Opus 5) Sponsored by: Netflix