mkimage: fix validation of legacy images with custom magic
[openwrt/staging/wigyori.git] / tools / mkimage / patches / 030-allow-to-use-different-magic.patch
index 017f0b9b34452f8369d67dc02f2239f21cad63bd..b97cd819cc4cca739a7b748defd13d2e2318d87e 100644 (file)
@@ -50,6 +50,15 @@ This patch makes it possible to set a custom image magic.
                        break;
 --- a/tools/default_image.c
 +++ b/tools/default_image.c
+@@ -56,7 +56,7 @@ static int image_verify_header(unsigned
+        */
+       memcpy(hdr, ptr, sizeof(image_header_t));
+-      if (be32_to_cpu(hdr->ih_magic) != IH_MAGIC) {
++      if (be32_to_cpu(hdr->ih_magic) != params->magic) {
+               debug("%s: Bad Magic Number: \"%s\" is no valid image\n",
+                     params->cmdname, params->imagefile);
+               return -FDT_ERR_BADMAGIC;
 @@ -120,7 +120,7 @@ static void image_set_header(void *ptr,
        }