[PATCH 21/27] filetype: detect PXA3xx NTIM images

Sascha Hauer s.hauer at pengutronix.de
Sun Aug 16 10:56:41 PDT 2026


The image scripts/pxa-image builds - the NTIM header the PXA3xx Boot ROM
reads from the start of the boot device, the OBM and barebox - has no
filetype, so the one thing that cares has to recognise it by hand.

The header carries no magic. Match the version field, which is the one
the Boot ROM in these parts expects and the only one the tool emits,
together with the 'TIMH' identifier that follows it.

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

diff --git a/common/filetype.c b/common/filetype.c
index 01cef7f1fb..5f65b8a4f6 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -91,6 +91,7 @@ static const struct filetype_str filetype_str[] = {
 					   "rk-image" },
 	[filetype_x86_linux_image] = { "x86 Linux image", "x86-linux" },
 	[filetype_x86_efi_linux_image] = { "x86 Linux/EFI image", "x86-efi-linux" },
+	[filetype_pxa_ntim] = { "Marvell PXA3xx NTIM image", "pxa-ntim" },
 };
 
 static const char *file_type_to_nr_string(enum filetype f)
@@ -386,6 +387,16 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
 	if (buf[0] == be32_to_cpu(0x534F4659))
 		return filetype_bpk;
 
+	/*
+	 * The NTIM header the PXA3xx Boot ROM reads from the start of the boot
+	 * device. It has no magic of its own, so match the version the images
+	 * barebox builds carry along with the identifier of the header itself,
+	 * which is the first of the image entries behind it.
+	 */
+	if (le32_to_cpu(buf[0]) == 0x00030102 &&
+	    le32_to_cpu(buf[1]) == 0x54494d48)	/* 'TIMH' */
+		return filetype_pxa_ntim;
+
 	if (strncmp(buf8, "RKNS", 4) == 0)
 		return filetype_rockchip_rkns_image;
 	if (strncmp(buf8, "RKSS", 4) == 0)
diff --git a/include/filetype.h b/include/filetype.h
index 2fd0e22177..5b0bd9d399 100644
--- a/include/filetype.h
+++ b/include/filetype.h
@@ -72,6 +72,7 @@ enum filetype {
 	filetype_rockchip_rkss_image,
 	filetype_x86_linux_image,
 	filetype_x86_efi_linux_image,
+	filetype_pxa_ntim,
 	filetype_max,
 };
 

-- 
2.47.3




More information about the barebox mailing list