During kernel build process the header size is computed including the
BSS whereas it's removed when creating the uncompressed image. Therefore
the size of the uncompressed image on filesystem will be smaller than
the size specifiedin the header.

Therefore it makes sense to return the header size back instead of the
file size in falcon boot.

More info:
https://lore.kernel.org/u-boot/20250214111656.2358748-1-ansh...@ti.com/

Signed-off-by: Anshul Dalal <ansh...@ti.com>
---
 common/spl/spl_ext.c | 4 ++++
 common/spl/spl_fat.c | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/common/spl/spl_ext.c b/common/spl/spl_ext.c
index c5478820a9b..6d8d6544092 100644
--- a/common/spl/spl_ext.c
+++ b/common/spl/spl_ext.c
@@ -17,6 +17,10 @@ static ulong spl_fit_read(struct spl_load_info *load, ulong 
file_offset,
        ret = ext4fs_read(buf, file_offset, size, &actlen);
        if (ret)
                return ret;
+
+       if (IS_ENABLED(CONFIG_SPL_OS_BOOT) && IS_ENABLED(CONFIG_CMD_BOOTI))
+               return size;
+
        return actlen;
 }
 
diff --git a/common/spl/spl_fat.c b/common/spl/spl_fat.c
index fce451b7664..ddf85e2cece 100644
--- a/common/spl/spl_fat.c
+++ b/common/spl/spl_fat.c
@@ -55,6 +55,9 @@ static ulong spl_fit_read(struct spl_load_info *load, ulong 
file_offset,
        if (ret)
                return ret;
 
+       if (IS_ENABLED(CONFIG_SPL_OS_BOOT) && IS_ENABLED(CONFIG_CMD_BOOTI))
+               return size;
+
        return actread;
 }
 
-- 
2.43.0

Reply via email to