summaryrefslogtreecommitdiff
path: root/tools/pblimage.c
diff options
context:
space:
mode:
authorHou Zhiqiang <[email protected]>2022-02-17 11:51:36 +0800
committerPriyanka Jain <[email protected]>2022-02-28 12:01:02 +0530
commit2058967d2fe8f93142d774bc47241d80894027d5 (patch)
tree6211b7cd5d8f7d8b89a6c5cace9cb701dbdcaec6 /tools/pblimage.c
parent453db6056850e1ac1be0a12df72fcf3bd5f61bd3 (diff)
tools: pblimage: fix image header verification function
The Layerscape platforms have different RCW header value from FSL PowerPC platforms, the current image header verification callback is only working on PowerPC, it will fail on Layerscape, this patch is to fix this issue. This is a historical problem and exposed by the following patch: http://patchwork.ozlabs.org/project/uboot/patch/[email protected] Signed-off-by: Hou Zhiqiang <[email protected]> Reviewed-by: Priyanka Jain <[email protected]>
Diffstat (limited to 'tools/pblimage.c')
-rw-r--r--tools/pblimage.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/pblimage.c b/tools/pblimage.c
index 3c823e96cf1..bd639c276f9 100644
--- a/tools/pblimage.c
+++ b/tools/pblimage.c
@@ -230,19 +230,25 @@ static int pblimage_verify_header(unsigned char *ptr, int image_size,
struct image_tool_params *params)
{
struct pbl_header *pbl_hdr = (struct pbl_header *) ptr;
+ uint32_t rcwheader;
+
+ if (params->arch == IH_ARCH_ARM)
+ rcwheader = RCW_ARM_HEADER;
+ else
+ rcwheader = RCW_PPC_HEADER;
/* Only a few checks can be done: search for magic numbers */
if (ENDIANNESS == 'l') {
if (pbl_hdr->preamble != reverse_byte(RCW_PREAMBLE))
return -FDT_ERR_BADSTRUCTURE;
- if (pbl_hdr->rcwheader != reverse_byte(RCW_HEADER))
+ if (pbl_hdr->rcwheader != reverse_byte(rcwheader))
return -FDT_ERR_BADSTRUCTURE;
} else {
if (pbl_hdr->preamble != RCW_PREAMBLE)
return -FDT_ERR_BADSTRUCTURE;
- if (pbl_hdr->rcwheader != RCW_HEADER)
+ if (pbl_hdr->rcwheader != rcwheader)
return -FDT_ERR_BADSTRUCTURE;
}
return 0;