freebsd-skq/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 Go back to one loader.conf 2018-02-26 03:16:47 +00:00
arm64 No need to make objects here. 2018-04-27 22:15:18 +00:00
common Collapse zfsloader functionality back down into loader. 2018-07-20 05:17:37 +00:00
defaults Default loader.conf: Drop efi_max_resolution to 1x1 2018-04-03 02:41:32 +00:00
efi Finalize the boot manager protocol support for next-stage boot 2018-07-23 20:36:59 +00:00
fdt Eliminate bsd.stand.mk and -fPIC 32-bit intel builds 2018-02-16 00:17:32 +00:00
ficl Prefer uintXX_t to u_intXX_t 2018-03-13 16:33:00 +00:00
ficl32
forth check-password.4th(8): Fix manual [in]accuracy 2018-06-24 19:29:29 +00:00
i386 Older zfs boot blocks don't support symlinks. install the link to 2018-07-23 06:04:05 +00:00
kshim A more definitions to kernel emulation shim in order to build stand/usb. 2018-02-07 18:50:36 +00:00
liblua Use M. Warner Losh everywhere on my copyrights. 2018-05-01 16:29:22 +00:00
liblua32 Add Lua as a scripting langauge to /boot/loader 2018-02-12 15:31:53 +00:00
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 Don't use CCACHE for linking. 2018-06-27 19:29:15 +00:00
ofw Stop using ../zfs/libzfs.h but instead use libzfs.h. 2018-07-08 07:42:58 +00:00
powerpc bootprog_info is generated in vers.c. Move it's definition to 2018-06-14 06:41:33 +00:00
sparc64 Older zfs boot blocks don't support symlinks. install the link to 2018-07-23 06:04:05 +00:00
uboot loader: fdt: Try to load every possible DTB from u-boot 2018-07-04 07:37:45 +00:00
usb Move the stand/usb test loader into its own directory. 2018-02-07 19:20:59 +00:00
userboot Extend loader(8) geli support to all architectures and all disk-like devices. 2018-07-13 17:50:25 +00:00
defs.mk Extend loader(8) geli support to all architectures and all disk-like devices. 2018-07-13 17:50:25 +00:00
fdt.mk
ficl.mk Remove redundant defs.mk includes. They aren't needed. 2018-06-14 06:14:48 +00:00
loader.mk Collapse zfsloader functionality back down into loader. 2018-07-20 05:17:37 +00:00
lua.mk Do not include float interfaces when using libsa. 2018-02-23 04:04:25 +00:00
Makefile Move ZFS files into libsa 2018-07-08 07:42:49 +00:00
Makefile.amd64 Create LOADER_UBOOT, and LOADER_OFW. Move these options out of 2018-03-01 19:50:55 +00:00
Makefile.inc Minor flags cleanup 2017-12-02 00:06:58 +00:00
uboot.mk Unify metadata load files for arm, mips, powerpc, sparc64 2018-02-13 03:44:50 +00:00