freebsd-dev/stand
Kyle Evans d3d381b2b1 userboot: handle guest interpreter mismatches more intelligently
The switch to lualoader creates a problem with userboot: the host is
inclined to build userboot with Lua, but the host userboot's interpreter
must match what's available on the guest. For almost all FreeBSD guests in
the wild, Lua is not yet available and a Lua-based userboot will fail.

This revision updates userboot protocol to version 5, which adds a
swap_interpreter callback to request a different interpreter, and tries to
determine the proper interpreter to be used based on how the guest
/boot/loader is compiled. This is still a bit of a guess, but it's likely
the best possible guess we can make in order to get it right. The
interpreter is now embedded in the resulting executable, so we can open
/boot/loader on the guest and hunt that down to derive the interpreter it
was built with.

Using -l with bhyveload will not allow an intepreter swap, even if the
loader specified happens to be a userboot with the wrong interpreter. We'll
simply complain about the mismatch and bail out.

For legacy guests without the interpreter marker, we assume they're 4th.
For new guests with the interpreter marker, we'll read it and swap over
to the proper interpreter if it doesn't match what the userboot we're using
was compiled with.

Both flavors of userboot are installed by default, userboot_4th.so and
userboot_lua.so. This fixes the build WITHOUT_FORTH as a coincidence, which
was broken by userboot being forced to 4th.

Reviewed by:	imp, jhb, araujo (earlier version)
Approved by:	re (gjb)
Differential Revision:	https://reviews.freebsd.org/D16945
2018-09-01 02:23:45 +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 userboot: handle guest interpreter mismatches more intelligently 2018-09-01 02:23:45 +00:00
defaults Document the cpu_microcode_* tunables. 2018-08-28 17:14:46 +00:00
efi Ensure we have a large enough stack for the lua loader 2018-08-27 11:14:49 +00:00
fdt stand: fdt: Drop some write-only assignments/variables and leaked bits 2018-08-23 18:01:34 +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 loader: bios loader should allow to chain load a file 2018-08-22 10:04:42 +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 MFV r337586: lua: Update to 5.3.5 2018-08-14 18:58:01 +00:00
liblua32 Add Lua as a scripting langauge to /boot/loader 2018-02-12 15:31:53 +00:00
libsa libsa: Add lshrdi3.c for powerpc* and mips 2018-08-19 14:48:32 +00:00
libsa32
lua lualoader: fix color usage 2018-08-30 13:29:32 +00:00
man Improve formatting. 2018-08-15 11:39:13 +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 Increase the size of the heap size available on sparc64 during 2018-08-22 14:33:57 +00:00
uboot ubldr: Bump heap size, 1MB -> 2MB 2018-08-01 20:08:20 +00:00
usb Move the stand/usb test loader into its own directory. 2018-02-07 19:20:59 +00:00
userboot userboot: handle guest interpreter mismatches more intelligently 2018-09-01 02:23:45 +00:00
defs.mk stand: Flip the default interpreter to Lua 2018-08-19 14:26:33 +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 Create a loader for each interpreter for x86 BIOS and all EFI 2018-08-14 18:44:41 +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