]> git.sur5r.net Git - u-boot/blobdiff - common/cmd_pxe.c
pxe: try bootz if bootm fails to find a valid image
[u-boot] / common / cmd_pxe.c
index 5e3505c248f0771d459ce9f5badefcbe5f1759da..4e2811e156ffe6f505f2a1dcbff070c22fe8fe7d 100644 (file)
@@ -579,6 +579,7 @@ static int label_localboot(struct pxe_label *label)
 static int label_boot(struct pxe_label *label)
 {
        char *bootm_argv[] = { "bootm", NULL, NULL, NULL, NULL };
+       char initrd_str[22];
        int bootm_argc = 3;
 
        label_print(label);
@@ -604,7 +605,10 @@ static int label_boot(struct pxe_label *label)
                        return 1;
                }
 
-               bootm_argv[2] = getenv("ramdisk_addr_r");
+               bootm_argv[2] = initrd_str;
+               strcpy(bootm_argv[2], getenv("ramdisk_addr_r"));
+               strcat(bootm_argv[2], ":");
+               strcat(bootm_argv[2], getenv("filesize"));
        } else {
                bootm_argv[2] = "-";
        }
@@ -649,6 +653,11 @@ static int label_boot(struct pxe_label *label)
                bootm_argc = 4;
 
        do_bootm(NULL, 0, bootm_argc, bootm_argv);
+
+#ifdef CONFIG_CMD_BOOTZ
+       /* Try booting a zImage if do_bootm returns */
+       do_bootz(NULL, 0, bootm_argc, bootm_argv);
+#endif
        return 1;
 }