Hi Maxim,

On 27/11/2023 13:56, Maxim Uvarov wrote:
U-Boot recently got support for an alternative network stack using LWIP.
Replace tftp command with the LWIP variant while keeping the output and
error messages identical.

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
---
  include/net/lwip.h             |  13 ++++
  net/lwip/Makefile              |   1 +
  net/lwip/apps/tftp/Makefile    |   7 ++
  net/lwip/apps/tftp/lwip-tftp.c | 132 +++++++++++++++++++++++++++++++++
  4 files changed, 153 insertions(+)
  create mode 100644 net/lwip/apps/tftp/Makefile
  create mode 100644 net/lwip/apps/tftp/lwip-tftp.c


<snip>


With:
=======><==============================================
diff --git a/net/lwip/apps/tftp/lwip-tftp.c b/net/lwip/apps/tftp/lwip-tftp.c
index 7b384cecf8..1d1b7e8fa5 100644
--- a/net/lwip/apps/tftp/lwip-tftp.c
+++ b/net/lwip/apps/tftp/lwip-tftp.c
@@ -8,6 +8,8 @@
 #include <command.h>
 #include <console.h>
 #include <bootstage.h>
+#include <efi_loader.h>
+#include <mapmem.h>

 #include "tftp_client.h"
 #include "tftp_server.h"
@@ -17,6 +19,7 @@

 #include <net/ulwip.h>

+static char *filename;
 static ulong daddr;
 static ulong size;
 static unsigned int progress_print;
@@ -38,6 +41,12 @@ static void tftp_close(void *handle)
                ulwip_exit(-1);
                return;
        }
+
+       if (IS_ENABLED(CONFIG_CMD_BOOTEFI))
+               efi_set_bootdev("Net", "", filename,
+                               map_sysmem(daddr - size, 1),
+                               size);
+
        ulwip_exit(0);
 }

@@ -92,6 +101,7 @@ int ulwip_tftp(ulong addr, char *fname)

        size = 0;
        daddr = addr;
+       filename = fname;
        server_ip = env_get("serverip");
        if (!server_ip) {
                log_err("error: serverip variable has to be set\n");
=================><======================================

Loading EFI works again, and you can drop patch 15.

Neil

Reply via email to