]> git.sur5r.net Git - u-boot/blobdiff - cmd/pxe.c
Merge branch 'master' of git://git.denx.de/u-boot-sunxi
[u-boot] / cmd / pxe.c
index c5a770a26995fabc5a1b3b0b7450997d29e110db..5609545de575d090b27f48fd0d2d2ee61b8bdc73 100644 (file)
--- a/cmd/pxe.c
+++ b/cmd/pxe.c
@@ -1,8 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright 2010-2011 Calxeda, Inc.
  * Copyright (c) 2014, NVIDIA CORPORATION.  All rights reserved.
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -616,7 +615,7 @@ static int label_localboot(struct pxe_label *label)
 static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
 {
        char *bootm_argv[] = { "bootm", NULL, NULL, NULL, NULL };
-       char initrd_str[22];
+       char initrd_str[28];
        char mac_str[29] = "";
        char ip_str[68] = "";
        int bootm_argc = 2;
@@ -648,9 +647,9 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
                }
 
                bootm_argv[2] = initrd_str;
-               strcpy(bootm_argv[2], env_get("ramdisk_addr_r"));
+               strncpy(bootm_argv[2], env_get("ramdisk_addr_r"), 18);
                strcat(bootm_argv[2], ":");
-               strcat(bootm_argv[2], env_get("filesize"));
+               strncat(bootm_argv[2], env_get("filesize"), 9);
        }
 
        if (get_relfile_envaddr(cmdtp, label->kernel, "kernel_addr_r") < 0) {
@@ -686,16 +685,17 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
                               strlen(ip_str), strlen(mac_str),
                               sizeof(bootargs));
                        return 1;
+               } else {
+                       if (label->append)
+                               strncpy(bootargs, label->append,
+                                       sizeof(bootargs));
+                       strcat(bootargs, ip_str);
+                       strcat(bootargs, mac_str);
+
+                       cli_simple_process_macros(bootargs, finalbootargs);
+                       env_set("bootargs", finalbootargs);
+                       printf("append: %s\n", finalbootargs);
                }
-
-               if (label->append)
-                       strcpy(bootargs, label->append);
-               strcat(bootargs, ip_str);
-               strcat(bootargs, mac_str);
-
-               cli_simple_process_macros(bootargs, finalbootargs);
-               env_set("bootargs", finalbootargs);
-               printf("append: %s\n", finalbootargs);
        }
 
        bootm_argv[1] = env_get("kernel_addr_r");
@@ -1453,8 +1453,8 @@ static struct menu *pxe_menu_to_menu(struct pxe_menu *cfg)
        /*
         * Create a menu and add items for all the labels.
         */
-       m = menu_create(cfg->title, cfg->timeout, cfg->prompt, label_print,
-                       NULL, NULL);
+       m = menu_create(cfg->title, DIV_ROUND_UP(cfg->timeout, 10),
+                       cfg->prompt, label_print, NULL, NULL);
 
        if (!m)
                return NULL;