Jerome Forissier <[email protected]> schrieb am Do., 14. Nov. 2024, 18:10:
> The dhcp command is supposed to have the following syntax as per > "help dhcp": > > dhcp [loadAddress] [[hostIPaddr:]bootfilename] > > In other words, any arguments should be passed to an implicit > tftpboot command after the DHCP exchange has occurred. > > Add the missing code to the lwIP version of do_dhcp(). > > Signed-off-by: Jerome Forissier <[email protected]> > --- > net/lwip/dhcp.c | 27 ++++++++++++++++++++++++++- > 1 file changed, 26 insertions(+), 1 deletion(-) > > diff --git a/net/lwip/dhcp.c b/net/lwip/dhcp.c > index 23b56226921..6f987e469d6 100644 > --- a/net/lwip/dhcp.c > +++ b/net/lwip/dhcp.c > @@ -111,9 +111,34 @@ static int dhcp_loop(struct udevice *udev) > > int do_dhcp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) > { > + int ret; > + > eth_set_current(); > > - return dhcp_loop(eth_get_dev()); > + ret = dhcp_loop(eth_get_dev()); > + if (ret) > + return ret; > + > + if (argc > 1) { > + int i; > + char **tftp_argv; > + struct cmd_tbl cmdtp = {}; > + > + /* Invoke tftpboot with the arguments passed to dhcp */ > + if (argc > 3) > + return CMD_RET_FAILURE; > + tftp_argv = malloc(argc * sizeof(char *)); > + if (!tftp_argv) > + return CMD_RET_FAILURE; > + tftp_argv[0] = "tftpboot"; > + for (i = 1; i < argc; i++) > + tftp_argv[i] = argv[i]; > Couldn't you just pass the original argv and argc if argc > 1. Best regards Heinrich + ret = do_tftpb(&cmdtp, 0, argc, tftp_argv); > + free(tftp_argv); > + return ret; > + } > + > + return CMD_RET_SUCCESS; > } > > int dhcp_run(ulong addr, const char *fname, bool autoload) > -- > 2.40.1 > >

