[PATCH 1/1] efi_loader: support booting semihosting file

Executing an EFI binary fails for files loaded via semihosting.
Construct a dummy device path for EFI binaries loaded via semihosting.
A future complete solution may include the creation of a handle with a simple file system protocol.
Reported-by: Andre Przywara andre.przywara@arm.com Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com --- lib/efi_loader/efi_device_path.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index e2e98a39be..20ad948498 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -1203,7 +1203,8 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr, } else if (!strcmp(dev, "Uart")) { if (device) *device = efi_dp_from_uart(); - } else if (!strcmp(dev, "Mem")) { + } else if (!strcmp(dev, "Mem") || !strcmp(dev, "hostfs")) { + /* loadm command and semihosting */ efi_get_image_parameters(&image_addr, &image_size);
if (device)

On Sat, 13 May 2023 at 03:30, Heinrich Schuchardt heinrich.schuchardt@canonical.com wrote:
Executing an EFI binary fails for files loaded via semihosting.
Construct a dummy device path for EFI binaries loaded via semihosting.
A future complete solution may include the creation of a handle with a simple file system protocol.
Reported-by: Andre Przywara andre.przywara@arm.com Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com
lib/efi_loader/efi_device_path.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index e2e98a39be..20ad948498 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -1203,7 +1203,8 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr, } else if (!strcmp(dev, "Uart")) { if (device) *device = efi_dp_from_uart();
} else if (!strcmp(dev, "Mem")) {
} else if (!strcmp(dev, "Mem") || !strcmp(dev, "hostfs")) {
/* loadm command and semihosting */ efi_get_image_parameters(&image_addr, &image_size); if (device)
-- 2.39.2
Reviewed-by: Ilias Apalodimas ilias.apalodimas@linaro.org

On Sat, 13 May 2023 02:30:44 +0200 Heinrich Schuchardt heinrich.schuchardt@canonical.com wrote:
Executing an EFI binary fails for files loaded via semihosting.
Construct a dummy device path for EFI binaries loaded via semihosting.
A future complete solution may include the creation of a handle with a simple file system protocol.
Reported-by: Andre Przywara andre.przywara@arm.com Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com
Tested-by: Andre Przywara andre.przywara@arm.com
Thanks, Andre
lib/efi_loader/efi_device_path.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index e2e98a39be..20ad948498 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -1203,7 +1203,8 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr, } else if (!strcmp(dev, "Uart")) { if (device) *device = efi_dp_from_uart();
- } else if (!strcmp(dev, "Mem")) {
} else if (!strcmp(dev, "Mem") || !strcmp(dev, "hostfs")) {
/* loadm command and semihosting */
efi_get_image_parameters(&image_addr, &image_size);
if (device)
participants (3)
-
Andre Przywara
-
Heinrich Schuchardt
-
Ilias Apalodimas