[PATCH v3 7/7] bootmeth_efi: Support PXE booting
Simon Glass
sjg at chromium.org
Thu Dec 19 03:38:32 CET 2024
Finish off the implementation so it is possible to boot an EFI app over
a network.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
Changes in v3:
- Add new patch to support PXE booting
- Rebase on Tom's tree (i.e. without the pointers/addresses series)
https://patchwork.ozlabs.org/project/uboot/list/?series=436241
boot/bootmeth_efi.c | 15 +--------------
lib/efi_loader/efi_bootbin.c | 5 ++++-
2 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/boot/bootmeth_efi.c b/boot/bootmeth_efi.c
index fa7f66c9a0b..de7ae2d2ee4 100644
--- a/boot/bootmeth_efi.c
+++ b/boot/bootmeth_efi.c
@@ -210,6 +210,7 @@ static int distro_efi_read_bootflow_net(struct bootflow *bflow)
if (size <= 0)
return log_msg_ret("sz", -EINVAL);
bflow->size = size;
+ bflow->buf = map_sysmem(addr, size);
/* bootfile should be setup by dhcp */
bootfile_name = env_get("bootfile");
@@ -217,10 +218,6 @@ static int distro_efi_read_bootflow_net(struct bootflow *bflow)
return log_msg_ret("bootfile_name", ret);
bflow->fname = strdup(bootfile_name);
- /* do the hideous EFI hack */
- efi_set_bootdev("Net", "", bflow->fname, map_sysmem(addr, 0),
- bflow->size);
-
/* read the DT file also */
fdt_addr_str = env_get("fdt_addr_r");
if (!fdt_addr_str)
@@ -294,16 +291,6 @@ static int distro_efi_boot(struct udevice *dev, struct bootflow *bflow)
if (bflow->flags & ~BOOTFLOWF_USE_BUILTIN_FDT)
fdt = bflow->fdt_addr;
- } else {
- /*
- * This doesn't actually work for network devices:
- *
- * do_bootefi_image() No UEFI binary known at 0x02080000
- *
- * But this is the same behaviour for distro boot, so it can be
- * fixed here.
- */
- fdt = env_get_hex("fdt_addr_r", 0);
}
if (efi_bootflow_run(bflow))
diff --git a/lib/efi_loader/efi_bootbin.c b/lib/efi_loader/efi_bootbin.c
index b5d15a723b4..249de3cadc5 100644
--- a/lib/efi_loader/efi_bootbin.c
+++ b/lib/efi_loader/efi_bootbin.c
@@ -302,6 +302,9 @@ static const char *calc_dev_name(struct bootflow *bflow)
media_dev = dev_get_parent(bflow->dev);
if (!bflow->blk) {
+ if (device_get_uclass_id(media_dev) == UCLASS_ETH)
+ return "Net";
+
log_err("Cannot boot EFI app on media '%s'\n",
dev_get_uclass_name(media_dev));
@@ -342,7 +345,7 @@ efi_status_t efi_bootflow_run(struct bootflow *bflow)
ret = calculate_paths(dev_name, devnum_str, bflow->fname, &device,
&image);
if (ret)
- return ret;
+ return EFI_UNSUPPORTED;
if (bflow->flags & BOOTFLOWF_USE_BUILTIN_FDT) {
log_debug("Booting with built-in fdt\n");
--
2.34.1
More information about the U-Boot
mailing list