summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWadim Egorov <w.egorov@phytec.de>2014-05-12 14:24:20 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2014-07-09 14:11:23 +0200
commit50c081e093b02df332c207eb3c811860d886a562 (patch)
tree826c917552c34ff590c306accb438c95be0da8d9
parent00e5e81a1d0c6cbbb861502aae29262a4138e8e7 (diff)
downloadbarebox-50c081e093b02df332c207eb3c811860d886a562.tar.gz
barebox-50c081e093b02df332c207eb3c811860d886a562.tar.xz
barebox: common: added new filetypes
- Added omap CH image header recognition * filetype_ch_image * filetype_ch_image_be Signed-off-by: Wadim Egorov <w.egorov@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--common/filetype.c12
-rw-r--r--include/filetype.h2
2 files changed, 14 insertions, 0 deletions
diff --git a/common/filetype.c b/common/filetype.c
index 508a2b56bf..a04fbdd541 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -53,6 +53,9 @@ static const struct filetype_str filetype_str[] = {
[filetype_gpt] = { "GUID Partition Table", "gpt" },
[filetype_bpk] = { "Binary PacKage", "bpk" },
[filetype_barebox_env] = { "barebox environment file", "bbenv" },
+ [filetype_ch_image] = { "TI OMAP CH boot image", "ch-image" },
+ [filetype_ch_image_be] = {
+ "TI OMAP CH boot image (big endian)", "ch-image-be" },
};
const char *file_type_to_string(enum filetype f)
@@ -177,6 +180,8 @@ enum filetype file_detect_partition_table(const void *_buf, size_t bufsize)
return filetype_unknown;
}
+#define CH_TOC_section_name 0x14
+
enum filetype file_detect_type(const void *_buf, size_t bufsize)
{
const u32 *buf = _buf;
@@ -246,6 +251,13 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
if (bufsize >= 1536 && buf16[512 + 28] == le16_to_cpu(0xef53))
return filetype_ext;
+ if (strncmp(buf8 + CH_TOC_section_name, "CHSETTINGS", 10) == 0)
+ return filetype_ch_image;
+
+ if (buf[5] == 0x43485345 && buf[6] == 0x5454494E &&
+ buf[7] == 0x47530000)
+ return filetype_ch_image_be;
+
return filetype_unknown;
}
diff --git a/include/filetype.h b/include/filetype.h
index c20a4f9395..fc3140c929 100644
--- a/include/filetype.h
+++ b/include/filetype.h
@@ -30,6 +30,8 @@ enum filetype {
filetype_ubifs,
filetype_bpk,
filetype_barebox_env,
+ filetype_ch_image,
+ filetype_ch_image_be,
filetype_max,
};