summaryrefslogtreecommitdiffstats
path: root/common/filetype.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-07-09 08:21:04 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2018-07-09 08:21:04 +0200
commit0e8bd85d9b2f981ad24847badda70c73397d8385 (patch)
treead0e96ae3da29ab5c5797d99555d280e9b4d5d14 /common/filetype.c
parentb5ba232df1cf1fd68bd2d7dfb0f3f70f11903c99 (diff)
parenta54a47ff7710d12e5a6c88953b3da85cc162c1ea (diff)
downloadbarebox-0e8bd85d9b2f981ad24847badda70c73397d8385.tar.gz
Merge branch 'for-next/bootm'
Diffstat (limited to 'common/filetype.c')
-rw-r--r--common/filetype.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/common/filetype.c b/common/filetype.c
index bb807df..c5f2384 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -27,6 +27,7 @@
#include <envfs.h>
#include <disks.h>
#include <image-sparse.h>
+#include <elf.h>
struct filetype_str {
const char *name; /* human readable filetype */
@@ -69,6 +70,7 @@ static const struct filetype_str filetype_str[] = {
[filetype_kwbimage_v1] = { "MVEBU kwbimage (v1)", "kwb1" },
[filetype_android_sparse] = { "Android sparse image", "sparse" },
[filetype_arm64_linux_image] = { "ARM aarch64 Linux image", "aarch64-linux" },
+ [filetype_elf] = { "ELF", "elf" },
};
const char *file_type_to_string(enum filetype f)
@@ -356,6 +358,9 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
buf[7] == 0x47530000)
return filetype_ch_image_be;
+ if (strncmp(buf8, ELFMAG, 4) == 0)
+ return filetype_elf;
+
return filetype_unknown;
}