diff options
| author | Benjamin Hahn <[email protected]> | 2025-10-21 16:34:17 +0200 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-10-24 13:47:50 -0600 |
| commit | fae6c54d238279bf79c66ca65330425dff2c952f (patch) | |
| tree | 813cf6aced3b0b62a91d28f234806373c84db07e /net | |
| parent | 8506cf58ffa2029f168cc64089763084b408051d (diff) | |
bootstd: make it possible to use tftp for netboot with standardboot
Add the option to load the bootscript with the tftp command (static IP)
instead of the dhcp command (dynamic IP). For this a new function
tftpb_run similar to dhcp_run, is needed. The selection of which command
to use can be done with the ip_dyn environment variable, which can be
set to yes or no. The ip_dyn variable was chosen as it is already in use
on the imx platforms.
Also edit the bootstd doc.
Reviewed-by: Simon Glass <[email protected]>
Signed-off-by: Benjamin Hahn <[email protected]>
Diffstat (limited to 'net')
| -rw-r--r-- | net/net-common.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/net/net-common.c b/net/net-common.c index 442b0597558..c68e19fc03e 100644 --- a/net/net-common.c +++ b/net/net-common.c @@ -83,3 +83,24 @@ int dhcp_run(ulong addr, const char *fname, bool autoload) return 0; } #endif + +#if defined(CONFIG_CMD_TFTPBOOT) +int tftpb_run(ulong addr, const char *fname) +{ + char *tftp_argv[] = {"tftpboot", NULL, (char *)fname, NULL}; + struct cmd_tbl cmdtp = {}; /* dummy */ + char file_addr[17] = {0}; + + log_debug("addr=%lx, fname=%s\n", addr, fname); + sprintf(file_addr, "%lx", addr); + tftp_argv[1] = file_addr; + + int result = do_tftpb(&cmdtp, 0, fname ? 3 : 2, tftp_argv); + + if (result) + return log_msg_ret("res", -ENOENT); + + return 0; +} + +#endif |
