pi: switch to flash-kernel-piboot for A/B tryboot rollback#44
Open
passcod wants to merge 6 commits into
Open
Conversation
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.
Why now
The custom helper existed because, when pi was prototyped on noble, noble's
flash-kernellacked a Pi 5B db entry. That rationale is dead: pi images have been resolute-only in CI for a while (see.github/workflows/build.yml), and resolute ships both the db entry (flash-kernel3.110ubuntu2) and the A/B mechanism (piboot-try1.1ubuntu0.1, pulled in viaflash-kernel-piboot).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.Out of scope
Pre-resolute (noble) pi support; packaging the migration script; further
dtparamoverrides via/etc/flash-kernel/db(our settings live inconfig.txt, which flash-kernel preserves).