]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
spl: ext: load kernel image before args in falcon
authorAnshul Dalal <anshuld@ti.com>
Tue, 23 Sep 2025 12:46:36 +0000 (18:16 +0530)
committerTom Rini <trini@konsulko.com>
Tue, 7 Oct 2025 19:02:17 +0000 (13:02 -0600)
Load the kernel image before args in falcon mode to be consistent with
the load order for other boot media.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Anshul Dalal <anshuld@ti.com>
common/spl/spl_ext.c

index 7e0274a3058ce0f1118abceddf95c817b60d54f1..80bd084db4e728ebabbdbfd71904865a7a01f6d4 100644 (file)
@@ -96,40 +96,53 @@ int spl_load_image_ext_os(struct spl_image_info *spl_image,
 #endif
                return -1;
        }
-#if defined(CONFIG_SPL_ENV_SUPPORT)
-       file = env_get("falcon_args_file");
+
+       if (!CONFIG_IS_ENABLED(ENV_SUPPORT))
+               goto defaults;
+
+       file = env_get("falcon_image_file");
        if (file) {
-               err = ext4fs_open(file, &filelen);
-               if (err < 0) {
-                       puts("spl: ext4fs_open failed\n");
-                       goto defaults;
-               }
-               err = ext4fs_read((void *)CONFIG_SPL_PAYLOAD_ARGS_ADDR, 0, filelen, &actlen);
-               if (err < 0) {
-                       printf("spl: error reading image %s, err - %d, falling back to default\n",
-                              file, err);
+               err = spl_load_image_ext(spl_image, bootdev, block_dev,
+                                        partition, file);
+               if (err != 0) {
+                       puts("spl: falling back to default\n");
                        goto defaults;
                }
-               file = env_get("falcon_image_file");
+
+               ext4fs_set_blk_dev(block_dev, &part_info);
+               ext4fs_mount();
+               file = env_get("falcon_args_file");
                if (file) {
-                       err = spl_load_image_ext(spl_image, bootdev, block_dev,
-                                                partition, file);
-                       if (err != 0) {
-                               puts("spl: falling back to default\n");
+                       err = ext4fs_open(file, &filelen);
+                       if (err < 0) {
+                               puts("spl: ext4fs_open failed\n");
+                               goto defaults;
+                       }
+                       err = ext4fs_read((void *)CONFIG_SPL_PAYLOAD_ARGS_ADDR,
+                                         0, filelen, &actlen);
+                       if (err < 0) {
+                               printf("spl: error reading args %s, err - %d, falling back to default\n",
+                                      file, err);
                                goto defaults;
                        }
-
                        return 0;
                } else {
-                       puts("spl: falcon_image_file not set in environment, falling back to default\n");
+                       puts("spl: falcon_args_file not set in environment, falling back to default\n");
                }
        } else {
-               puts("spl: falcon_args_file not set in environment, falling back to default\n");
+               puts("spl: falcon_image_file not set in environment, falling back to default\n");
        }
 
 defaults:
-#endif
 
+       err = spl_load_image_ext(spl_image, bootdev, block_dev, partition,
+                                CONFIG_SPL_FS_LOAD_KERNEL_NAME);
+
+       if (err)
+               return err;
+
+       ext4fs_set_blk_dev(block_dev, &part_info);
+       ext4fs_mount();
        err = ext4fs_open(CONFIG_SPL_FS_LOAD_ARGS_NAME, &filelen);
        if (err < 0)
                puts("spl: ext4fs_open failed\n");
@@ -143,8 +156,7 @@ defaults:
                return -1;
        }
 
-       return spl_load_image_ext(spl_image, bootdev, block_dev, partition,
-                       CONFIG_SPL_FS_LOAD_KERNEL_NAME);
+       return 0;
 }
 #else
 int spl_load_image_ext_os(struct spl_image_info *spl_image,