From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 2/9] usb: gadget: fastboot: Make sparse support optional
Date: Fri, 9 Feb 2018 10:43:09 +0100 [thread overview]
Message-ID: <20180209094316.8523-3-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20180209094316.8523-1-s.hauer@pengutronix.de>
Sparse support is not always desired, make it optional.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/usb/gadget/Kconfig | 10 +++++++++-
drivers/usb/gadget/f_fastboot.c | 14 +++++++++++---
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;
--
2.15.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2018-02-09 9:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-09 9:43 [PATCH 0/9] Fastboot customization support Sascha Hauer
2018-02-09 9:43 ` [PATCH 1/9] ubiformat: Allow to ubiformat with a buffer given Sascha Hauer
2018-02-09 9:43 ` Sascha Hauer [this message]
2018-02-09 9:43 ` [PATCH 3/9] usb: gadget: fastboot: pass struct f_fastboot * around Sascha Hauer
2018-02-09 9:43 ` [PATCH 4/9] usb: gadget: fastboot: use read_file_2 Sascha Hauer
2018-02-09 9:43 ` [PATCH 5/9] usb: gadget: fastboot: Always remove temporary file Sascha Hauer
2018-02-09 9:43 ` [PATCH 6/9] usb: gadget: fastboot: fix typo Sascha Hauer
2018-02-09 9:43 ` [PATCH 7/9] usb: gadget: fastboot: beautify fb_run_command() Sascha Hauer
2018-02-09 9:43 ` [PATCH 8/9] usb: gadget: fastboot: Add option to download to a buffer Sascha Hauer
2018-02-09 9:43 ` [PATCH 9/9] usb: gadget: fastboot: Add external command execution support Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180209094316.8523-3-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox