]> Git Repo - u-boot.git/blobdiff - boot/bootm.c
bootm: Move arm64-image processing later
[u-boot.git] / boot / bootm.c
index cb61485c226cb213c7ed55a76177446cd5fbacb5..e051a0cc188018c48b37bd8f45d62f0f51fbfb9d 100644 (file)
@@ -240,24 +240,8 @@ static int bootm_find_os(struct cmd_tbl *cmdtp, int flag, int argc,
        }
 
        if (images.os.type == IH_TYPE_KERNEL_NOLOAD) {
-               if (IS_ENABLED(CONFIG_CMD_BOOTI) &&
-                   images.os.arch == IH_ARCH_ARM64 &&
-                   images.os.os == IH_OS_LINUX) {
-                       ulong image_addr;
-                       ulong image_size;
-
-                       ret = booti_setup(images.os.image_start, &image_addr,
-                                         &image_size, true);
-                       if (ret != 0)
-                               return 1;
-
-                       images.os.type = IH_TYPE_KERNEL;
-                       images.os.load = image_addr;
-                       images.ep = image_addr;
-               } else {
-                       images.os.load = images.os.image_start;
-                       images.ep += images.os.image_start;
-               }
+               images.os.load = images.os.image_start;
+               images.ep += images.os.image_start;
        }
 
        images.os.start = map_to_sysmem(os_hdr);
@@ -466,6 +450,31 @@ static int bootm_load_os(struct bootm_headers *images, int boot_progress)
                }
        }
 
+       if (IS_ENABLED(CONFIG_CMD_BOOTI) && images->os.arch == IH_ARCH_ARM64 &&
+           images->os.os == IH_OS_LINUX) {
+               ulong relocated_addr;
+               ulong image_size;
+               int ret;
+
+               ret = booti_setup(load, &relocated_addr, &image_size, false);
+               if (ret) {
+                       printf("Failed to prep arm64 kernel (err=%d)\n", ret);
+                       return BOOTM_ERR_RESET;
+               }
+
+               /* Handle BOOTM_STATE_LOADOS */
+               if (relocated_addr != load) {
+                       printf("Moving Image from 0x%lx to 0x%lx, end=%lx\n",
+                              load, relocated_addr,
+                              relocated_addr + image_size);
+                       memmove((void *)relocated_addr, load_buf, image_size);
+               }
+
+               images->ep = relocated_addr;
+               images->os.start = relocated_addr;
+               images->os.end = relocated_addr + image_size;
+       }
+
        lmb_reserve(&images->lmb, images->os.load, (load_end -
                                                    images->os.load));
        return 0;
This page took 0.032697 seconds and 4 git commands to generate.