[Bug 201788] UEFI boot1.efi doesn't honor GPT bootme/bootonce flags
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 05 Jun 2026 16:00:26 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=201788
--- Comment #7 from Jose Luis Duran <jlduran@FreeBSD.org> ---
Just as a matter of documentation. The bootcode that should be used is
gptboot.efi(8).
Take this hypothetical NanoBSD image:
# gpart show -l
=> 34 7999933 vtbd0 GPT (3.8G)
34 6 - free - (3.0K)
40 121 1 gptboot0 (61K)
161 1887 - free - (944K)
2048 532480 2 efiboot0 (260M)
534528 532480 3 efiboot1 (260M)
1067008 532480 4 efiboot2 (260M)
1599488 3198976 5 code1 (1.5G)
4798464 3198976 6 code2 (1.5G)
7997440 2048 7 cfg (1.0M)
7999488 479 - free - (240K)
We'll just use efiboot0 (vtbd0p2). The partition vtbd0p2 has:
# mount_msdosfs /dev/gpt/efiboot0 /mnt
# ls -R /mnt
EFI
/mnt/EFI:
BOOT
/mnt/EFI/BOOT:
BOOTX64.EFI
Where BOOTX64.EFI is /boot/gptboot.efi:
# sha256 -q /boot/gptboot.efi
21150c71a7a00075a76dde5eb65dc876570d5e7ea937dac061aee1358083a52e
# sha256 -q /mnt/EFI/BOOT/BOOTX64.EFI
21150c71a7a00075a76dde5eb65dc876570d5e7ea937dac061aee1358083a52e
Now, let's test the flags:
# df -h /
Filesystem Size Used Avail Capacity Mounted on
/dev/gpt/code1 1.5G 1.3G 241M 84% /
# gpart set -a bootonce -i 6 vtbd0
bootonce set on vtbd0p6
# gpart show -l
=> 34 7999933 vtbd0 GPT (3.8G)
34 6 - free - (3.0K)
40 121 1 gptboot0 (61K)
161 1887 - free - (944K)
2048 532480 2 efiboot0 (260M)
534528 532480 3 efiboot1 (260M)
1067008 532480 4 efiboot2 (260M)
1599488 3198976 5 code1 (1.5G)
4798464 3198976 6 code2 [bootonce,bootme] (1.5G)
7997440 2048 7 cfg (1.0M)
7999488 479 - free - (240K)
Let's restart and see if it boots from code2:
# shutdown -r now
...
# df -h /
Filesystem Size Used Avail Capacity Mounted on
/dev/gpt/code2 1.5G 1.3G 241M 84% /
It did! The /etc/rc.d/gptboot script also properly cleared the flags:
# gpart show -l
=> 34 7999933 vtbd0 GPT (3.8G)
34 6 - free - (3.0K)
40 121 1 gptboot0 (61K)
161 1887 - free - (944K)
2048 532480 2 efiboot0 (260M)
534528 532480 3 efiboot1 (260M)
1067008 532480 4 efiboot2 (260M)
1599488 3198976 5 code1 (1.5G)
4798464 3198976 6 code2 (1.5G)
7997440 2048 7 cfg (1.0M)
7999488 479 - free - (240K)
Rebooting again should boot from code1:
# shutdown -r now
...
# df -h /
Filesystem Size Used Avail Capacity Mounted on
/dev/gpt/code1 1.5G 1.3G 241M 84% /
--
You are receiving this mail because:
You are the assignee for the bug.