From: Rasmus Villemoes Date: Thu, 24 Oct 2024 12:27:35 +0000 (+0200) Subject: imx: hab: fix size of IVT+CSF blob tacked on to u-boot.itb X-Git-Url: http://git.dujemihanovic.xyz/%22http:/www.sics.se/static/git-logo.png?a=commitdiff_plain;h=bfbbd8472edbcff1f530ef8e1d74c56af74ecf13;p=u-boot.git imx: hab: fix size of IVT+CSF blob tacked on to u-boot.itb Loading flash.bin using uuu fails when flash.bin does not have the right size. When flash.bin is loaded from some storage medium (sd card/emmc), SPL just loads some random garbage bytes from beyond what has been populated when flash.bin was written, but when loaded via uuu, SPL hangs waiting for the host to send the expected number of bytes. Which is (size of FIT image aligned to 0x1000)+CONFIG_CSF_SIZE. The alignment to 0x1000 is already done and is necessary in all cases because that's the exact expected location of the 32 byte IVT header. But the IVT+CSF blob tacked onto the end must be a total of CONFIG_CSF_SIZE. This is exactly the same fix as 89f19f45d650, except that this time around I don't know how to cleanly get CONFIG_CSF_SIZE. Fixes: bc6beae7c55f (binman: Add nxp_imx8mcst etype for i.MX8M flash.bin signing) Signed-off-by: Rasmus Villemoes Tested-by: Heiko Schocher --- diff --git a/tools/binman/etype/nxp_imx8mcst.py b/tools/binman/etype/nxp_imx8mcst.py index a7d8db4eec..dd9f226b75 100644 --- a/tools/binman/etype/nxp_imx8mcst.py +++ b/tools/binman/etype/nxp_imx8mcst.py @@ -165,6 +165,8 @@ class Entry_nxp_imx8mcst(Entry_mkimage): args = ['-i', cfg_fname, '-o', output_fname] if self.cst.run_cmd(*args) is not None: outdata = tools.read_file(output_fname) + # fixme: 0x2000 should be CONFIG_CSF_SIZE + outdata += tools.get_bytes(0, 0x2000 - 0x20 - len(outdata)) return data + outdata else: # Bintool is missing; just use the input data as the output