Message ID | 1444274360-30189-9-git-send-email-bmeng.cn@gmail.com |
---|---|
State | Accepted |
Delegated to: | Simon Glass |
Headers | show |
On 8 October 2015 at 04:19, Bin Meng <bmeng.cn@gmail.com> wrote: > There are fields in VxWorks bootline for netmask and gatewayip. > We can get these from U-Boot environment variables and pass them > to VxWorks, just like ipaddr and serverip. > > Signed-off-by: Bin Meng <bmeng.cn@gmail.com> > > --- > > Changes in v3: > - Avoid calls to strlen() > > Changes in v2: > - Fix the endian issue for netmask > > common/cmd_elf.c | 17 +++++++++++++++-- > 1 file changed, 15 insertions(+), 2 deletions(-) Reviewed-by: Simon Glass <sjg@chromium.org>
On 8 October 2015 at 10:09, Simon Glass <sjg@chromium.org> wrote: > On 8 October 2015 at 04:19, Bin Meng <bmeng.cn@gmail.com> wrote: >> There are fields in VxWorks bootline for netmask and gatewayip. >> We can get these from U-Boot environment variables and pass them >> to VxWorks, just like ipaddr and serverip. >> >> Signed-off-by: Bin Meng <bmeng.cn@gmail.com> >> >> --- >> >> Changes in v3: >> - Avoid calls to strlen() >> >> Changes in v2: >> - Fix the endian issue for netmask >> >> common/cmd_elf.c | 17 +++++++++++++++-- >> 1 file changed, 15 insertions(+), 2 deletions(-) > > Reviewed-by: Simon Glass <sjg@chromium.org> Applied to u-boot-x86, thanks!
diff --git a/common/cmd_elf.c b/common/cmd_elf.c index 6c95851..6a09378 100644 --- a/common/cmd_elf.c +++ b/common/cmd_elf.c @@ -288,13 +288,26 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) CONFIG_SYS_VXWORKS_SERVERNAME); tmp = getenv("ipaddr"); - if (tmp) - ptr += sprintf(build_buf + ptr, "e=%s ", tmp); + if (tmp) { + ptr += sprintf(build_buf + ptr, "e=%s", tmp); + tmp = getenv("netmask"); + if (tmp) { + __be32 addr = getenv_ip("netmask").s_addr; + ptr += sprintf(build_buf + ptr, ":%08x ", + ntohl(addr)); + } else { + ptr += sprintf(build_buf + ptr, " "); + } + } tmp = getenv("serverip"); if (tmp) ptr += sprintf(build_buf + ptr, "h=%s ", tmp); + tmp = getenv("gatewayip"); + if (tmp) + ptr += sprintf(build_buf + ptr, "g=%s ", tmp); + tmp = getenv("hostname"); if (tmp) ptr += sprintf(build_buf + ptr, "tn=%s ", tmp);
There are fields in VxWorks bootline for netmask and gatewayip. We can get these from U-Boot environment variables and pass them to VxWorks, just like ipaddr and serverip. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> --- Changes in v3: - Avoid calls to strlen() Changes in v2: - Fix the endian issue for netmask common/cmd_elf.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)