summaryrefslogtreecommitdiffstats
path: root/common/filetype.c
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2018-08-23 19:52:23 -0700
committerSascha Hauer <s.hauer@pengutronix.de>2018-08-31 08:30:07 +0200
commitbef321a095b6552576ca813fd36b4e5f8de2c4ff (patch)
tree58f953cc5b4ab7e612c4b8877e5b4753d835136f /common/filetype.c
parent489157938a25285ee96f6fff19a957259d0f51a8 (diff)
downloadbarebox-bef321a095b6552576ca813fd36b4e5f8de2c4ff.tar.gz
filetype: Add code to detect i.MX image v2
Modify file_detect_type() and add code needed to be able to detect i.MX boot images with v2 header. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> 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 8f2be27..f8b6bc8 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -74,6 +74,7 @@ static const struct filetype_str filetype_str[] = {
[filetype_arm64_linux_image] = { "ARM aarch64 Linux image", "aarch64-linux" },
[filetype_elf] = { "ELF", "elf" },
[filetype_imx_image_v1] = { "i.MX image (v1)", "imx-image-v1" },
+ [filetype_imx_image_v2] = { "i.MX image (v2)", "imx-image-v2" },
};
const char *file_type_to_string(enum filetype f)
@@ -368,6 +369,9 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
if (imx_flash_header->dcd_barker == DCD_BARKER)
return filetype_imx_image_v1;
+ if (is_imx_flash_header_v2(_buf))
+ return filetype_imx_image_v2;
+
return filetype_unknown;
}