[PATCH 1/1] bootm: update image OS image size when decompressing

Heinrich Schuchardt xypron.glpk at gmx.de
Sun Aug 30 11:34:12 CEST 2020

In bootm_load_os() the OS image is decompressed. In later stages of the
boot process we need the decompressed size of the image.

Update images->os.image_len after decompression.

Passing the correct size is necessary if we want to check loaded EFI
binararies for file truncation by comparing the loaded size to the header
field SizeOfImage.

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
 common/bootm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/common/bootm.c b/common/bootm.c
index 247b600d9c..b3377490b3 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -390,6 +390,8 @@ static int bootm_load_os(bootm_headers_t *images, int boot_progress)
 		return err;
+	/* We need the decompressed image size in the next steps */
+	images->os.image_len = load_end - load;

 	flush_cache(flush_start, ALIGN(load_end, ARCH_DMA_MINALIGN) - flush_start);


More information about the U-Boot mailing list