From 12158a28d43880a20d8289519953fe020781be95 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Wed, 25 Sep 2013 07:31:20 +0200 Subject: fs: add uimagefs this will provide the image data and information via file # ls -l /tmp/ -rwxrwxrwx 3 arch -rwxrwxrwx 12 compression -rwxrwxrwx 16 name -rwxrwxrwx 5 os -rwxrwxrwx 24 time -rwxrwxrwx 12 type -rwxrwxrwx 10 load_addr -rwxrwxrwx 10 entry_point -rwxrwxrwx 2199875 data0 -rwxrwxrwx 2199875 data -rwxrwxrwx 10 data.crc if it's multi image # ls -l /tmp-multi/ -rwxrwxrwx 3 arch -rwxrwxrwx 12 compression -rwxrwxrwx 16 name -rwxrwxrwx 5 os -rwxrwxrwx 24 time -rwxrwxrwx 16 type -rwxrwxrwx 10 load_addr -rwxrwxrwx 10 entry_point -rwxrwxrwx 1292 data0 -rwxrwxrwx 983 data1 -rwxrwxrwx 2287 data -rwxrwxrwx 10 data.crc you can get the image header via an ioctl on any file UIMAGEFS_METADATA if you want to check the crc do # crc32 -f /tmp-multi/data -V /tmp-multi/data.crc CRC32 for /tmp-multi/data 0x00000000 ... 0x000008ee ==> 0x88d5a0db Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Signed-off-by: Sascha Hauer --- include/uimagefs.h | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 include/uimagefs.h (limited to 'include/uimagefs.h') diff --git a/include/uimagefs.h b/include/uimagefs.h new file mode 100644 index 0000000000..81b32310ad --- /dev/null +++ b/include/uimagefs.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2013 Jean-Christophe PLAGNIOL-VILLARD + * + * under GPLv2 only + */ + +#ifndef __UIMAGEFS_H__ +#define __UIMAGEFS_H__ + +#include +#include +#include +#include + +#define UIMAGEFS_METADATA _IOR('U', 100, struct image_header) + +enum uimagefs_type { + UIMAGEFS_DATA, + UIMAGEFS_DATA_CRC, + UIMAGEFS_NAME, + UIMAGEFS_TIME, + UIMAGEFS_LOAD, + UIMAGEFS_EP, + UIMAGEFS_OS, + UIMAGEFS_ARCH, + UIMAGEFS_TYPE, + UIMAGEFS_COMP, +}; + +struct uimagefs_handle_data { + char *name; + enum uimagefs_type type; + uint64_t size; + + int fd; + size_t offset; /* offset in the image */ + size_t pos; /* pos in the data */ + + char *data; + + struct list_head list; +}; + +struct uimagefs_handle { + struct image_header header; + int nb_data_entries; + char *filename; + char *tmp; + + struct list_head list; +}; + +#endif /* __UIMAGEFS_H__ */ -- cgit v1.2.3