cmd: bootefi: restore ability to boot arbitrary blob
authorKyle Evans <kevans@FreeBSD.org>
Sun, 10 Apr 2022 21:05:55 +0000 (16:05 -0500)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Sat, 23 Apr 2022 20:05:33 +0000 (22:05 +0200)
commit2058983689f0e42f639a5fbece26ecd9fed5fa41
treefcf7a5878215de29f6c5fa59fb2219ff1e410264
parent11343854b6c9875491d8a642fbc9ccf5606b55fb
cmd: bootefi: restore ability to boot arbitrary blob

Up until commit 5f59518a7b1ae ("efi_loader: setting boot device"), we
could boot an arbitrary blob with bootefi. Indeed, efi_run_image() even
has a special case for missing device paths indicating a payload that
was directly loaded via JTAG, for example.

Restore the ability to inject a UEFI payload into memory and `bootefi`
it. If the address passed isn't the last PE-COFF loaded, then we'll
wipe out the pre-existing DP/Image information and let efi_run_image()
synthesize a memory device path.

An image size is required if we're booting an arbitrary payload, and
the FDT argument has been changed to accept `-`. The size could be
deduced from the image header, but it's required anyways as an explicit
acknowledgment that one's trying to boot an arbitrary payload rather
than accidentally using the wrong address in the single-addr form.

Fixes: 5f59518a7b1a ("efi_loader: setting boot device")
Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
cmd/bootefi.c