From b6996039f622ccc8488176e211bf41315f9691c6 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Fri, 25 Nov 2011 18:49:14 +0100 Subject: add file detection support Several filetypes can be autodetected. Barebox could make use of this in several ways: - Add a command to detect filetypes - detect arm zImages and uImages to unify the different boot commands - maybe detect UBI or JFFS2 images to construct parts of the kernel command line - select correct uncompression function based on filetype This patch adds basic support to detect filetypes. Signed-off-by: Sascha Hauer --- include/filetype.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 include/filetype.h (limited to 'include/filetype.h') diff --git a/include/filetype.h b/include/filetype.h new file mode 100644 index 0000000000..64d32ef8b0 --- /dev/null +++ b/include/filetype.h @@ -0,0 +1,23 @@ +#ifndef __FILE_TYPE_H +#define __FILE_TYPE_H + +/* + * List of file types we know + */ +enum filetype { + filetype_unknown, + filetype_arm_zimage, + filetype_lzo_compressed, + filetype_arm_barebox, + filetype_uimage, + filetype_ubi, + filetype_jffs2, + filetype_gzip, + filetype_bzip2, +}; + +const char *file_type_to_string(enum filetype f); +enum filetype file_detect_type(void *_buf); +enum filetype file_name_detect_type(const char *filename); + +#endif /* __FILE_TYPE_H */ -- cgit v1.2.3