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 <sjg@chromium.org> Signed-off-by: Benjamin Hahn <B.Hahn@phytec.de>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user