diff options
author | Jan Weitzel <j.weitzel@phytec.de> | 2012-09-06 14:41:11 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-09-07 10:31:54 +0200 |
commit | 75831d168720aabd80da31c24677bf75c35bb1a9 (patch) | |
tree | f342f5371cc5e212acdb0e0ff0a0dba888de9071 /include/filetype.h | |
parent | 33ac4ef69e0a0425a249ff028b59f5004f24f926 (diff) | |
download | barebox-75831d168720aabd80da31c24677bf75c35bb1a9.tar.gz barebox-75831d168720aabd80da31c24677bf75c35bb1a9.tar.xz |
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 <j.weitzel@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/filetype.h')
-rw-r--r-- | include/filetype.h | 16 |
1 files changed, 16 insertions, 0 deletions
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 */ |