HardenedBSD/stand
Warner Losh b43c6042c3 Finalize the boot manager protocol support for next-stage boot
loading.

If we are booting in a conforming UEFI Boot Manager Environment, then
use the BootCurrent variable to find the BootXXXX we're using. Once we
find that, then if it contains more than one EFI_DEVICE_PATH in its
what to boot section, try to use the last one as the kernel to
load. This will also set the default root partition as well. If
there's only one path, or if there's an error along the way, assume
that nothing specific was specified and revert to the old
algorithm. If something was specified, but not found, then fail the
boot. Otherwise you that, specific thing. On FreeBSD, this can be set
using efibootmgr -l <loader> -k <kernel>. We try a few variations of
kernel to cope with the fact that UEFI comes from a DOS world where
paths might be upper case and/or contain back-slashes.

Note: In an ideal world, we'd work out where we are in chain loading
by looking at the passed-in image handle and doing name
matching. However, that's unreliable since at least boot1.efi booted
images don't have that, hence the assumption that loader.efi needs to
load the last thing on the list, if possible.

The reason we fail for something specific is so that we can fully
participate in the UEFI Boot Manager Protocol and fail over to the
next item in the list of BootOrder choices when something goes wrong
at this stage.

This implements was was talked about in freebsd-arch@ last year
https://docs.freebsd.org/cgi/getmsg.cgi?fetch=3576+0+archive/2017/freebsd-arch/20171022.freebsd-arch
and documented in full (after changed resulting from the discussion) in
https://docs.google.com/document/d/1aK9IqF-60JPEbUeSAUAkYjF2W_8EnmczFs6RqCT90Jg/edit#
although one or two minor details may have been modified in this
implementation to make it work, and the ZFS MEDIA PATH extension isn't
implemented. This does not yet move things to ESP:\efi\freebsd\loader.efi.

RelNotes: Yes
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D16403
2018-07-23 20:36:59 +00:00
..
arm
arm64
common Collapse zfsloader functionality back down into loader. 2018-07-20 05:17:37 +00:00
defaults
efi Finalize the boot manager protocol support for next-stage boot 2018-07-23 20:36:59 +00:00
fdt
ficl
ficl32
forth
i386 Older zfs boot blocks don't support symlinks. install the link to 2018-07-23 06:04:05 +00:00
kshim
liblua
liblua32
libsa Use if rather than case for a simple boolean. gcc thinks blks is 2018-07-13 18:19:33 +00:00
libsa32
lua Eliminate zfsloader man page. 2018-07-20 05:17:49 +00:00
man Eliminate zfsloader man page. 2018-07-20 05:17:49 +00:00
mips
ofw
powerpc
sparc64 Older zfs boot blocks don't support symlinks. install the link to 2018-07-23 06:04:05 +00:00
uboot
usb
userboot
defs.mk
fdt.mk
ficl.mk
loader.mk Collapse zfsloader functionality back down into loader. 2018-07-20 05:17:37 +00:00
lua.mk
Makefile
Makefile.amd64
Makefile.inc
uboot.mk