[PATCH 1/2] filetype: detect i.MX flash header v3

Sascha Hauer s.hauer at pengutronix.de
Wed Oct 30 08:00:00 PDT 2024


Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 common/filetype.c  | 4 ++++
 include/filetype.h | 1 +
 2 files changed, 5 insertions(+)

diff --git a/common/filetype.c b/common/filetype.c
index 67ae4916d1..73ea17e19b 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -70,6 +70,7 @@ static const struct filetype_str filetype_str[] = {
 	[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" },
+	[filetype_imx_image_v3] = { "i.MX image (v3)", "imx-image-v3" },
 	[filetype_layerscape_image] = { "Layerscape image", "layerscape-PBL" },
 	[filetype_layerscape_qspi_image] = { "Layerscape QSPI image", "layerscape-qspi-PBL" },
 	[filetype_nxp_fspi_image] = { "NXP FlexSPI image", "nxp-fspi-image" },
@@ -432,6 +433,9 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
 	if (buf[8] == 0xAA995566 && buf[9] == 0x584C4E58)
 		return filetype_zynq_image;
 
+	if (buf8[0] == 0x0 && buf8[3] == 0x87)
+		return filetype_imx_image_v3;
+
 	return filetype_unknown;
 }
 
diff --git a/include/filetype.h b/include/filetype.h
index 6425c9c8c5..c24d061e8f 100644
--- a/include/filetype.h
+++ b/include/filetype.h
@@ -51,6 +51,7 @@ enum filetype {
 	filetype_elf,
 	filetype_imx_image_v1,
 	filetype_imx_image_v2,
+	filetype_imx_image_v3,
 	filetype_layerscape_image,
 	filetype_layerscape_qspi_image,
 	filetype_ubootvar,

-- 
2.39.5




More information about the barebox mailing list