pi: switch to flash-kernel-piboot for A/B tryboot rollback#44
Merged
Conversation
Merged
…kernel flash-kernel's main() bails out inside a chroot (the qemu-aarch64 build environment), and its migrate() only copies what's at /boot/firmware/ root into current/ -- nothing on a fresh image. The postinst and the explicit invocation after dracut were both silent no-ops, so the A/B layout never landed and test-image-structure.sh failed seven assertions. Build the layout ourselves instead: ship config.txt in its post-migrate form (os_prefix= keys, dtparam=watchdog=on for the tryboot fallback watchdog), and after dracut populate /boot/firmware/current/ with the kernel, initramfs, DTB, overlays and GPU firmware blobs, mark current/state=good, and write autoboot.txt with tryboot_a_b=1. flash-kernel-piboot stays installed for the runtime mechanism -- /etc/kernel/postinst.d/zz-flash-kernel handles future kernel upgrades on the running device, where machine detection and the chroot guard are no longer in the way.
27e8d29 to
bd32968
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the hand-rolled
bes-pi-firmware-update+zz-bes-pi-firmwarekernel postinst hook on thepivariant with Ubuntu's ownflash-kernel-piboot. That package (resolute-only, which we already require for pi) brings:/usr/sbin/flash-kernelwithMethod: pi-tryfor the Pi 5B, replacing our custom kernel→/boot/firmware copy logic,current/+new/+old/layout under/boot/firmware/, withpiboot-try-reboot.servicetriggering trial boots andpiboot-try-validate.servicepromoting them on success,current/andpiboot-try-rebootmarks the new assetsbadto inhibit retries.This closes the one rollback gap in the image — btrfs + snapper cover the root subvolume but the FAT firmware partition wasn't covered before.
Spec
r[image.boot.pi-firmware]reworded — drops "selecting vmlinuz as the kernel" since flash-kernel chooses its own filenames and the bootloader resolves them viaos_prefix.r[image.boot.pi-firmware-update]reworded from "must ship a script" to a behavioural requirement (kernel updates propagate to the firmware partition and must not overwrite known-good assets).r[image.boot.pi-tryboot-rollback]covers the A/B rollback requirement and the Pi 5 EEPROM ≥ 2025-02-11 firmware floor.Build changes
image/packages.sh: drop the stale "no flash-kernel" rationale comment.image/configure.sh: installflash-kernel-pibootinside the pi branch right after writingconfig.txt(the awk-based migrator in flash-kernel reads fromconfig.txt, so the file must exist when the postinst runs). The explicit invocation afterdracut --forcenow callsflash-kernelinstead of the deleted helper.image/files/pi/config.txt: drops the redundantkernel=/initramfslines (flash-kernel populates/boot/firmware/current/vmlinuzand/boot/firmware/current/initrd.imgand theos_prefix=current/directive added bymigrate-configresolves them).image/files/pi/bes-pi-firmware-updateandimage/files/pi/zz-bes-pi-firmwaredeleted.tests/test-image-structure.shasserts the new layout and the absence of legacy paths.Migration
scripts/migrate-pi-to-piboot.shis a one-shot, idempotent migration for already-flashed images: pre-flights the variant, mount and EEPROM date (viavcgencmd bootloader_version); installsflash-kernel-piboot; removes the legacy helper; runsflash-kernelto trigger the package's ownmigrate()(which moves existing assets intocurrent/, rewritesconfig.txtwithos_prefix=, and writesautoboot.txtwithtryboot_a_b=1); then verifies the new layout. A subsection indocs/GUIDE-IMAGES.mdpoints operators at it.