@@ -116,21 +116,17 @@ static int extlinux_pxe_read_file(struct udevice *dev, struct bootflow *bflow,
const char *file_path, ulong addr,
enum bootflow_img_t type, ulong *sizep)
{
- char *tftp_argv[] = {"tftp", NULL, NULL, NULL};
- struct pxe_context *ctx = dev_get_priv(dev);
- char file_addr[17];
ulong size;
int ret;
- sprintf(file_addr, "%lx", addr);
- tftp_argv[1] = file_addr;
- tftp_argv[2] = (void *)file_path;
-
- if (do_tftpb(ctx->cmdtp, 0, 3, tftp_argv))
- return -ENOENT;
- ret = pxe_get_file_size(&size);
+ if (IS_ENABLED(CONFIG_NET_LWIP))
+ return -ENOTSUPP;
+ ret = netboot_run(TFTPGET, addr, file_path, 0, false);
if (ret)
return log_msg_ret("tftp", ret);
+ ret = pxe_get_file_size(&size);
+ if (ret)
+ return log_msg_ret("tft2", ret);
if (size > *sizep)
return log_msg_ret("spc", -ENOSPC);
*sizep = size;
@@ -29,25 +29,18 @@ const char *pxe_default_paths[] = {
static int do_get_tftp(struct pxe_context *ctx, const char *file_path,
char *file_addr, enum bootflow_img_t type, ulong *sizep)
{
- char *tftp_argv[] = {"tftp", NULL, NULL, NULL};
int ret;
- int num_args;
- tftp_argv[1] = file_addr;
- tftp_argv[2] = (void *)file_path;
- if (ctx->use_ipv6) {
- tftp_argv[3] = USE_IP6_CMD_PARAM;
- num_args = 4;
- } else {
- num_args = 3;
- }
-
- if (do_tftpb(ctx->cmdtp, 0, num_args, tftp_argv))
- return -ENOENT;
+ if (IS_ENABLED(CONFIG_NET_LWIP))
+ return -ENOTSUPP;
+ ret = netboot_run(TFTPGET, hextoul(file_addr, NULL), file_path, 0,
+ ctx->use_ipv6);
+ if (ret)
+ return log_msg_ret("tfp", ret);
ret = pxe_get_file_size(sizep);
if (ret)
- return log_msg_ret("tftp", ret);
+ return log_msg_ret("tf2", ret);
ctx->pxe_file_size = *sizep;
return 1;
Use the new netboot_run() function to avoid building a command line, when running these network operations. For the one board which uses lwip, it is not quite clear how to avoid using the cmdline interface, so produce an error, for now. This can be figured out later. Signed-off-by: Simon Glass <sjg@chromium.org> --- (no changes since v1) boot/bootmeth_pxe.c | 16 ++++++---------- cmd/pxe.c | 21 +++++++-------------- 2 files changed, 13 insertions(+), 24 deletions(-)