summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-03-10 16:24:10 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2016-04-08 13:35:32 +0200
commitfa61152d972a47edcad1a3da0a6500db194c1a77 (patch)
treea7487609ecc6b4fd12d1fb6a7286322c553b3be3 /common
parent1e6955fdb815906bdd2ecbf2c50e5059852f2400 (diff)
downloadbarebox-fa61152d972a47edcad1a3da0a6500db194c1a77.tar.gz
barebox-fa61152d972a47edcad1a3da0a6500db194c1a77.tar.xz
bbu: Allow to refresh/repair images
Some SoCs allow to store multiple boot images on a device in order to improve robustness. This adds a -r option to barebox_update to indicate we do not want to make an update but instead repair/refresh an existing image. Handlers which want to support this feature must set the BBU_HANDLER_CAN_REFRESH flag during registration. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/bbu.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/common/bbu.c b/common/bbu.c
index 68812a733d..09c96bbdb9 100644
--- a/common/bbu.c
+++ b/common/bbu.c
@@ -65,9 +65,13 @@ int bbu_confirm(struct bbu_data *data)
if (data->flags & BBU_FLAG_YES)
return 0;
- printf("update barebox from %s using handler %s to %s (y/n)?\n",
+ if (data->imagefile)
+ printf("update barebox from %s using handler %s to %s (y/n)?\n",
data->imagefile, data->handler_name,
data->devicefile);
+ else
+ printf("Refresh barebox on %s using handler %s (y/n)?\n",
+ data->devicefile, data->handler_name);
key = read_key();
@@ -141,6 +145,12 @@ int barebox_update(struct bbu_data *data)
if (!handler)
return -ENODEV;
+ if (!data->image && !data->imagefile &&
+ !(handler->flags & BBU_HANDLER_CAN_REFRESH)) {
+ pr_err("No Image file given\n");
+ return -EINVAL;
+ }
+
if (!data->handler_name)
data->handler_name = handler->name;