summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorAntony Pavlov <antonynpavlov@gmail.com>2018-06-06 09:59:10 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2018-06-15 08:33:20 +0200
commit32bb4ca56b1b01006fcb7058049038fbb8dc10cf (patch)
tree2eee83e7472b7bdbdd7468b59c1d25dc994006e2 /common
parent9199e9cb082fff290cdac2d323458f17db2a9ad0 (diff)
downloadbarebox-32bb4ca56b1b01006fcb7058049038fbb8dc10cf.tar.gz
barebox-32bb4ca56b1b01006fcb7058049038fbb8dc10cf.tar.xz
filetype: add ELF type
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/filetype.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/common/filetype.c b/common/filetype.c
index 444ec14cc4..77cf9a1056 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 */
@@ -68,6 +69,7 @@ static const struct filetype_str filetype_str[] = {
[filetype_kwbimage_v1] = { "MVEBU kwbimage (v1)", "kwb" },
[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)
@@ -344,6 +346,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;
}