summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2019-05-03 13:10:53 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-05-09 11:47:33 +0200
commit0aafb86e38c5e436fee409f2b94b145e22c4a8be (patch)
tree3a1be3daf3823cb8e7a49b818dc3c894988a4bb9 /common
parenta543300e5122ac079b3f44228d0e9a66fbaea447 (diff)
downloadbarebox-0aafb86e38c5e436fee409f2b94b145e22c4a8be.tar.gz
filetype: Detect Layerscape PBL images
The Layerscape SoCs have their own boot image format. Add filetype detection for it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/filetype.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/common/filetype.c b/common/filetype.c
index fb029a7..e2d707b 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -75,6 +75,8 @@ 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_layerscape_image] = { "Layerscape image", "layerscape-PBL" },
+ [filetype_layerscape_qspi_image] = { "Layerscape QSPI image", "layerscape-qspi-PBL" },
};
const char *file_type_to_string(enum filetype f)
@@ -329,6 +331,11 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
if (is_sparse_image(_buf))
return filetype_android_sparse;
+ if (buf[0] == 0x55aa55aa && buf[1] == 0x0001ee01)
+ return filetype_layerscape_image;
+ if (buf[0] == 0x01ee0100 && buf[1] == 0xaa55aa55)
+ return filetype_layerscape_qspi_image;
+
if (bufsize < 64)
return filetype_unknown;