summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-02-09 10:21:58 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2018-02-09 10:22:36 +0100
commitf4b5d3eeb6075bad56cddb154578a87fe1069ee0 (patch)
tree0d255608a7eadcff23c4fd26ff88d78665328efd /drivers
parent6f3ff5e61c3ff92356345604415dd682b817bf76 (diff)
downloadbarebox-f4b5d3eeb6075bad56cddb154578a87fe1069ee0.tar.gz
barebox-f4b5d3eeb6075bad56cddb154578a87fe1069ee0.tar.xz
usb: gadget: fastboot: Make sparse support optional
Sparse support is not always desired, make it optional. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/gadget/Kconfig10
-rw-r--r--drivers/usb/gadget/f_fastboot.c14
2 files changed, 20 insertions, 4 deletions
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index b612d39a8e..e2dc7807a0 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -57,7 +57,15 @@ config USB_GADGET_FASTBOOT
bool
select BANNER
select FILE_LIST
- select IMAGE_SPARSE
prompt "Android Fastboot support"
+config USB_GADGET_FASTBOOT_SPARSE
+ bool
+ select IMAGE_SPARSE
+ prompt "Enable Fastboot sparse image support"
+ help
+ Sparse images are a way for the fastboot protocol to write
+ images that are bigger than the available memory. If unsure,
+ say yes here.
+
endif
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 87a43cc60e..8da317f83a 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -322,8 +322,10 @@ static int fastboot_bind(struct usb_configuration *c, struct usb_function *f)
fb_setvar(var, "0.4");
var = fb_addvar(f_fb, "bootloader-version");
fb_setvar(var, release_string);
- var = fb_addvar(f_fb, "max-download-size");
- fb_setvar(var, "%u", fastboot_max_download_size);
+ if (IS_ENABLED(USB_GADGET_FASTBOOT_SPARSE)) {
+ var = fb_addvar(f_fb, "max-download-size");
+ fb_setvar(var, "%u", fastboot_max_download_size);
+ }
if (IS_ENABLED(CONFIG_BAREBOX_UPDATE) && opts->export_bbu)
bbu_handlers_iterate(fastboot_add_bbu_variables, f_fb);
@@ -906,6 +908,11 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req, const char *cmd
filename = fentry->filename;
if (filetype == filetype_android_sparse) {
+ if (!IS_ENABLED(USB_GADGET_FASTBOOT_SPARSE)) {
+ fastboot_tx_print(f_fb, "FAILsparse image not supported");
+ return;
+ }
+
ret = fastboot_handle_sparse(f_fb, fentry);
if (ret) {
fastboot_tx_print(f_fb, "FAILwriting sparse image: %s",
@@ -1172,7 +1179,8 @@ static void rx_handler_command(struct usb_ep *ep, struct usb_request *req)
static int fastboot_globalvars_init(void)
{
- globalvar_add_simple_int("usbgadget.fastboot_max_download_size",
+ if (IS_ENABLED(USB_GADGET_FASTBOOT_SPARSE))
+ globalvar_add_simple_int("usbgadget.fastboot_max_download_size",
&fastboot_max_download_size, "%u");
return 0;