diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2022-02-20 13:47:17 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-02-23 11:14:45 +0100 |
commit | eee339bf0d50d27875cb6987885cc08ff44f436e (patch) | |
tree | 29ba0c2b441e1b0f41731032c7abdb29d4d4cb04 /common | |
parent | 3536e3904152210d70ae5ef6cf24c6d572cbf04f (diff) | |
download | barebox-eee339bf0d50d27875cb6987885cc08ff44f436e.tar.gz barebox-eee339bf0d50d27875cb6987885cc08ff44f436e.tar.xz |
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 <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20220220124736.3052502-6-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r-- | common/filetype.c | 4 |
1 files changed, 4 insertions, 0 deletions
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 && |