From eee339bf0d50d27875cb6987885cc08ff44f436e Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Sun, 20 Feb 2022 13:47:17 +0100 Subject: filetype: detect TF-A Firmware Image Packages (FIP) FIP is the new format for firmware loaded by ARM Trusted Firmware. It can contain non-secure firmware, hardware config (device tree), firmware config (configuration DT) and optionally OP-TEE. In future, we may want to mount FIP to chain boot barebox out of it, but for now, just let barebox filetype detect it correctly. Signed-off-by: Ahmad Fatoum Link: https://lore.barebox.org/20220220124736.3052502-6-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer --- common/filetype.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'common') diff --git a/common/filetype.c b/common/filetype.c index 53517da70d..0ded64b83c 100644 --- a/common/filetype.c +++ b/common/filetype.c @@ -75,6 +75,7 @@ static const struct filetype_str filetype_str[] = { [filetype_zynq_image] = { "Zynq image", "zynq-image" }, [filetype_mxs_sd_image] = { "i.MX23/28 SD card image", "mxs-sd-image" }, [filetype_rockchip_rkns_image] = { "Rockchip boot image", "rk-image" }, + [filetype_fip] = { "TF-A Firmware Image Package", "fip" }, }; const char *file_type_to_string(enum filetype f) @@ -315,6 +316,9 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize) return filetype_riscv_barebox_image; if (strncmp(buf8, "RKNS", 4) == 0) return filetype_rockchip_rkns_image; + if (le32_to_cpu(buf[0]) == le32_to_cpu(0xaa640001)) + return filetype_fip; + if ((buf8[0] == 0x5a || buf8[0] == 0x69 || buf8[0] == 0x78 || buf8[0] == 0x8b || buf8[0] == 0x9c) && buf8[0x1] == 0 && buf8[0x2] == 0 && buf8[0x3] == 0 && -- cgit v1.2.3