Skip to content

os/mini: register the firmware boot entry and prove it under OVMF (engine #709) - #1258

Merged
bong-water-water-bong merged 1 commit into
mainfrom
1bit/709-firmware-boot-entry
Nov 6, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
1bit/709-firmware-boot-entry

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Unparks engine #709 on the installer side, with the kernel rebuild verified from source.

Stage-kernel verdict: the rebuild happened

Measured on strixhalo, not inferred:

  • uname -r = 7.4.0-rc1-1bit; /boot/config-7.4.0-rc1-1bit has CONFIG_EFIVAR_FS=m.
  • the stage module tree /lib/modules/7.4.0-rc1-1bit (build link /usr/src/linux-headers-7.4.0-rc1-1bit) carries 3825 modules including kernel/fs/efivarfs/efivarfs.ko.xz; include/config/kernel.release = 7.4.0-rc1-1bit.
  • modprobe -S 7.4.0-rc1-1bit --show-depends efivarfs -> insmod .../efivarfs.ko.xz (this is exactly os/mini/mkimage.sh:154's probe); vermagic 7.4.0-rc1-1bit SMP preempt mod_unload modversions, the same as the running kernel.
  • the live box mounts efivarfs at /sys/firmware/efi/efivars with 100 entries.
  • building the image here logs == efivarfs.ko for 7.4.0-rc1-1bit: staged (the installer can write a boot entry).

The old failure mode (122-module pruned tree, perfopt vs perfopt+ vermagic) is gone: this is one build.

Installer changes

  • new os/mini/efi-boot.sh holds the firmware rules; install.sh sources it and mkimage.sh ships it at /bin/efi-boot.sh.
  • selection now removes ours with the loader missing and entries whose GPT partition no longer exists on any block device (the wiped-Ubuntu case), while never touching an entry on another disk/USB whose partition still exists. The old code only matched entries carrying the new ESP's PARTUUID, so the old Ubuntu GUID was never considered.
  • on failure it deletes the entry it created and restores the original BootOrder minus only the provably-stale removals; success still creates 1bit OS -> \EFI\BOOT\BOOTX64.EFI, puts it first, sets BootNext, prints the resulting BootOrder, and the existing remove-the-stick countdown is unchanged.

Tests / evidence

  • tests/os_mini_efi_boot_test.sh (new, device-free: fake efibootmgr + fake /sys/class/block) covers stale selection, success (entry path/first/BootNext), and rollback; PASS os_mini_efi_boot. Registered as ctest os_mini_efi_boot.
  • OVMF install gate (os/mini/vmtest.sh): VMTEST PASS, including
    • install boot entry: Boot0009 '1bit OS' is first in BootOrder (0009,0000,...)
    • install boot entry: Boot0009 points at \EFI\BOOT\BOOTX64.EFI
    • install boot entry: BootNext is 0009
      and the guest's own serial log shows the installer step: Boot0009* 1bit OS -> \EFI\BOOT\BOOTX64.EFI on /dev/nvme0n1, BootNext set.
  • the gate probe previously re-mounted efivarfs that init.sh had already mounted (EBUSY) and printed SKIP for a working install; it now accepts an existing BootOrder variable.
  • Real hardware: read-only checks only (efibootmgr -v readable, efivars 100 entries, original BootOrder recorded as 0000,000B,0001,0005,0006,0002,000A,000C,000D,000E); no NVRAM write was made on this box because it would touch the live Ubuntu/Boot0000 entry. The OVMF gate is the end-to-end proof.
  • Gate run needed EC_MODULE=skip here because this box's locally built EC module is unsigned and mkimage refuses unsigned modules; that is an environment property of this host, not a product change.

Remains: merge, build the next candidate image, and run one install on real hardware; the stale-old-UUID removal is covered by the unit test (a fresh OVMF varstore has no such entry). No engine/pin changes.

…and test it without a device (engine #709)

The installer already created the 1bit OS entry, set BootNext and removed stales, but it only matched entries pointing at the NEW ESP GUID, so the wiped-Ubuntu entry (old ESP GUID, gone from disk) survived; and its efivarfs/boot-entry code had no device-free test. Extract the selection/rollback rules into os/mini/efi-boot.sh: remove ours with the loader missing and entries whose GPT partition no longer exists on any block device, never a foreign entry whose partition still exists; on any failure delete the created entry and restore the original BootOrder minus the provably-stale removals. install.sh sources it, mkimage ships it, tests/os_mini_efi_boot_test.sh exercises it with a fake efibootmgr/sysfs and is registered with ctest. vmtest.sh now accepts the efivarfs init.sh already mounted (its second mount failed EBUSY, so a working install printed SKIP) and asserts the entry points at \EFI\BOOT\BOOTX64.EFI and BootNext names it.

Unpark evidence: the running stage tree is a single 7.4.0-rc1-1bit build (CONFIG_EFIVAR_FS=m; 3825 modules incl efivarfs.ko.xz; vermagic 7.4.0-rc1-1bit matches uname; modprobe -S probe resolves); live efivarfs has 100 entries. The old 122-module tree/vermagic mismatch is gone.

Assisted-by: DeepSeek Harness
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant