Index: stand/efi/gptboot/Makefile =================================================================== --- stand/efi/gptboot/Makefile +++ stand/efi/gptboot/Makefile @@ -6,6 +6,7 @@ EFI_DEBUG=yes BOOT1?= gptboot +MAN= gptboot.efi.8 .PATH: ${SRCTOP}/stand/efi/boot1 ${SRCTOP}/stand/libsa CFLAGS+= -I${SRCTOP}/stand/efi/boot1 CFLAGS+= -I${.CURDIR} Index: stand/efi/gptboot/gptboot.efi.8 =================================================================== --- stand/efi/gptboot/gptboot.efi.8 +++ stand/efi/gptboot/gptboot.efi.8 @@ -1,3 +1,4 @@ +.\" Copyright (c) 2021 Warner Losh .\" Copyright (c) 2013 Warren Block .\" All rights reserved. .\" @@ -24,21 +25,37 @@ .\" .\" $FreeBSD$ .\" -.Dd April 30, 2019 -.Dt GPTBOOT 8 +.Dd April 6, 2021 +.Dt GPTBOOT.EFI 8 .Os .Sh NAME -.Nm gptboot -.Nd GPT bootcode for UFS on BIOS-based computers +.Nm gptboot.efi +.Nd GPT bootcode for UFS on UEFI computers .Sh DESCRIPTION .Nm -is used on BIOS-based computers to boot from a UFS partition on a +is used on UEFI computers to boot from a UFS partition on a GPT-partitioned disk. .Nm -is installed in a -.Cm freebsd-boot -partition with -.Xr gpart 8 . +is installed in a UEFI ESP with the +.Xr cp 1 +command. +For BIOS-based computers, +see +.Xr gptboot 8 +for details. +While conceptually similar, the details differ. +.Pp +What UEFI computers boot is usually controlled via the mechanisms explained in +.Xr efibootmgr 8 +using +.Xr loader.efi 8 +or +.Xr boot1.efi 8 . +However, some setups cannot use that mechanism. +When what boots cannot depend on host-supplied UEFI variables, or +when bugs in the UEFI implementation prevent that, +.Nm +is used to bridge the gap. .Pp When it starts, .Nm @@ -46,13 +63,10 @@ boot from, as described under .Sx BOOTING , below. -If it does not find an eligible partition, or if the user hits a -key within three seconds, -.Nm -switches from auto-boot to interactive mode. -Interactive mode allows manual selection of the disk, partition, -filename, and boot option flags, as described in -.Xr boot 8 . +If it does not find an eligible partition, it returns to the UEFI +firmwarm. +The firmware will then try the next bootable item in the UEFI Boot Manager's +list, if any, usually a different disk. .Sh IMPLEMENTATION NOTES The GPT standard allows a variable number of partitions, but .Nm @@ -60,6 +74,9 @@ .Sh PARTITION ATTRIBUTES .Nm checks and manages several attributes of GPT UFS partitions. +These flags are +.Fx +specific and non-standard. .Bl -tag -width ".Cm bootfailed" .It Cm bootme Attempt to boot from this partition. @@ -97,7 +114,7 @@ For normal usage, the user does not have to set or manage any of the partition attributes. .Nm -will boot from the first UFS partition found. +will boot from the first UFS partition found on the device. .Pp The .Cm bootonce @@ -195,41 +212,34 @@ attribute is cleared from the partition that successfully booted. There is normally only one of these. .Sh FILES -.Bl -tag -width /boot/gptboot -compact -.It Pa /boot/gptboot +.Bl -tag -width /boot/gptboot.efi -compact +.It Pa /boot/gptboot.efi bootcode binary -.It Pa /boot.config -parameters for the boot blocks -.Pq optional +.It Pa /boot/efi/efi/boot/bootx64.efi +Default boot loader for amd64 systems. +.It Pa /boot/efi/efi/boot/bootaa64.efi +Default boot loader for arm64 systems. +.It Pa /boot/efi/efi/boot/bootar.efi +Default boot loader for arm systems. .El .Sh EXAMPLES .Nm -is installed in a -.Cm freebsd-boot -partition, usually the first partition on the disk. -A -.Dq protective MBR -.Po -see -.Xr gpart 8 -.Pc -is typically installed in combination with -.Nm . +is installed in the ESP (EFI System Partition) with +.Xr cp 1 . .Pp Install .Nm -on the -.Pa ada0 -drive: -.Bd -literal -offset indent -gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada0 -.Ed -.Pp -.Nm -can also be installed without the PMBR: -.Bd -literal -offset indent -gpart bootcode -p /boot/gptboot -i 1 ada0 +into the ESP for the system. +This assumes the ESP is mounted in the standard +.Pa /boot/efi +directory. +For amd64, use the following +.Bd -literal -offset indent -compact +cp /boot/gptboot.efi /boot/efi/efi/boot/bootx64.efi .Ed +For other systems, use the file listed in the +.Sx FILES +section. .Pp Set the .Cm bootme @@ -247,13 +257,18 @@ gpart set -a bootonce -i 2 ada0 .Ed .Sh SEE ALSO -.Xr boot.config 5 , .Xr rc.conf 5 , .Xr boot 8 , +.Xr efibootmgr 8 , .Xr gpart 8 .Sh HISTORY .Nm -appeared in FreeBSD 7.1. +appeared in +.Fx 13.0 .Sh AUTHORS This manual page written by +.An Warner Losh Aq imp@FreeBSD.org . +It is based heavily on the +.Xr gptboot 8 +man page by .An Warren Block Aq wblock@FreeBSD.org . Index: stand/i386/gptboot/gptboot.8 =================================================================== --- stand/i386/gptboot/gptboot.8 +++ stand/i386/gptboot/gptboot.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 30, 2019 +.Dd April 6, 2021 .Dt GPTBOOT 8 .Os .Sh NAME @@ -39,6 +39,10 @@ .Cm freebsd-boot partition with .Xr gpart 8 . +For UEFI, +.Xr gpart.efi 8 +is used instead. +While conceptually similar, the details differ. .Pp When it starts, .Nm