Merge tag 'u-boot-rockchip-20200531' of https://gitlab.denx.de/u-boot/custodians...
[oweals/u-boot.git] / tools / default_image.c
index 4b7d1ed4a1a5247d72a1f73c65466c2daac486e9..e164c0c27d1a757e32e0c877d2abbfed787f3ca4 100644 (file)
 
 #include "imagetool.h"
 #include "mkimage.h"
+#include <u-boot/crc.h>
 
 #include <image.h>
 #include <tee/optee.h>
 #include <u-boot/crc.h>
+#include <imximage.h>
 
 static image_header_t header;
 
@@ -106,7 +108,9 @@ static void image_set_header(void *ptr, struct stat *sbuf, int ifd,
 
        if (params->type == IH_TYPE_FIRMWARE_IVT)
                /* Add size of CSF minus IVT */
-               imagesize = sbuf->st_size - sizeof(image_header_t) + 0x1FE0;
+               imagesize = sbuf->st_size - sizeof(image_header_t)
+                           + 0x2060 - sizeof(flash_header_v2_t);
+
        else
                imagesize = sbuf->st_size - sizeof(image_header_t);