summaryrefslogtreecommitdiffstats
path: root/common/filetype.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-03-14 12:04:45 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2018-04-04 07:44:26 +0200
commit41dd040d2cc4d248a63f316f90118560437a4abc (patch)
tree8157977ed4bd1239c43f18d4a1f3f5456496351c /common/filetype.c
parent8bdd7a116b3dc3b04fa0ebb6799baf455182be8a (diff)
downloadbarebox-41dd040d2cc4d248a63f316f90118560437a4abc.tar.gz
filetype: Detect ARM aarch64 Linux images
ARM aarch64 Linux image have a special type. Allow to detect them. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/filetype.c')
-rw-r--r--common/filetype.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/common/filetype.c b/common/filetype.c
index 71691fd..444ec14 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -67,6 +67,7 @@ static const struct filetype_str filetype_str[] = {
[filetype_socfpga_xload] = { "SoCFPGA prebootloader image", "socfpga-xload" },
[filetype_kwbimage_v1] = { "MVEBU kwbimage (v1)", "kwb" },
[filetype_android_sparse] = { "Android sparse image", "sparse" },
+ [filetype_arm64_linux_image] = { "ARM aarch64 Linux image", "aarch64-linux" },
};
const char *file_type_to_string(enum filetype f)
@@ -296,6 +297,8 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
return filetype_mips_barebox;
if (buf[0] == be32_to_cpu(0x534F4659))
return filetype_bpk;
+ if (le32_to_cpu(buf[14]) == 0x644d5241)
+ return filetype_arm64_linux_image;
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 &&