]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
tools: mkimage: Do not fill legacy_img_hdr for non-legacy XIP images
authorPali Rohár <pali@kernel.org>
Sat, 21 Jan 2023 19:05:43 +0000 (20:05 +0100)
committerStefan Roese <sr@denx.de>
Wed, 1 Mar 2023 05:39:17 +0000 (06:39 +0100)
Skip filling legacy_img_hdr structure for XIP images which do not use
legacy_img_hdr structure header. Adding unwanted header to other image
formats, like kwbimage cause generation of broken image.

Signed-off-by: Pali Rohár <pali@kernel.org>
tools/mkimage.c

index af7b0e09b3bf3533e186605a6637a9d540e5514f..0b342159e5fa6a0d83727a7acdb1cc02abc4237a 100644 (file)
@@ -860,7 +860,9 @@ copy_file (int ifd, const char *datafile, int pad)
                exit (EXIT_FAILURE);
        }
 
-       if (params.xflag) {
+       if (params.xflag &&
+           (((params.type > IH_TYPE_INVALID) && (params.type < IH_TYPE_FLATDT)) ||
+            (params.type == IH_TYPE_KERNEL_NOLOAD) || (params.type == IH_TYPE_FIRMWARE_IVT))) {
                unsigned char *p = NULL;
                /*
                 * XIP: do not append the struct legacy_img_hdr at the