spl: return header size to spl_load in os boot
PATCH v2 1/1 spl: return header size to spl_load in os boot
During linux 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 specified in the header.
This causes issues when loading the kernel image from the SPL (as in falcon boot) with spl_load since it compares the read file size from the FS to the header size form the image. Which leads to the following check in include/spl_load.h failing to -EIO when loading kernel image:
return read < spl_image->size ? -EIO : 0;
Therefore we should return the header size back to spl_load instead of the file size in falcon boot when loading kernel image.
Bug report:
https://lore.kernel.org/u-boot/[email protected]/
--- common/spl/spl_ext.c | 4 ++++ common/spl/spl_fat.c | 3 +++ 2 files changed, 7 insertions(+)
common/spl/spl_ext.c +4 -0
@@ -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; }
common/spl/spl_fat.c +3 -0
@@ -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; }
Signature · 1 line
2.43.0