summaryrefslogtreecommitdiffstats
path: root/include/image.h
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-12-06 08:40:44 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2011-12-15 10:59:35 +0100
commit390249968c4eeaceddd26a1cdeca5728f5b87b18 (patch)
treed6d3aa663c33320aa8c9ba9ed26bfa2b4b681376 /include/image.h
parent296cd8d6380f775d0f7b59bd78d3421327ebbe9e (diff)
downloadbarebox-390249968c4eeaceddd26a1cdeca5728f5b87b18.tar.gz
barebox-390249968c4eeaceddd26a1cdeca5728f5b87b18.tar.xz
reimplement uImage code
Provide a new API for accessing uImages which makes it easy for commands to open images, verify them, load to (free) sdram regions and show information about uImages. - We now do not load the image to malloced space anymore. - The data in the header is now stored in cpu native endianess after uimage_open which makes it easy to access the header data. - uImage can be loaded to dynamically allocated sdram regions. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/image.h')
-rw-r--r--include/image.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/image.h b/include/image.h
index f3a9949e54..5e9b6e26e4 100644
--- a/include/image.h
+++ b/include/image.h
@@ -349,4 +349,34 @@ struct image_handle_data* gen_image_handle_data(void* data, ulong len);
*/
int relocate_image(struct image_handle *handle, void *load_address);
+struct uimage_handle_data {
+ size_t offset; /* offset in the image */
+ ulong len;
+};
+
+struct uimage_handle *uimage_open(const char *filename);
+void uimage_close(struct uimage_handle *handle);
+int uimage_verify(struct uimage_handle *handle);
+int uimage_load(struct uimage_handle *handle, unsigned int image_no,
+ int(*flush)(void*, unsigned int));
+void uimage_print_contents(struct uimage_handle *handle);
+size_t uimage_get_size(struct uimage_handle *handle, unsigned int image_no);
+struct resource *uimage_load_to_sdram(struct uimage_handle *handle,
+ int image_no, unsigned long load_address);
+void *uimage_load_to_buf(struct uimage_handle *handle, int image_no,
+ size_t *size);
+struct resource *file_to_sdram(const char *filename, unsigned long adr);
+#define MAX_MULTI_IMAGE_COUNT 16
+
+struct uimage_handle {
+ struct image_header header;
+ char *name;
+ struct uimage_handle_data ihd[MAX_MULTI_IMAGE_COUNT];
+ int nb_data_entries;
+ size_t data_offset;
+ int fd;
+};
+
+#define UIMAGE_INVALID_ADDRESS (~0)
+
#endif /* __IMAGE_H__ */