cmd: bootvx: Pass netmask and gatewayip to VxWorks bootline
authorBin Meng <bmeng.cn@gmail.com>
Thu, 8 Oct 2015 03:19:16 +0000 (20:19 -0700)
committerSimon Glass <sjg@chromium.org>
Wed, 21 Oct 2015 13:46:26 +0000 (07:46 -0600)
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>
Reviewed-by: Simon Glass <sjg@chromium.org>
common/cmd_elf.c

index 6c958516424b8f9954d9dd874b20f5d4ae4420f0..6a0937823fba2f5c50e07729f5cb98a47ee2edda 100644 (file)
@@ -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);