summaryrefslogtreecommitdiffstats
path: root/common/filetype.c
diff options
context:
space:
mode:
authorLucas Stach <dev@lynxeye.de>2019-12-10 23:03:21 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2019-12-11 09:51:23 +0100
commit583055c883ede073200dd2b8f5078793d5fe0313 (patch)
tree0c17a82f9d3ef5427908fdc4c8de097a6468ebf0 /common/filetype.c
parent9398e9ef1e4d0aebf60b618508c746b0cb6cafb9 (diff)
downloadbarebox-583055c883ede073200dd2b8f5078793d5fe0313.tar.gz
barebox-583055c883ede073200dd2b8f5078793d5fe0313.tar.xz
filetype: add Zynq image type
Use the 2 invariant words (width detection and image identification) from the Zynq image header to detect the filetype. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/filetype.c')
-rw-r--r--common/filetype.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/common/filetype.c b/common/filetype.c
index 39fea45edf..fd6e8e3d1c 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -80,6 +80,7 @@ static const struct filetype_str filetype_str[] = {
[filetype_ubootvar] = { "U-Boot environmemnt variable data",
"ubootvar" },
[filetype_stm32_image_v1] = { "STM32 image (v1)", "stm32-image-v1" },
+ [filetype_zynq_image] = { "Zynq image", "zynq-image" },
};
const char *file_type_to_string(enum filetype f)
@@ -392,6 +393,9 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
if (is_imx_flash_header_v2(_buf))
return filetype_imx_image_v2;
+ if (buf[8] == 0xAA995566 && buf[9] == 0x584C4E58)
+ return filetype_zynq_image;
+
return filetype_unknown;
}