]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
tools: kwboot: Reserve enough space for patching kwbimage in memory
authorPali Rohár <pali@kernel.org>
Mon, 25 Oct 2021 13:12:54 +0000 (15:12 +0200)
committerStefan Roese <sr@denx.de>
Wed, 3 Nov 2021 05:45:27 +0000 (06:45 +0100)
SPI image header and data parts do not have to be aligned to 128 byte
xmodem block size. So reserve additional memory for aligning header part
and additional memory for aligning data part.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
tools/kwboot.c

index c55b41025b0ffef83ac3bcc6cd4bca369757e4ea..4e29317f107b1a2e432fea1acafcd0ae83c3f7ae 100644 (file)
@@ -1672,8 +1672,10 @@ main(int argc, char **argv)
        else
                /* ensure we have enough space for baudrate change code */
                after_img_rsv += KWBOOT_BAUDRATE_BIN_HEADER_SZ +
+                                KWBOOT_XM_BLKSZ +
                                 sizeof(kwboot_pre_baud_code) +
-                                sizeof(kwboot_baud_code);
+                                sizeof(kwboot_baud_code) +
+                                KWBOOT_XM_BLKSZ;
 
        if (imgpath) {
                img = kwboot_read_image(imgpath, &size, after_img_rsv);