summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/f_fastboot.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index bc06c58d8d..0df08c9a2b 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -23,6 +23,7 @@
#include <clock.h>
#include <ioctl.h>
#include <libbb.h>
+#include <bbu.h>
#include <boot.h>
#include <dma.h>
#include <fs.h>
@@ -716,6 +717,36 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req, const char *cmd
goto out;
}
+ if (IS_ENABLED(CONFIG_BAREBOX_UPDATE) && filetype_is_barebox_image(filetype)) {
+ struct bbu_data data = {
+ .devicefile = filename,
+ .imagefile = FASTBOOT_TMPFILE,
+ .flags = BBU_FLAG_YES,
+ };
+
+ if (!barebox_update_handler_exists(&data))
+ goto copy;
+
+ fastboot_tx_print(f_fb, "INFOThis is a barebox image...");
+
+ data.image = read_file(data.imagefile, &data.len);
+ if (!data.image) {
+ fastboot_tx_print(f_fb, "FAILreading barebox");
+ return;
+ }
+
+ ret = barebox_update(&data);
+
+ free(data.image);
+
+ if (ret) {
+ fastboot_tx_print(f_fb, "FAILupdate barebox: %s", strerror(-ret));
+ return;
+ }
+
+ goto out;
+ }
+
copy:
ret = copy_file(FASTBOOT_TMPFILE, filename, 1);
if (ret) {