Message ID | 20180704003643.10133-1-joe.hershberger@ni.com |
---|---|
State | Accepted |
Commit | 3a66fcb7c3dd3297d7e49185a8da2cbe77ffa431 |
Delegated to: | Joe Hershberger |
Headers | show |
Series | [U-Boot,1/5] net: When checking prerequisites, consider boot_file_name | expand |
On 07/04/2018 02:36 AM, Joe Hershberger wrote: > For net_boot_common, we allow the serverip to be specified as part of > the boot file name. For net commands that require serverip, include that > source as a valid specification of serverip. > > Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Alexander Graf <agraf@suse.de> Alex
Hi Joe, https://patchwork.ozlabs.org/patch/939043/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git Thanks! -Joe
diff --git a/include/net.h b/include/net.h index f9984ae86c..de2d7bba19 100644 --- a/include/net.h +++ b/include/net.h @@ -839,6 +839,9 @@ ushort env_get_vlan(char *); /* copy a filename (allow for "..." notation, limit length) */ void copy_filename(char *dst, const char *src, int size); +/* check if serverip is specified in filename from the command line */ +int is_serverip_in_cmd(void); + /* get a random source port */ unsigned int random_port(void); diff --git a/net/net.c b/net/net.c index f35695b4fc..bff3e9c5b5 100644 --- a/net/net.c +++ b/net/net.c @@ -1341,7 +1341,7 @@ static int net_check_prereq(enum proto_t protocol) /* Fall through */ case TFTPGET: case TFTPPUT: - if (net_server_ip.s_addr == 0) { + if (net_server_ip.s_addr == 0 && !is_serverip_in_cmd()) { puts("*** ERROR: `serverip' not set\n"); return 1; } @@ -1512,6 +1512,11 @@ void copy_filename(char *dst, const char *src, int size) *dst = '\0'; } +int is_serverip_in_cmd(void) +{ + return !!strchr(net_boot_file_name, ':'); +} + #if defined(CONFIG_CMD_NFS) || \ defined(CONFIG_CMD_SNTP) || \ defined(CONFIG_CMD_DNS)
For net_boot_common, we allow the serverip to be specified as part of the boot file name. For net commands that require serverip, include that source as a valid specification of serverip. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> --- include/net.h | 3 +++ net/net.c | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-)