]> git.sur5r.net Git - u-boot/commitdiff
pxe: Fix pxe boot with FIT image
authorYork Sun <york.sun@nxp.com>
Thu, 1 Sep 2016 08:28:21 +0000 (16:28 +0800)
committerTom Rini <trini@konsulko.com>
Wed, 7 Sep 2016 12:49:02 +0000 (08:49 -0400)
When FIT image is used, a single image provides kernel, device
tree and optionally ramdisk. Argc and argv need to be adjusted
to support this.

Test cases:
1. Booting with legacy images
2. Booting with legacy images without initrd
3. Booting with FIT image
Test commands:
1. pxe get && pxe boot
2. sysboot

Signed-off-by: York Sun <york.sun@nxp.com>
Signed-off-by: Wenbin Song <wenbin.song@nxp.com>
cmd/pxe.c

index 9434a18177a7e020b1a7181d981eb5a4f5535d01..0a07f14ca8fa94a8e15097cd9b394fc7705344ae 100644 (file)
--- a/cmd/pxe.c
+++ b/cmd/pxe.c
@@ -620,7 +620,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
        char initrd_str[22];
        char mac_str[29] = "";
        char ip_str[68] = "";
-       int bootm_argc = 3;
+       int bootm_argc = 2;
        int len = 0;
        ulong kernel_addr;
        void *buf;
@@ -652,8 +652,6 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
                strcpy(bootm_argv[2], getenv("ramdisk_addr_r"));
                strcat(bootm_argv[2], ":");
                strcat(bootm_argv[2], getenv("filesize"));
-       } else {
-               bootm_argv[2] = "-";
        }
 
        if (get_relfile_envaddr(cmdtp, label->kernel, "kernel_addr_r") < 0) {
@@ -785,8 +783,11 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
        if (!bootm_argv[3])
                bootm_argv[3] = getenv("fdt_addr");
 
-       if (bootm_argv[3])
+       if (bootm_argv[3]) {
+               if (!bootm_argv[2])
+                       bootm_argv[2] = "-";
                bootm_argc = 4;
+       }
 
        kernel_addr = genimg_get_kernel_addr(bootm_argv[1]);
        buf = map_sysmem(kernel_addr, 0);