From 75831d168720aabd80da31c24677bf75c35bb1a9 Mon Sep 17 00:00:00 2001 From: Jan Weitzel Date: Thu, 6 Sep 2012 14:41:11 +0200 Subject: xload: get barebox size from barebox_arm_head Add functions to read the barebox_arm_head, check barebox magicword and read out the barebox image size. Create a inital partion of 1Mb to access the barebox image on nand. Signed-off-by: Jan Weitzel Signed-off-by: Sascha Hauer --- include/filetype.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include/filetype.h') diff --git a/include/filetype.h b/include/filetype.h index 179ec0f5eb..ed3664dfa5 100644 --- a/include/filetype.h +++ b/include/filetype.h @@ -25,4 +25,20 @@ 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); +#define ARM_HEAD_SIZE 0x30 +#define ARM_HEAD_MAGICWORD_OFFSET 0x20 +#define ARM_HEAD_SIZE_OFFSET 0x2C + +#ifdef CONFIG_ARM +static inline int is_barebox_arm_head(const char *head) +{ + return !strcmp(head + ARM_HEAD_MAGICWORD_OFFSET, "barebox"); +} +#else +static inline int is_barebox_arm_head(const char *head) +{ + return 0; +} +#endif + #endif /* __FILE_TYPE_H */ -- cgit v1.2.3