diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2012-10-15 12:28:53 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-10-17 20:23:41 +0200 |
commit | bed8fb6de1a1a98d25f3a8289b35395227a652e1 (patch) | |
tree | 6a651a5e154527b8785df70020a14e93d88ee9bd /include/bbu.h | |
parent | 73e56c348954246a1f633d10335d10fe605f586f (diff) | |
download | barebox-bed8fb6de1a1a98d25f3a8289b35395227a652e1.tar.gz barebox-bed8fb6de1a1a98d25f3a8289b35395227a652e1.tar.xz |
Add in-system barebox update infrastructure
Currently in-system update means to write an arbitrary file to
an arbitrary device. There is no sanity check if the flashed image
is of the right type or will fit onto the device. Furthermore some
SoCs need a special preparation step for their images before
flashing them.
This adds a barebox in-system update infrastructure. Boards can
register update handlers which know how to make the board bootable.
The available handlers can be listed to be able to select one,
different force levels give the user the chance to know it better.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/bbu.h')
-rw-r--r-- | include/bbu.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/include/bbu.h b/include/bbu.h new file mode 100644 index 0000000000..095eebcf4a --- /dev/null +++ b/include/bbu.h @@ -0,0 +1,49 @@ +#ifndef __INCLUDE_BBU_H +#define __INCLUDE_BBU_H + +struct bbu_data { +#define BBU_FLAG_FORCE (1 << 0) +#define BBU_FLAG_YES (1 << 1) + unsigned long flags; + int force; + void *image; + const char *imagefile; + const char *devicefile; + size_t len; + const char *handler_name; +}; + +struct bbu_handler { + int (*handler)(struct bbu_handler *, struct bbu_data *); + const char *name; + struct list_head list; +#define BBU_HANDLER_FLAG_DEFAULT (1 << 0) + unsigned long flags; + + /* default device file, can be overwritten on the command line */ + const char *devicefile; +}; + +int bbu_force(struct bbu_data *, const char *fmt, ...) + __attribute__ ((format(__printf__, 2, 3))); + +int bbu_confirm(struct bbu_data *); + +int barebox_update(struct bbu_data *); + +void bbu_handlers_list(void); + +#ifdef CONFIG_BAREBOX_UPDATE + +int bbu_register_handler(struct bbu_handler *); + +#else + +static inline int bbu_register_handler(struct bbu_handler *unused) +{ + return -EINVAL; +} + +#endif + +#endif /* __INCLUDE_BBU_H */ |