[PATHv11 06/43] net/lwip: implement tftp cmd

neil.armstrong at linaro.org neil.armstrong at linaro.org
Tue Nov 28 17:34:51 CET 2023


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.uvarov at 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


More information about the U-Boot mailing list