[PATCH RFT v1 05/17] spl: ext: load kernel image before args in falcon

Anshul Dalal anshuld at ti.com
Thu Sep 11 15:14:01 CEST 2025


Load the kernel image before args in falcon mode to be consistent with
the load order for other boot media.

Signed-off-by: Anshul Dalal <anshuld at ti.com>
---
 common/spl/spl_ext.c | 51 +++++++++++++++++++++++++-------------------
 1 file changed, 29 insertions(+), 22 deletions(-)

diff --git a/common/spl/spl_ext.c b/common/spl/spl_ext.c
index 7e0274a3058..279e254139f 100644
--- a/common/spl/spl_ext.c
+++ b/common/spl/spl_ext.c
@@ -96,39 +96,47 @@ 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");
+		err = spl_load_image_ext(spl_image, bootdev, block_dev,
+					 partition, file);
+		if (err != 0) {
+			puts("spl: falling back to default\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);
-			goto defaults;
-		}
-		file = env_get("falcon_image_file");
+		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;
 
 	err = ext4fs_open(CONFIG_SPL_FS_LOAD_ARGS_NAME, &filelen);
 	if (err < 0)
@@ -143,8 +151,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,
-- 
2.51.0



More information about the U-Boot mailing list