All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v5 0/4] Implement "fastboot flash" for eMMC
@ 2014-08-23 19:53 Steve Rae
  2014-08-23 19:53 ` [U-Boot] [PATCH v5 1/4] usb/gadget: fastboot: add eMMC support for flash command Steve Rae
                   ` (5 more replies)
  0 siblings, 6 replies; 21+ messages in thread
From: Steve Rae @ 2014-08-23 19:53 UTC (permalink / raw)
  To: u-boot

This series implements the "fastboot flash" command for eMMC devices.
It supports both raw and sparse images.

NOTES:
- the support for the "fastboot flash" command is enabled with CONFIG_FASTBOOT_FLASH
- the support for eMMC is enabled with CONFIG_FASTBOOT_FLASH_MMC_DEV
- (future) the support for NAND would be enabled with CONFIG_FASTBOOT_FLASH_NAND(???)

This has been tested on ARMv7.

----

This series depends on:
  http://patchwork.ozlabs.org/patch/379438/
  http://patchwork.ozlabs.org/patch/382443/ (to 382446)

Changes in v5:
- use the common/aboot.c for the "sparse format" handling

Changes in v4:
- rearranged this patchset so that "sparse_format.h" can be dropped (if we cannot
  resolve the copyright/licensing issues)
- update mmc_get_dev(...) to get_dev("mmc",....)
- update printf() to puts() where applicable
- update debug string as per feedback
- rearranged "sparse format" support in this patchset, in order to isolate...

Changes in v3:
- remove most references to 'mmc',
  which leaves only one mmc specific function: mmc_get_dev()

Changes in v2:
- split large function into three
- improved handling of response messages
- additional partition size checking when writing sparse image
- update README.android-fastboot file
- new in v2

Steve Rae (4):
  usb/gadget: fastboot: add eMMC support for flash command
  usb/gadget: fastboot: add support for flash command
  usb/gadget: fastboot: minor cleanup
  usb/gadget: fastboot: implement sparse format

 README                          | 10 +++++
 common/Makefile                 |  6 +++
 common/cmd_fastboot.c           |  7 +--
 common/fb_mmc.c                 | 95 +++++++++++++++++++++++++++++++++++++++++
 doc/README.android-fastboot     |  5 ++-
 drivers/usb/gadget/f_fastboot.c | 44 +++++++++++++++++--
 include/fb_mmc.h                |  8 ++++
 7 files changed, 166 insertions(+), 9 deletions(-)
 create mode 100644 common/fb_mmc.c
 create mode 100644 include/fb_mmc.h

-- 
1.8.5

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH v5 1/4] usb/gadget: fastboot: add eMMC support for flash command
  2014-08-23 19:53 [U-Boot] [PATCH v5 0/4] Implement "fastboot flash" for eMMC Steve Rae
@ 2014-08-23 19:53 ` Steve Rae
  2014-08-26  9:28   ` Lukasz Majewski
  2014-08-23 19:53 ` [U-Boot] [PATCH v5 2/4] usb/gadget: fastboot: add " Steve Rae
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 21+ messages in thread
From: Steve Rae @ 2014-08-23 19:53 UTC (permalink / raw)
  To: u-boot

- add support for 'fastboot flash' command for eMMC devices

Signed-off-by: Steve Rae <srae@broadcom.com>
---

Changes in v5: None
Changes in v4:
- rearranged this patchset so that "sparse_format.h" can be dropped (if we cannot
  resolve the copyright/licensing issues)
- update mmc_get_dev(...) to get_dev("mmc",....)
- update printf() to puts() where applicable

Changes in v3:
- remove most references to 'mmc',
  which leaves only one mmc specific function: mmc_get_dev()

Changes in v2:
- split large function into three
- improved handling of response messages
- additional partition size checking when writing sparse image

 common/Makefile  |  5 ++++
 common/fb_mmc.c  | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/fb_mmc.h |  8 ++++++
 3 files changed, 95 insertions(+)
 create mode 100644 common/fb_mmc.c
 create mode 100644 include/fb_mmc.h

diff --git a/common/Makefile b/common/Makefile
index de5cce8..daebe39 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -266,4 +266,9 @@ obj-$(CONFIG_IO_TRACE) += iotrace.o
 obj-y += memsize.o
 obj-y += stdio.o
 
+# This option is not just y/n - it can have a numeric value
+ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
+obj-y += fb_mmc.o
+endif
+
 CFLAGS_env_embedded.o := -Wa,--no-warn -DENV_CRC=$(shell tools/envcrc 2>/dev/null)
diff --git a/common/fb_mmc.c b/common/fb_mmc.c
new file mode 100644
index 0000000..e559e2a
--- /dev/null
+++ b/common/fb_mmc.c
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2014 Broadcom Corporation.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <fb_mmc.h>
+#include <part.h>
+
+/* The 64 defined bytes plus the '\0' */
+#define RESPONSE_LEN	(64 + 1)
+
+static char *response_str;
+
+static void fastboot_resp(const char *s)
+{
+	strncpy(response_str, s, RESPONSE_LEN);
+	response_str[RESPONSE_LEN - 1] = '\0';
+}
+
+static void write_raw_image(block_dev_desc_t *dev_desc, disk_partition_t *info,
+		const char *part_name, void *buffer,
+		unsigned int download_bytes)
+{
+	lbaint_t blkcnt;
+	lbaint_t blks;
+
+	/* determine number of blocks to write */
+	blkcnt = ((download_bytes + (info->blksz - 1)) & ~(info->blksz - 1));
+	blkcnt = blkcnt / info->blksz;
+
+	if (blkcnt > info->size) {
+		printf("%s: too large for partition: '%s'\n", __func__,
+		       part_name);
+		fastboot_resp("FAILtoo large for partition");
+		return;
+	}
+
+	puts("Flashing Raw Image\n");
+
+	blks = dev_desc->block_write(dev_desc->dev, info->start, blkcnt,
+				     buffer);
+	if (blks != blkcnt) {
+		printf("%s: failed writing to device %d\n", __func__,
+		       dev_desc->dev);
+		fastboot_resp("FAILfailed writing to device");
+		return;
+	}
+
+	printf("........ wrote " LBAFU " bytes to '%s'\n", blkcnt * info->blksz,
+	       part_name);
+	fastboot_resp("OKAY");
+}
+
+void fb_mmc_flash_write(const char *cmd, void *download_buffer,
+			unsigned int download_bytes, char *response)
+{
+	int ret;
+	block_dev_desc_t *dev_desc;
+	disk_partition_t info;
+
+	/* initialize the response buffer */
+	response_str = response;
+
+	dev_desc = get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV);
+	if (!dev_desc || dev_desc->type == DEV_TYPE_UNKNOWN) {
+		printf("%s: invalid mmc device\n", __func__);
+		fastboot_resp("FAILinvalid mmc device");
+		return;
+	}
+
+	ret = get_partition_info_efi_by_name(dev_desc, cmd, &info);
+	if (ret) {
+		printf("%s: cannot find partition: '%s'\n", __func__, cmd);
+		fastboot_resp("FAILcannot find partition");
+		return;
+	}
+
+	write_raw_image(dev_desc, &info, cmd, download_buffer,
+			download_bytes);
+}
diff --git a/include/fb_mmc.h b/include/fb_mmc.h
new file mode 100644
index 0000000..1ad1d13
--- /dev/null
+++ b/include/fb_mmc.h
@@ -0,0 +1,8 @@
+/*
+ * Copyright 2014 Broadcom Corporation.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+void fb_mmc_flash_write(const char *cmd, void *download_buffer,
+			unsigned int download_bytes, char *response);
-- 
1.8.5

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH v5 2/4] usb/gadget: fastboot: add support for flash command
  2014-08-23 19:53 [U-Boot] [PATCH v5 0/4] Implement "fastboot flash" for eMMC Steve Rae
  2014-08-23 19:53 ` [U-Boot] [PATCH v5 1/4] usb/gadget: fastboot: add eMMC support for flash command Steve Rae
@ 2014-08-23 19:53 ` Steve Rae
  2014-08-26 11:53   ` Lukasz Majewski
  2014-08-23 19:53 ` [U-Boot] [PATCH v5 3/4] usb/gadget: fastboot: minor cleanup Steve Rae
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 21+ messages in thread
From: Steve Rae @ 2014-08-23 19:53 UTC (permalink / raw)
  To: u-boot

- implement 'fastboot flash' for eMMC devices

Signed-off-by: Steve Rae <srae@broadcom.com>
Reviewed-by: Marek Vasut <marex@denx.de>
---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2:
- update README.android-fastboot file

 README                          | 10 ++++++++++
 doc/README.android-fastboot     |  5 +++--
 drivers/usb/gadget/f_fastboot.c | 31 +++++++++++++++++++++++++++++++
 3 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/README b/README
index 1d71359..ed26884 100644
--- a/README
+++ b/README
@@ -1623,6 +1623,16 @@ The following options need to be configured:
 		downloads. This buffer should be as large as possible for a
 		platform. Define this to the size available RAM for fastboot.
 
+		CONFIG_FASTBOOT_FLASH
+		The fastboot protocol includes a "flash" command for writing
+		the downloaded image to a non-volatile storage device. Define
+		this to enable the "fastboot flash" command.
+
+		CONFIG_FASTBOOT_FLASH_MMC_DEV
+		The fastboot "flash" command requires addition information
+		regarding the non-volatile storage device. Define this to
+		the eMMC device that fastboot should use to store the image.
+
 - Journaling Flash filesystem support:
 		CONFIG_JFFS2_NAND, CONFIG_JFFS2_NAND_OFF, CONFIG_JFFS2_NAND_SIZE,
 		CONFIG_JFFS2_NAND_DEV
diff --git a/doc/README.android-fastboot b/doc/README.android-fastboot
index 4045727..1677609 100644
--- a/doc/README.android-fastboot
+++ b/doc/README.android-fastboot
@@ -6,8 +6,9 @@ Overview
 The protocol that is used over USB is described in
 README.android-fastboot-protocol in same directory.
 
-The current implementation does not yet support the flash and erase
-commands.
+The current implementation does not yet support the erase command or the
+"oem format" command, and there is minimal support for the flash command;
+it only supports eMMC devices.
 
 Client installation
 ===================
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 7a1acb9..e2659fa 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -19,6 +19,9 @@
 #include <linux/compiler.h>
 #include <version.h>
 #include <g_dnl.h>
+#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
+#include <fb_mmc.h>
+#endif
 
 #define FASTBOOT_VERSION		"0.4"
 
@@ -469,6 +472,28 @@ static void cb_boot(struct usb_ep *ep, struct usb_request *req)
 	fastboot_tx_write_str("OKAY");
 }
 
+#ifdef CONFIG_FASTBOOT_FLASH
+static void cb_flash(struct usb_ep *ep, struct usb_request *req)
+{
+	char *cmd = req->buf;
+	char response[RESPONSE_LEN];
+
+	strsep(&cmd, ":");
+	if (!cmd) {
+		printf("%s: missing partition name\n", __func__);
+		fastboot_tx_write_str("FAILmissing partition name");
+		return;
+	}
+
+	strcpy(response, "FAILno flash device defined");
+#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
+	fb_mmc_flash_write(cmd, (void *)CONFIG_USB_FASTBOOT_BUF_ADDR,
+			   download_bytes, response);
+#endif
+	fastboot_tx_write_str(response);
+}
+#endif
+
 struct cmd_dispatch_info {
 	char *cmd;
 	void (*cb)(struct usb_ep *ep, struct usb_request *req);
@@ -488,6 +513,12 @@ static const struct cmd_dispatch_info cmd_dispatch_info[] = {
 		.cmd = "boot",
 		.cb = cb_boot,
 	},
+#ifdef CONFIG_FASTBOOT_FLASH
+	{
+		.cmd = "flash",
+		.cb = cb_flash,
+	},
+#endif
 };
 
 static void rx_handler_command(struct usb_ep *ep, struct usb_request *req)
-- 
1.8.5

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH v5 3/4] usb/gadget: fastboot: minor cleanup
  2014-08-23 19:53 [U-Boot] [PATCH v5 0/4] Implement "fastboot flash" for eMMC Steve Rae
  2014-08-23 19:53 ` [U-Boot] [PATCH v5 1/4] usb/gadget: fastboot: add eMMC support for flash command Steve Rae
  2014-08-23 19:53 ` [U-Boot] [PATCH v5 2/4] usb/gadget: fastboot: add " Steve Rae
@ 2014-08-23 19:53 ` Steve Rae
  2014-08-26 11:55   ` Lukasz Majewski
  2014-08-23 19:53 ` [U-Boot] [PATCH v5 4/4] usb/gadget: fastboot: implement sparse format Steve Rae
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 21+ messages in thread
From: Steve Rae @ 2014-08-23 19:53 UTC (permalink / raw)
  To: u-boot

- update static function
- additional debugging statements
- update "fastboot command" information
- add missing include file
- update spelling

Signed-off-by: Steve Rae <srae@broadcom.com>
---

Changes in v5: None
Changes in v4:
- update debug string as per feedback

Changes in v3: None
Changes in v2:
- new in v2

 common/cmd_fastboot.c           |  7 ++++---
 drivers/usb/gadget/f_fastboot.c | 13 +++++++++----
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/common/cmd_fastboot.c b/common/cmd_fastboot.c
index 83fa7bd..909616d 100644
--- a/common/cmd_fastboot.c
+++ b/common/cmd_fastboot.c
@@ -30,7 +30,8 @@ static int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 }
 
 U_BOOT_CMD(
-	fastboot,	1,	1,	do_fastboot,
-	"fastboot - enter USB Fastboot protocol",
-	""
+	fastboot,	1,	0,	do_fastboot,
+	"use USB Fastboot protocol",
+	"\n"
+	"    - run as a fastboot usb device"
 );
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index e2659fa..3b588a9 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -10,6 +10,7 @@
  *
  * SPDX-License-Identifier:	GPL-2.0+
  */
+#include <config.h>
 #include <common.h>
 #include <errno.h>
 #include <malloc.h>
@@ -41,7 +42,7 @@
 struct f_fastboot {
 	struct usb_function usb_function;
 
-	/* IN/OUT EP's and correspoinding requests */
+	/* IN/OUT EP's and corresponding requests */
 	struct usb_ep *in_ep, *out_ep;
 	struct usb_request *in_req, *out_req;
 };
@@ -293,7 +294,7 @@ static int fastboot_add(struct usb_configuration *c)
 }
 DECLARE_GADGET_BIND_CALLBACK(usb_dnl_fastboot, fastboot_add);
 
-int fastboot_tx_write(const char *buffer, unsigned int buffer_size)
+static int fastboot_tx_write(const char *buffer, unsigned int buffer_size)
 {
 	struct usb_request *in_req = fastboot_func->in_req;
 	int ret;
@@ -341,6 +342,7 @@ static void cb_getvar(struct usb_ep *ep, struct usb_request *req)
 
 	strsep(&cmd, ":");
 	if (!cmd) {
+		printf("%s: missing variable\n", __func__);
 		fastboot_tx_write_str("FAILmissing var");
 		return;
 	}
@@ -361,6 +363,7 @@ static void cb_getvar(struct usb_ep *ep, struct usb_request *req)
 		else
 			strcpy(response, "FAILValue not set");
 	} else {
+		printf("%s: unknown variable: %s\n", __func__, cmd);
 		strcpy(response, "FAILVariable not implemented");
 	}
 	fastboot_tx_write_str(response);
@@ -534,10 +537,12 @@ static void rx_handler_command(struct usb_ep *ep, struct usb_request *req)
 		}
 	}
 
-	if (!func_cb)
+	if (!func_cb) {
+		printf("%s: unknown command: %s\n", __func__, cmdbuf);
 		fastboot_tx_write_str("FAILunknown command");
-	else
+	} else {
 		func_cb(ep, req);
+	}
 
 	if (req->status == 0) {
 		*cmdbuf = '\0';
-- 
1.8.5

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH v5 4/4] usb/gadget: fastboot: implement sparse format
  2014-08-23 19:53 [U-Boot] [PATCH v5 0/4] Implement "fastboot flash" for eMMC Steve Rae
                   ` (2 preceding siblings ...)
  2014-08-23 19:53 ` [U-Boot] [PATCH v5 3/4] usb/gadget: fastboot: minor cleanup Steve Rae
@ 2014-08-23 19:53 ` Steve Rae
  2014-08-26 11:58   ` Lukasz Majewski
  2014-08-23 20:12 ` [U-Boot] [PATCH v5 0/4] Implement "fastboot flash" for eMMC Marek Vasut
  2014-08-25 14:57 ` Lukasz Majewski
  5 siblings, 1 reply; 21+ messages in thread
From: Steve Rae @ 2014-08-23 19:53 UTC (permalink / raw)
  To: u-boot

- add capability to "fastboot flash" with sparse format images

Signed-off-by: Steve Rae <srae@broadcom.com>
---

Changes in v5:
- use the common/aboot.c for the "sparse format" handling

Changes in v4:
- rearranged "sparse format" support in this patchset, in order to isolate...

Changes in v3: None
Changes in v2: None

 common/Makefile |  1 +
 common/fb_mmc.c | 33 +++++++++++++++++++++++----------
 2 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/common/Makefile b/common/Makefile
index daebe39..bc53078 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -268,6 +268,7 @@ obj-y += stdio.o
 
 # This option is not just y/n - it can have a numeric value
 ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
+obj-y += aboot.o
 obj-y += fb_mmc.o
 endif
 
diff --git a/common/fb_mmc.c b/common/fb_mmc.c
index e559e2a..c2e896f 100644
--- a/common/fb_mmc.c
+++ b/common/fb_mmc.c
@@ -7,16 +7,24 @@
 #include <common.h>
 #include <fb_mmc.h>
 #include <part.h>
+#include <aboot.h>
+#include <sparse_format.h>
 
 /* The 64 defined bytes plus the '\0' */
 #define RESPONSE_LEN	(64 + 1)
 
 static char *response_str;
 
-static void fastboot_resp(const char *s)
+void fastboot_fail(const char *s)
 {
-	strncpy(response_str, s, RESPONSE_LEN);
-	response_str[RESPONSE_LEN - 1] = '\0';
+	strncpy(response_str, "FAIL", 4);
+	strncat(response_str, s, RESPONSE_LEN - 4 - 1);
+}
+
+void fastboot_okay(const char *s)
+{
+	strncpy(response_str, "OKAY", 4);
+	strncat(response_str, s, RESPONSE_LEN - 4 - 1);
 }
 
 static void write_raw_image(block_dev_desc_t *dev_desc, disk_partition_t *info,
@@ -33,7 +41,7 @@ static void write_raw_image(block_dev_desc_t *dev_desc, disk_partition_t *info,
 	if (blkcnt > info->size) {
 		printf("%s: too large for partition: '%s'\n", __func__,
 		       part_name);
-		fastboot_resp("FAILtoo large for partition");
+		fastboot_fail("too large for partition");
 		return;
 	}
 
@@ -44,13 +52,13 @@ static void write_raw_image(block_dev_desc_t *dev_desc, disk_partition_t *info,
 	if (blks != blkcnt) {
 		printf("%s: failed writing to device %d\n", __func__,
 		       dev_desc->dev);
-		fastboot_resp("FAILfailed writing to device");
+		fastboot_fail("failed writing to device");
 		return;
 	}
 
 	printf("........ wrote " LBAFU " bytes to '%s'\n", blkcnt * info->blksz,
 	       part_name);
-	fastboot_resp("OKAY");
+	fastboot_okay("");
 }
 
 void fb_mmc_flash_write(const char *cmd, void *download_buffer,
@@ -66,17 +74,22 @@ void fb_mmc_flash_write(const char *cmd, void *download_buffer,
 	dev_desc = get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV);
 	if (!dev_desc || dev_desc->type == DEV_TYPE_UNKNOWN) {
 		printf("%s: invalid mmc device\n", __func__);
-		fastboot_resp("FAILinvalid mmc device");
+		fastboot_fail("invalid mmc device");
 		return;
 	}
 
 	ret = get_partition_info_efi_by_name(dev_desc, cmd, &info);
 	if (ret) {
 		printf("%s: cannot find partition: '%s'\n", __func__, cmd);
-		fastboot_resp("FAILcannot find partition");
+		fastboot_fail("cannot find partition");
 		return;
 	}
 
-	write_raw_image(dev_desc, &info, cmd, download_buffer,
-			download_bytes);
+	if (is_sparse_image(download_buffer)) {
+		write_sparse_image(dev_desc, &info, cmd, download_buffer,
+				   download_bytes);
+	} else {
+		write_raw_image(dev_desc, &info, cmd, download_buffer,
+				download_bytes);
+	}
 }
-- 
1.8.5

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH v5 0/4] Implement "fastboot flash" for eMMC
  2014-08-23 19:53 [U-Boot] [PATCH v5 0/4] Implement "fastboot flash" for eMMC Steve Rae
                   ` (3 preceding siblings ...)
  2014-08-23 19:53 ` [U-Boot] [PATCH v5 4/4] usb/gadget: fastboot: implement sparse format Steve Rae
@ 2014-08-23 20:12 ` Marek Vasut
  2014-08-25  7:19   ` Lukasz Majewski
  2014-08-25 14:57 ` Lukasz Majewski
  5 siblings, 1 reply; 21+ messages in thread
From: Marek Vasut @ 2014-08-23 20:12 UTC (permalink / raw)
  To: u-boot

On Saturday, August 23, 2014 at 09:53:01 PM, Steve Rae wrote:
> This series implements the "fastboot flash" command for eMMC devices.
> It supports both raw and sparse images.
> 
> NOTES:
> - the support for the "fastboot flash" command is enabled with
> CONFIG_FASTBOOT_FLASH - the support for eMMC is enabled with
> CONFIG_FASTBOOT_FLASH_MMC_DEV - (future) the support for NAND would be
> enabled with CONFIG_FASTBOOT_FLASH_NAND(???)
> 
> This has been tested on ARMv7.

Lukasz, can you please pick this for this MW and send me a PR? Thanks!

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH v5 0/4] Implement "fastboot flash" for eMMC
  2014-08-23 20:12 ` [U-Boot] [PATCH v5 0/4] Implement "fastboot flash" for eMMC Marek Vasut
@ 2014-08-25  7:19   ` Lukasz Majewski
  2014-08-25  7:52     ` Marek Vasut
  0 siblings, 1 reply; 21+ messages in thread
From: Lukasz Majewski @ 2014-08-25  7:19 UTC (permalink / raw)
  To: u-boot

Hi Marek,

> On Saturday, August 23, 2014 at 09:53:01 PM, Steve Rae wrote:
> > This series implements the "fastboot flash" command for eMMC
> > devices. It supports both raw and sparse images.
> > 
> > NOTES:
> > - the support for the "fastboot flash" command is enabled with
> > CONFIG_FASTBOOT_FLASH - the support for eMMC is enabled with
> > CONFIG_FASTBOOT_FLASH_MMC_DEV - (future) the support for NAND would
> > be enabled with CONFIG_FASTBOOT_FLASH_NAND(???)
> > 
> > This has been tested on ARMv7.
> 
> Lukasz, can you please pick this for this MW and send me a PR? Thanks!

No problem, I can pull this code to u-boot-dfu tree. 

However, since I've been CCed to this patch series very recently I'd
like to look into this code closely as it goes through my tree.

I hope that nobody minds this :-)

> 
> Best regards,
> Marek Vasut



-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH v5 0/4] Implement "fastboot flash" for eMMC
  2014-08-25  7:19   ` Lukasz Majewski
@ 2014-08-25  7:52     ` Marek Vasut
  0 siblings, 0 replies; 21+ messages in thread
From: Marek Vasut @ 2014-08-25  7:52 UTC (permalink / raw)
  To: u-boot

On Monday, August 25, 2014 at 09:19:26 AM, Lukasz Majewski wrote:
> Hi Marek,
> 
> > On Saturday, August 23, 2014 at 09:53:01 PM, Steve Rae wrote:
> > > This series implements the "fastboot flash" command for eMMC
> > > devices. It supports both raw and sparse images.
> > > 
> > > NOTES:
> > > - the support for the "fastboot flash" command is enabled with
> > > CONFIG_FASTBOOT_FLASH - the support for eMMC is enabled with
> > > CONFIG_FASTBOOT_FLASH_MMC_DEV - (future) the support for NAND would
> > > be enabled with CONFIG_FASTBOOT_FLASH_NAND(???)
> > > 
> > > This has been tested on ARMv7.
> > 
> > Lukasz, can you please pick this for this MW and send me a PR? Thanks!
> 
> No problem, I can pull this code to u-boot-dfu tree.
> 
> However, since I've been CCed to this patch series very recently I'd
> like to look into this code closely as it goes through my tree.
> 
> I hope that nobody minds this :-)

Sure. Btw. trimming the CC list ...

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH v5 0/4] Implement "fastboot flash" for eMMC
  2014-08-23 19:53 [U-Boot] [PATCH v5 0/4] Implement "fastboot flash" for eMMC Steve Rae
                   ` (4 preceding siblings ...)
  2014-08-23 20:12 ` [U-Boot] [PATCH v5 0/4] Implement "fastboot flash" for eMMC Marek Vasut
@ 2014-08-25 14:57 ` Lukasz Majewski
  2014-08-25 17:10   ` Steve Rae
  5 siblings, 1 reply; 21+ messages in thread
From: Lukasz Majewski @ 2014-08-25 14:57 UTC (permalink / raw)
  To: u-boot

Hi Steve,

> This series implements the "fastboot flash" command for eMMC devices.
> It supports both raw and sparse images.
> 
> NOTES:
> - the support for the "fastboot flash" command is enabled with
> CONFIG_FASTBOOT_FLASH
> - the support for eMMC is enabled with CONFIG_FASTBOOT_FLASH_MMC_DEV
> - (future) the support for NAND would be enabled with
> CONFIG_FASTBOOT_FLASH_NAND(???)
> 
> This has been tested on ARMv7.
> 
> ----
> 
> This series depends on:
>   http://patchwork.ozlabs.org/patch/379438/

This patch is already applied.

>   http://patchwork.ozlabs.org/patch/382443/ (to 382446)

Could you resend the above patch series one more time?

From the links it seems that in PATCH 1/4 you add the ./common/aboot.c
file and at PATCH 2/4 you remove it.

Is this done on purpose?

(I've also trimmed down the CC list).

> 
> Changes in v5:
> - use the common/aboot.c for the "sparse format" handling
> 
> Changes in v4:
> - rearranged this patchset so that "sparse_format.h" can be dropped
> (if we cannot resolve the copyright/licensing issues)
> - update mmc_get_dev(...) to get_dev("mmc",....)
> - update printf() to puts() where applicable
> - update debug string as per feedback
> - rearranged "sparse format" support in this patchset, in order to
> isolate...
> 
> Changes in v3:
> - remove most references to 'mmc',
>   which leaves only one mmc specific function: mmc_get_dev()
> 
> Changes in v2:
> - split large function into three
> - improved handling of response messages
> - additional partition size checking when writing sparse image
> - update README.android-fastboot file
> - new in v2
> 
> Steve Rae (4):
>   usb/gadget: fastboot: add eMMC support for flash command
>   usb/gadget: fastboot: add support for flash command
>   usb/gadget: fastboot: minor cleanup
>   usb/gadget: fastboot: implement sparse format
> 
>  README                          | 10 +++++
>  common/Makefile                 |  6 +++
>  common/cmd_fastboot.c           |  7 +--
>  common/fb_mmc.c                 | 95
> +++++++++++++++++++++++++++++++++++++++++
> doc/README.android-fastboot     |  5 ++-
> drivers/usb/gadget/f_fastboot.c | 44 +++++++++++++++++--
> include/fb_mmc.h                |  8 ++++ 7 files changed, 166
> insertions(+), 9 deletions(-) create mode 100644 common/fb_mmc.c
>  create mode 100644 include/fb_mmc.h
> 



-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH v5 0/4] Implement "fastboot flash" for eMMC
  2014-08-25 14:57 ` Lukasz Majewski
@ 2014-08-25 17:10   ` Steve Rae
  2014-08-26  9:14     ` Lukasz Majewski
  0 siblings, 1 reply; 21+ messages in thread
From: Steve Rae @ 2014-08-25 17:10 UTC (permalink / raw)
  To: u-boot



On 14-08-25 07:57 AM, Lukasz Majewski wrote:
> Hi Steve,
>
>> This series implements the "fastboot flash" command for eMMC devices.
>> It supports both raw and sparse images.
>>
>> NOTES:
>> - the support for the "fastboot flash" command is enabled with
>> CONFIG_FASTBOOT_FLASH
>> - the support for eMMC is enabled with CONFIG_FASTBOOT_FLASH_MMC_DEV
>> - (future) the support for NAND would be enabled with
>> CONFIG_FASTBOOT_FLASH_NAND(???)
>>
>> This has been tested on ARMv7.
>>
>> ----
>>
>> This series depends on:
>>    http://patchwork.ozlabs.org/patch/379438/
>
> This patch is already applied.
Correct
(But it wasn't when I was preparing this....)

>
>>    http://patchwork.ozlabs.org/patch/382443/ (to 382446)
>
> Could you resend the above patch series one more time?
>
>  From the links it seems that in PATCH 1/4 you add the ./common/aboot.c
> file and at PATCH 2/4 you remove it.
>
> Is this done on purpose?
yes: done on purpose (in order to see the history of the changes to the 
file....) -- see the comments in the cover letter to that patch-series!!!

>
> (I've also trimmed down the CC list).
>
>>
>> Changes in v5:
>> - use the common/aboot.c for the "sparse format" handling
>>
>> Changes in v4:
>> - rearranged this patchset so that "sparse_format.h" can be dropped
>> (if we cannot resolve the copyright/licensing issues)
>> - update mmc_get_dev(...) to get_dev("mmc",....)
>> - update printf() to puts() where applicable
>> - update debug string as per feedback
>> - rearranged "sparse format" support in this patchset, in order to
>> isolate...
>>
>> Changes in v3:
>> - remove most references to 'mmc',
>>    which leaves only one mmc specific function: mmc_get_dev()
>>
>> Changes in v2:
>> - split large function into three
>> - improved handling of response messages
>> - additional partition size checking when writing sparse image
>> - update README.android-fastboot file
>> - new in v2
>>
>> Steve Rae (4):
>>    usb/gadget: fastboot: add eMMC support for flash command
>>    usb/gadget: fastboot: add support for flash command
>>    usb/gadget: fastboot: minor cleanup
>>    usb/gadget: fastboot: implement sparse format
>>
>>   README                          | 10 +++++
>>   common/Makefile                 |  6 +++
>>   common/cmd_fastboot.c           |  7 +--
>>   common/fb_mmc.c                 | 95
>> +++++++++++++++++++++++++++++++++++++++++
>> doc/README.android-fastboot     |  5 ++-
>> drivers/usb/gadget/f_fastboot.c | 44 +++++++++++++++++--
>> include/fb_mmc.h                |  8 ++++ 7 files changed, 166
>> insertions(+), 9 deletions(-) create mode 100644 common/fb_mmc.c
>>   create mode 100644 include/fb_mmc.h
>>
>
>
>
Thanks, Steve

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH v5 0/4] Implement "fastboot flash" for eMMC
  2014-08-25 17:10   ` Steve Rae
@ 2014-08-26  9:14     ` Lukasz Majewski
  2014-08-26 16:27       ` Steve Rae
  0 siblings, 1 reply; 21+ messages in thread
From: Lukasz Majewski @ 2014-08-26  9:14 UTC (permalink / raw)
  To: u-boot

Hi Steve,

> 
> 
> On 14-08-25 07:57 AM, Lukasz Majewski wrote:
> > Hi Steve,
> >
> >> This series implements the "fastboot flash" command for eMMC
> >> devices. It supports both raw and sparse images.
> >>
> >> NOTES:
> >> - the support for the "fastboot flash" command is enabled with
> >> CONFIG_FASTBOOT_FLASH
> >> - the support for eMMC is enabled with
> >> CONFIG_FASTBOOT_FLASH_MMC_DEV
> >> - (future) the support for NAND would be enabled with
> >> CONFIG_FASTBOOT_FLASH_NAND(???)
> >>
> >> This has been tested on ARMv7.
> >>
> >> ----
> >>
> >> This series depends on:
> >>    http://patchwork.ozlabs.org/patch/379438/
> >
> > This patch is already applied.
> Correct
> (But it wasn't when I was preparing this....)
> 
> >
> >>    http://patchwork.ozlabs.org/patch/382443/ (to 382446)
> >
> > Could you resend the above patch series one more time?
> >
> >  From the links it seems that in PATCH 1/4 you add
> > the ./common/aboot.c file and at PATCH 2/4 you remove it.
> >
> > Is this done on purpose?
> yes: done on purpose (in order to see the history of the changes to
> the file....) -- see the comments in the cover letter to that
> patch-series!!!

Ok, Now it is clear.

Is fair as I know bsd-3L-clause license is compatible with GPL.

However, to be 100% sure I'd like to ask Tom (as he has much more
legal experience than me) to confirm that this code can be added to
u-boot.

> 
> >
> > (I've also trimmed down the CC list).
> >
> >>
> >> Changes in v5:
> >> - use the common/aboot.c for the "sparse format" handling
> >>
> >> Changes in v4:
> >> - rearranged this patchset so that "sparse_format.h" can be dropped
> >> (if we cannot resolve the copyright/licensing issues)
> >> - update mmc_get_dev(...) to get_dev("mmc",....)
> >> - update printf() to puts() where applicable
> >> - update debug string as per feedback
> >> - rearranged "sparse format" support in this patchset, in order to
> >> isolate...
> >>
> >> Changes in v3:
> >> - remove most references to 'mmc',
> >>    which leaves only one mmc specific function: mmc_get_dev()
> >>
> >> Changes in v2:
> >> - split large function into three
> >> - improved handling of response messages
> >> - additional partition size checking when writing sparse image
> >> - update README.android-fastboot file
> >> - new in v2
> >>
> >> Steve Rae (4):
> >>    usb/gadget: fastboot: add eMMC support for flash command
> >>    usb/gadget: fastboot: add support for flash command
> >>    usb/gadget: fastboot: minor cleanup
> >>    usb/gadget: fastboot: implement sparse format
> >>
> >>   README                          | 10 +++++
> >>   common/Makefile                 |  6 +++
> >>   common/cmd_fastboot.c           |  7 +--
> >>   common/fb_mmc.c                 | 95
> >> +++++++++++++++++++++++++++++++++++++++++
> >> doc/README.android-fastboot     |  5 ++-
> >> drivers/usb/gadget/f_fastboot.c | 44 +++++++++++++++++--
> >> include/fb_mmc.h                |  8 ++++ 7 files changed, 166
> >> insertions(+), 9 deletions(-) create mode 100644 common/fb_mmc.c
> >>   create mode 100644 include/fb_mmc.h
> >>
> >
> >
> >
> Thanks, Steve



-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH v5 1/4] usb/gadget: fastboot: add eMMC support for flash command
  2014-08-23 19:53 ` [U-Boot] [PATCH v5 1/4] usb/gadget: fastboot: add eMMC support for flash command Steve Rae
@ 2014-08-26  9:28   ` Lukasz Majewski
  2014-08-26  9:41     ` Marek Vasut
  0 siblings, 1 reply; 21+ messages in thread
From: Lukasz Majewski @ 2014-08-26  9:28 UTC (permalink / raw)
  To: u-boot

Hi Steve,

> - add support for 'fastboot flash' command for eMMC devices
> 
> Signed-off-by: Steve Rae <srae@broadcom.com>
> ---
> 
> Changes in v5: None
> Changes in v4:
> - rearranged this patchset so that "sparse_format.h" can be dropped
> (if we cannot resolve the copyright/licensing issues)
> - update mmc_get_dev(...) to get_dev("mmc",....)
> - update printf() to puts() where applicable
> 
> Changes in v3:
> - remove most references to 'mmc',
>   which leaves only one mmc specific function: mmc_get_dev()
> 
> Changes in v2:
> - split large function into three
> - improved handling of response messages
> - additional partition size checking when writing sparse image
> 
>  common/Makefile  |  5 ++++
>  common/fb_mmc.c  | 82
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> include/fb_mmc.h |  8 ++++++ 3 files changed, 95 insertions(+)
>  create mode 100644 common/fb_mmc.c
>  create mode 100644 include/fb_mmc.h
> 
> diff --git a/common/Makefile b/common/Makefile
> index de5cce8..daebe39 100644
> --- a/common/Makefile
> +++ b/common/Makefile
> @@ -266,4 +266,9 @@ obj-$(CONFIG_IO_TRACE) += iotrace.o
>  obj-y += memsize.o
>  obj-y += stdio.o
>  
> +# This option is not just y/n - it can have a numeric value
> +ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
> +obj-y += fb_mmc.o
> +endif
> +
>  CFLAGS_env_embedded.o := -Wa,--no-warn -DENV_CRC=$(shell
> tools/envcrc 2>/dev/null) diff --git a/common/fb_mmc.c
> b/common/fb_mmc.c new file mode 100644
> index 0000000..e559e2a
> --- /dev/null
> +++ b/common/fb_mmc.c
> @@ -0,0 +1,82 @@
> +/*
> + * Copyright 2014 Broadcom Corporation.
> + *
> + * SPDX-License-Identifier:	GPL-2.0+
> + */
> +
> +#include <common.h>
> +#include <fb_mmc.h>
> +#include <part.h>
> +
> +/* The 64 defined bytes plus the '\0' */
> +#define RESPONSE_LEN	(64 + 1)
> +
> +static char *response_str;
> +
> +static void fastboot_resp(const char *s)
> +{
> +	strncpy(response_str, s, RESPONSE_LEN);
> +	response_str[RESPONSE_LEN - 1] = '\0';
> +}
> +
> +static void write_raw_image(block_dev_desc_t *dev_desc,
> disk_partition_t *info,
> +		const char *part_name, void *buffer,
> +		unsigned int download_bytes)
> +{
> +	lbaint_t blkcnt;
> +	lbaint_t blks;
> +
> +	/* determine number of blocks to write */
> +	blkcnt = ((download_bytes + (info->blksz - 1)) &
> ~(info->blksz - 1));
> +	blkcnt = blkcnt / info->blksz;
> +
> +	if (blkcnt > info->size) {
> +		printf("%s: too large for partition: '%s'\n",
> __func__,
> +		       part_name);

I would opt for using error() here instead of printf().

> +		fastboot_resp("FAILtoo large for partition");
> +		return;
> +	}
> +
> +	puts("Flashing Raw Image\n");
> +
> +	blks = dev_desc->block_write(dev_desc->dev, info->start,
> blkcnt,
> +				     buffer);
> +	if (blks != blkcnt) {
> +		printf("%s: failed writing to device %d\n", __func__,
> +		       dev_desc->dev);

		printf() -> error()

> +		fastboot_resp("FAILfailed writing to device");
> +		return;
> +	}
> +
> +	printf("........ wrote " LBAFU " bytes to '%s'\n", blkcnt *
> info->blksz,
> +	       part_name);
> +	fastboot_resp("OKAY");
> +}
> +
> +void fb_mmc_flash_write(const char *cmd, void *download_buffer,
> +			unsigned int download_bytes, char *response)
> +{
> +	int ret;
> +	block_dev_desc_t *dev_desc;
> +	disk_partition_t info;
> +
> +	/* initialize the response buffer */
> +	response_str = response;
> +
> +	dev_desc = get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV);
> +	if (!dev_desc || dev_desc->type == DEV_TYPE_UNKNOWN) {
> +		printf("%s: invalid mmc device\n", __func__);
		
		printf() -> error()

> +		fastboot_resp("FAILinvalid mmc device");
> +		return;
> +	}
> +
> +	ret = get_partition_info_efi_by_name(dev_desc, cmd, &info);
> +	if (ret) {
> +		printf("%s: cannot find partition: '%s'\n",
> __func__, cmd);

		printf() -> error()
	
> +		fastboot_resp("FAILcannot find partition");
> +		return;
> +	}
> +
> +	write_raw_image(dev_desc, &info, cmd, download_buffer,
> +			download_bytes);
> +}
> diff --git a/include/fb_mmc.h b/include/fb_mmc.h
> new file mode 100644
> index 0000000..1ad1d13
> --- /dev/null
> +++ b/include/fb_mmc.h
> @@ -0,0 +1,8 @@
> +/*
> + * Copyright 2014 Broadcom Corporation.
> + *
> + * SPDX-License-Identifier:	GPL-2.0+
> + */
> +
> +void fb_mmc_flash_write(const char *cmd, void *download_buffer,
> +			unsigned int download_bytes, char *response);


-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH v5 1/4] usb/gadget: fastboot: add eMMC support for flash command
  2014-08-26  9:28   ` Lukasz Majewski
@ 2014-08-26  9:41     ` Marek Vasut
  2014-08-26 18:54       ` Steve Rae
  0 siblings, 1 reply; 21+ messages in thread
From: Marek Vasut @ 2014-08-26  9:41 UTC (permalink / raw)
  To: u-boot

On Tuesday, August 26, 2014 at 11:28:43 AM, Lukasz Majewski wrote:
> Hi Steve,
> 
> > - add support for 'fastboot flash' command for eMMC devices
> > 
> > Signed-off-by: Steve Rae <srae@broadcom.com>

If those are only small things, I think we can fix them up ourselves before 
applying, no? Let's do just that if Steve agrees, no ?

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH v5 2/4] usb/gadget: fastboot: add support for flash command
  2014-08-23 19:53 ` [U-Boot] [PATCH v5 2/4] usb/gadget: fastboot: add " Steve Rae
@ 2014-08-26 11:53   ` Lukasz Majewski
  0 siblings, 0 replies; 21+ messages in thread
From: Lukasz Majewski @ 2014-08-26 11:53 UTC (permalink / raw)
  To: u-boot

Hi Steve,

> - implement 'fastboot flash' for eMMC devices
> 
> Signed-off-by: Steve Rae <srae@broadcom.com>
> Reviewed-by: Marek Vasut <marex@denx.de>
> ---
> 
> Changes in v5: None
> Changes in v4: None
> Changes in v3: None
> Changes in v2:
> - update README.android-fastboot file
> 
>  README                          | 10 ++++++++++
>  doc/README.android-fastboot     |  5 +++--
>  drivers/usb/gadget/f_fastboot.c | 31 +++++++++++++++++++++++++++++++
>  3 files changed, 44 insertions(+), 2 deletions(-)
> 
> diff --git a/README b/README
> index 1d71359..ed26884 100644
> --- a/README
> +++ b/README
> @@ -1623,6 +1623,16 @@ The following options need to be configured:
>  		downloads. This buffer should be as large as
> possible for a platform. Define this to the size available RAM for
> fastboot. 
> +		CONFIG_FASTBOOT_FLASH
> +		The fastboot protocol includes a "flash" command for
> writing
> +		the downloaded image to a non-volatile storage
> device. Define
> +		this to enable the "fastboot flash" command.
> +
> +		CONFIG_FASTBOOT_FLASH_MMC_DEV
> +		The fastboot "flash" command requires addition

						      ^^^^ additional?

> information
> +		regarding the non-volatile storage device. Define
> this to
> +		the eMMC device that fastboot should use to store
> the image. +
>  - Journaling Flash filesystem support:
>  		CONFIG_JFFS2_NAND, CONFIG_JFFS2_NAND_OFF,
> CONFIG_JFFS2_NAND_SIZE, CONFIG_JFFS2_NAND_DEV
> diff --git a/doc/README.android-fastboot b/doc/README.android-fastboot
> index 4045727..1677609 100644
> --- a/doc/README.android-fastboot
> +++ b/doc/README.android-fastboot
> @@ -6,8 +6,9 @@ Overview
>  The protocol that is used over USB is described in
>  README.android-fastboot-protocol in same directory.
>  
> -The current implementation does not yet support the flash and erase
> -commands.
> +The current implementation does not yet support the erase command or
> the +"oem format" command, and there is minimal support for the flash
> command; +it only supports eMMC devices.
>  
>  Client installation
>  ===================
> diff --git a/drivers/usb/gadget/f_fastboot.c
> b/drivers/usb/gadget/f_fastboot.c index 7a1acb9..e2659fa 100644
> --- a/drivers/usb/gadget/f_fastboot.c
> +++ b/drivers/usb/gadget/f_fastboot.c
> @@ -19,6 +19,9 @@
>  #include <linux/compiler.h>
>  #include <version.h>
>  #include <g_dnl.h>
> +#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
> +#include <fb_mmc.h>
> +#endif
>  
>  #define FASTBOOT_VERSION		"0.4"
>  
> @@ -469,6 +472,28 @@ static void cb_boot(struct usb_ep *ep, struct
> usb_request *req) fastboot_tx_write_str("OKAY");
>  }
>  
> +#ifdef CONFIG_FASTBOOT_FLASH
> +static void cb_flash(struct usb_ep *ep, struct usb_request *req)
> +{
> +	char *cmd = req->buf;
> +	char response[RESPONSE_LEN];
> +
> +	strsep(&cmd, ":");
> +	if (!cmd) {
> +		printf("%s: missing partition name\n", __func__);
> +		fastboot_tx_write_str("FAILmissing partition name");
> +		return;
> +	}
> +
> +	strcpy(response, "FAILno flash device defined");
> +#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
> +	fb_mmc_flash_write(cmd, (void *)CONFIG_USB_FASTBOOT_BUF_ADDR,
> +			   download_bytes, response);
> +#endif
> +	fastboot_tx_write_str(response);
> +}
> +#endif
> +
>  struct cmd_dispatch_info {
>  	char *cmd;
>  	void (*cb)(struct usb_ep *ep, struct usb_request *req);
> @@ -488,6 +513,12 @@ static const struct cmd_dispatch_info
> cmd_dispatch_info[] = { .cmd = "boot",
>  		.cb = cb_boot,
>  	},
> +#ifdef CONFIG_FASTBOOT_FLASH
> +	{
> +		.cmd = "flash",
> +		.cb = cb_flash,
> +	},
> +#endif
>  };
>  
>  static void rx_handler_command(struct usb_ep *ep, struct usb_request
> *req)

Despite the minor misspelling.

Acked-by: Lukasz Majewski <l.majewski@samsung.com>

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH v5 3/4] usb/gadget: fastboot: minor cleanup
  2014-08-23 19:53 ` [U-Boot] [PATCH v5 3/4] usb/gadget: fastboot: minor cleanup Steve Rae
@ 2014-08-26 11:55   ` Lukasz Majewski
  0 siblings, 0 replies; 21+ messages in thread
From: Lukasz Majewski @ 2014-08-26 11:55 UTC (permalink / raw)
  To: u-boot

Hi Steve,

> - update static function
> - additional debugging statements
> - update "fastboot command" information
> - add missing include file
> - update spelling
> 
> Signed-off-by: Steve Rae <srae@broadcom.com>
> ---
> 
> Changes in v5: None
> Changes in v4:
> - update debug string as per feedback
> 
> Changes in v3: None
> Changes in v2:
> - new in v2
> 
>  common/cmd_fastboot.c           |  7 ++++---
>  drivers/usb/gadget/f_fastboot.c | 13 +++++++++----
>  2 files changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/common/cmd_fastboot.c b/common/cmd_fastboot.c
> index 83fa7bd..909616d 100644
> --- a/common/cmd_fastboot.c
> +++ b/common/cmd_fastboot.c
> @@ -30,7 +30,8 @@ static int do_fastboot(cmd_tbl_t *cmdtp, int flag,
> int argc, char *const argv[]) }
>  
>  U_BOOT_CMD(
> -	fastboot,	1,	1,	do_fastboot,
> -	"fastboot - enter USB Fastboot protocol",
> -	""
> +	fastboot,	1,	0,	do_fastboot,
> +	"use USB Fastboot protocol",
> +	"\n"
> +	"    - run as a fastboot usb device"
>  );
> diff --git a/drivers/usb/gadget/f_fastboot.c
> b/drivers/usb/gadget/f_fastboot.c index e2659fa..3b588a9 100644
> --- a/drivers/usb/gadget/f_fastboot.c
> +++ b/drivers/usb/gadget/f_fastboot.c
> @@ -10,6 +10,7 @@
>   *
>   * SPDX-License-Identifier:	GPL-2.0+
>   */
> +#include <config.h>
>  #include <common.h>
>  #include <errno.h>
>  #include <malloc.h>
> @@ -41,7 +42,7 @@
>  struct f_fastboot {
>  	struct usb_function usb_function;
>  
> -	/* IN/OUT EP's and correspoinding requests */
> +	/* IN/OUT EP's and corresponding requests */
>  	struct usb_ep *in_ep, *out_ep;
>  	struct usb_request *in_req, *out_req;
>  };
> @@ -293,7 +294,7 @@ static int fastboot_add(struct usb_configuration
> *c) }
>  DECLARE_GADGET_BIND_CALLBACK(usb_dnl_fastboot, fastboot_add);
>  
> -int fastboot_tx_write(const char *buffer, unsigned int buffer_size)
> +static int fastboot_tx_write(const char *buffer, unsigned int
> buffer_size) {
>  	struct usb_request *in_req = fastboot_func->in_req;
>  	int ret;
> @@ -341,6 +342,7 @@ static void cb_getvar(struct usb_ep *ep, struct
> usb_request *req) 
>  	strsep(&cmd, ":");
>  	if (!cmd) {
> +		printf("%s: missing variable\n", __func__);

	It is up to you if you would consider changing printf() to
	error().

>  		fastboot_tx_write_str("FAILmissing var");
>  		return;
>  	}
> @@ -361,6 +363,7 @@ static void cb_getvar(struct usb_ep *ep, struct
> usb_request *req) else
>  			strcpy(response, "FAILValue not set");
>  	} else {
> +		printf("%s: unknown variable: %s\n", __func__, cmd);

	printf() -> error()

>  		strcpy(response, "FAILVariable not implemented");
>  	}
>  	fastboot_tx_write_str(response);
> @@ -534,10 +537,12 @@ static void rx_handler_command(struct usb_ep
> *ep, struct usb_request *req) }
>  	}
>  
> -	if (!func_cb)
> +	if (!func_cb) {
> +		printf("%s: unknown command: %s\n", __func__,
> cmdbuf); fastboot_tx_write_str("FAILunknown command");
> -	else
> +	} else {
>  		func_cb(ep, req);
> +	}
>  
>  	if (req->status == 0) {
>  		*cmdbuf = '\0';



-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH v5 4/4] usb/gadget: fastboot: implement sparse format
  2014-08-23 19:53 ` [U-Boot] [PATCH v5 4/4] usb/gadget: fastboot: implement sparse format Steve Rae
@ 2014-08-26 11:58   ` Lukasz Majewski
  0 siblings, 0 replies; 21+ messages in thread
From: Lukasz Majewski @ 2014-08-26 11:58 UTC (permalink / raw)
  To: u-boot

Hi Steve,

> - add capability to "fastboot flash" with sparse format images
> 
> Signed-off-by: Steve Rae <srae@broadcom.com>
> ---
> 
> Changes in v5:
> - use the common/aboot.c for the "sparse format" handling
> 
> Changes in v4:
> - rearranged "sparse format" support in this patchset, in order to
> isolate...
> 
> Changes in v3: None
> Changes in v2: None
> 
>  common/Makefile |  1 +
>  common/fb_mmc.c | 33 +++++++++++++++++++++++----------
>  2 files changed, 24 insertions(+), 10 deletions(-)
> 
> diff --git a/common/Makefile b/common/Makefile
> index daebe39..bc53078 100644
> --- a/common/Makefile
> +++ b/common/Makefile
> @@ -268,6 +268,7 @@ obj-y += stdio.o
>  
>  # This option is not just y/n - it can have a numeric value
>  ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
> +obj-y += aboot.o
>  obj-y += fb_mmc.o
>  endif
>  
> diff --git a/common/fb_mmc.c b/common/fb_mmc.c
> index e559e2a..c2e896f 100644
> --- a/common/fb_mmc.c
> +++ b/common/fb_mmc.c
> @@ -7,16 +7,24 @@
>  #include <common.h>
>  #include <fb_mmc.h>
>  #include <part.h>
> +#include <aboot.h>
> +#include <sparse_format.h>
>  
>  /* The 64 defined bytes plus the '\0' */
>  #define RESPONSE_LEN	(64 + 1)
>  
>  static char *response_str;
>  
> -static void fastboot_resp(const char *s)
> +void fastboot_fail(const char *s)
>  {
> -	strncpy(response_str, s, RESPONSE_LEN);
> -	response_str[RESPONSE_LEN - 1] = '\0';
> +	strncpy(response_str, "FAIL", 4);
> +	strncat(response_str, s, RESPONSE_LEN - 4 - 1);
> +}
> +
> +void fastboot_okay(const char *s)
> +{
> +	strncpy(response_str, "OKAY", 4);
> +	strncat(response_str, s, RESPONSE_LEN - 4 - 1);
>  }
>  
>  static void write_raw_image(block_dev_desc_t *dev_desc,
> disk_partition_t *info, @@ -33,7 +41,7 @@ static void
> write_raw_image(block_dev_desc_t *dev_desc, disk_partition_t *info,
> if (blkcnt > info->size) { printf("%s: too large for partition:
> '%s'\n", __func__, part_name);
> -		fastboot_resp("FAILtoo large for partition");
> +		fastboot_fail("too large for partition");
>  		return;
>  	}
>  
> @@ -44,13 +52,13 @@ static void write_raw_image(block_dev_desc_t
> *dev_desc, disk_partition_t *info, if (blks != blkcnt) {
>  		printf("%s: failed writing to device %d\n", __func__,
>  		       dev_desc->dev);
> -		fastboot_resp("FAILfailed writing to device");
> +		fastboot_fail("failed writing to device");
>  		return;
>  	}
>  
>  	printf("........ wrote " LBAFU " bytes to '%s'\n", blkcnt *
> info->blksz, part_name);
> -	fastboot_resp("OKAY");
> +	fastboot_okay("");
>  }
>  
>  void fb_mmc_flash_write(const char *cmd, void *download_buffer,
> @@ -66,17 +74,22 @@ void fb_mmc_flash_write(const char *cmd, void
> *download_buffer, dev_desc = get_dev("mmc",
> CONFIG_FASTBOOT_FLASH_MMC_DEV); if (!dev_desc || dev_desc->type ==
> DEV_TYPE_UNKNOWN) { printf("%s: invalid mmc device\n", __func__);
> -		fastboot_resp("FAILinvalid mmc device");
> +		fastboot_fail("invalid mmc device");
>  		return;
>  	}
>  
>  	ret = get_partition_info_efi_by_name(dev_desc, cmd, &info);
>  	if (ret) {
>  		printf("%s: cannot find partition: '%s'\n",
> __func__, cmd);
> -		fastboot_resp("FAILcannot find partition");
> +		fastboot_fail("cannot find partition");
>  		return;
>  	}
>  
> -	write_raw_image(dev_desc, &info, cmd, download_buffer,
> -			download_bytes);
> +	if (is_sparse_image(download_buffer)) {
> +		write_sparse_image(dev_desc, &info, cmd,
> download_buffer,
> +				   download_bytes);
> +	} else {
> +		write_raw_image(dev_desc, &info, cmd,
> download_buffer,
> +				download_bytes);
> +	}

In the above if parenthesis are not needed.

>  }

Despite of this,
Acked-by: Lukasz Majewski <l.majewski@samsung.com>

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH v5 0/4] Implement "fastboot flash" for eMMC
  2014-08-26  9:14     ` Lukasz Majewski
@ 2014-08-26 16:27       ` Steve Rae
  2014-08-27  7:04         ` Lukasz Majewski
  0 siblings, 1 reply; 21+ messages in thread
From: Steve Rae @ 2014-08-26 16:27 UTC (permalink / raw)
  To: u-boot



On 14-08-26 02:14 AM, Lukasz Majewski wrote:
> Hi Steve,
>
>>
>>
>> On 14-08-25 07:57 AM, Lukasz Majewski wrote:
>>> Hi Steve,
>>>
>>>> This series implements the "fastboot flash" command for eMMC
>>>> devices. It supports both raw and sparse images.
>>>>
>>>> NOTES:
>>>> - the support for the "fastboot flash" command is enabled with
>>>> CONFIG_FASTBOOT_FLASH
>>>> - the support for eMMC is enabled with
>>>> CONFIG_FASTBOOT_FLASH_MMC_DEV
>>>> - (future) the support for NAND would be enabled with
>>>> CONFIG_FASTBOOT_FLASH_NAND(???)
>>>>
>>>> This has been tested on ARMv7.
>>>>
>>>> ----
>>>>
>>>> This series depends on:
>>>>     http://patchwork.ozlabs.org/patch/379438/
>>>
>>> This patch is already applied.
>> Correct
>> (But it wasn't when I was preparing this....)
>>
>>>
>>>>     http://patchwork.ozlabs.org/patch/382443/ (to 382446)
>>>
>>> Could you resend the above patch series one more time?
>>>
>>>   From the links it seems that in PATCH 1/4 you add
>>> the ./common/aboot.c file and at PATCH 2/4 you remove it.
>>>
>>> Is this done on purpose?
>> yes: done on purpose (in order to see the history of the changes to
>> the file....) -- see the comments in the cover letter to that
>> patch-series!!!
>
> Ok, Now it is clear.
>
> Is fair as I know bsd-3L-clause license is compatible with GPL.
>
> However, to be 100% sure I'd like to ask Tom (as he has much more
> legal experience than me) to confirm that this code can be added to
> u-boot.
>
OK -- note that this "bsd-3L-clause" clause is almost identical to the 
existing "bsd-3-clause"....
Thanks, Steve
>>
>>>
>>> (I've also trimmed down the CC list).
>>>
>>>>
>>>> Changes in v5:
>>>> - use the common/aboot.c for the "sparse format" handling
>>>>
>>>> Changes in v4:
>>>> - rearranged this patchset so that "sparse_format.h" can be dropped
>>>> (if we cannot resolve the copyright/licensing issues)
>>>> - update mmc_get_dev(...) to get_dev("mmc",....)
>>>> - update printf() to puts() where applicable
>>>> - update debug string as per feedback
>>>> - rearranged "sparse format" support in this patchset, in order to
>>>> isolate...
>>>>
>>>> Changes in v3:
>>>> - remove most references to 'mmc',
>>>>     which leaves only one mmc specific function: mmc_get_dev()
>>>>
>>>> Changes in v2:
>>>> - split large function into three
>>>> - improved handling of response messages
>>>> - additional partition size checking when writing sparse image
>>>> - update README.android-fastboot file
>>>> - new in v2
>>>>
>>>> Steve Rae (4):
>>>>     usb/gadget: fastboot: add eMMC support for flash command
>>>>     usb/gadget: fastboot: add support for flash command
>>>>     usb/gadget: fastboot: minor cleanup
>>>>     usb/gadget: fastboot: implement sparse format
>>>>
>>>>    README                          | 10 +++++
>>>>    common/Makefile                 |  6 +++
>>>>    common/cmd_fastboot.c           |  7 +--
>>>>    common/fb_mmc.c                 | 95
>>>> +++++++++++++++++++++++++++++++++++++++++
>>>> doc/README.android-fastboot     |  5 ++-
>>>> drivers/usb/gadget/f_fastboot.c | 44 +++++++++++++++++--
>>>> include/fb_mmc.h                |  8 ++++ 7 files changed, 166
>>>> insertions(+), 9 deletions(-) create mode 100644 common/fb_mmc.c
>>>>    create mode 100644 include/fb_mmc.h
>>>>
>>>
>>>
>>>
>> Thanks, Steve
>
>
>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH v5 1/4] usb/gadget: fastboot: add eMMC support for flash command
  2014-08-26  9:41     ` Marek Vasut
@ 2014-08-26 18:54       ` Steve Rae
  0 siblings, 0 replies; 21+ messages in thread
From: Steve Rae @ 2014-08-26 18:54 UTC (permalink / raw)
  To: u-boot

Steve agrees!!!
-- I have fixed them this time, see "v6",
However, I have no issue with you cleaning up the minor issues....
THANKS, Steve

On 14-08-26 02:41 AM, Marek Vasut wrote:
> On Tuesday, August 26, 2014 at 11:28:43 AM, Lukasz Majewski wrote:
>> Hi Steve,
>>
>>> - add support for 'fastboot flash' command for eMMC devices
>>>
>>> Signed-off-by: Steve Rae <srae@broadcom.com>
>
> If those are only small things, I think we can fix them up ourselves before
> applying, no? Let's do just that if Steve agrees, no ?
>
> Best regards,
> Marek Vasut
>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH v5 0/4] Implement "fastboot flash" for eMMC
  2014-08-26 16:27       ` Steve Rae
@ 2014-08-27  7:04         ` Lukasz Majewski
  2014-08-28 13:24           ` Tom Rini
  0 siblings, 1 reply; 21+ messages in thread
From: Lukasz Majewski @ 2014-08-27  7:04 UTC (permalink / raw)
  To: u-boot

Hi Steve,

> 
> 
> On 14-08-26 02:14 AM, Lukasz Majewski wrote:
> > Hi Steve,
> >
> >>
> >>
> >> On 14-08-25 07:57 AM, Lukasz Majewski wrote:
> >>> Hi Steve,
> >>>
> >>>> This series implements the "fastboot flash" command for eMMC
> >>>> devices. It supports both raw and sparse images.
> >>>>
> >>>> NOTES:
> >>>> - the support for the "fastboot flash" command is enabled with
> >>>> CONFIG_FASTBOOT_FLASH
> >>>> - the support for eMMC is enabled with
> >>>> CONFIG_FASTBOOT_FLASH_MMC_DEV
> >>>> - (future) the support for NAND would be enabled with
> >>>> CONFIG_FASTBOOT_FLASH_NAND(???)
> >>>>
> >>>> This has been tested on ARMv7.
> >>>>
> >>>> ----
> >>>>
> >>>> This series depends on:
> >>>>     http://patchwork.ozlabs.org/patch/379438/
> >>>
> >>> This patch is already applied.
> >> Correct
> >> (But it wasn't when I was preparing this....)
> >>
> >>>
> >>>>     http://patchwork.ozlabs.org/patch/382443/ (to 382446)
> >>>
> >>> Could you resend the above patch series one more time?
> >>>
> >>>   From the links it seems that in PATCH 1/4 you add
> >>> the ./common/aboot.c file and at PATCH 2/4 you remove it.
> >>>
> >>> Is this done on purpose?
> >> yes: done on purpose (in order to see the history of the changes to
> >> the file....) -- see the comments in the cover letter to that
> >> patch-series!!!
> >
> > Ok, Now it is clear.
> >
> > Is fair as I know bsd-3L-clause license is compatible with GPL.
> >
> > However, to be 100% sure I'd like to ask Tom (as he has much more
> > legal experience than me) to confirm that this code can be added to
> > u-boot.
> >
> OK -- note that this "bsd-3L-clause" clause is almost identical to
> the existing "bsd-3-clause"....

Tom, could you give your opinion on this?

> Thanks, Steve
> >>
> >>>
> >>> (I've also trimmed down the CC list).
> >>>
> >>>>
> >>>> Changes in v5:
> >>>> - use the common/aboot.c for the "sparse format" handling
> >>>>
> >>>> Changes in v4:
> >>>> - rearranged this patchset so that "sparse_format.h" can be
> >>>> dropped (if we cannot resolve the copyright/licensing issues)
> >>>> - update mmc_get_dev(...) to get_dev("mmc",....)
> >>>> - update printf() to puts() where applicable
> >>>> - update debug string as per feedback
> >>>> - rearranged "sparse format" support in this patchset, in order
> >>>> to isolate...
> >>>>
> >>>> Changes in v3:
> >>>> - remove most references to 'mmc',
> >>>>     which leaves only one mmc specific function: mmc_get_dev()
> >>>>
> >>>> Changes in v2:
> >>>> - split large function into three
> >>>> - improved handling of response messages
> >>>> - additional partition size checking when writing sparse image
> >>>> - update README.android-fastboot file
> >>>> - new in v2
> >>>>
> >>>> Steve Rae (4):
> >>>>     usb/gadget: fastboot: add eMMC support for flash command
> >>>>     usb/gadget: fastboot: add support for flash command
> >>>>     usb/gadget: fastboot: minor cleanup
> >>>>     usb/gadget: fastboot: implement sparse format
> >>>>
> >>>>    README                          | 10 +++++
> >>>>    common/Makefile                 |  6 +++
> >>>>    common/cmd_fastboot.c           |  7 +--
> >>>>    common/fb_mmc.c                 | 95
> >>>> +++++++++++++++++++++++++++++++++++++++++
> >>>> doc/README.android-fastboot     |  5 ++-
> >>>> drivers/usb/gadget/f_fastboot.c | 44 +++++++++++++++++--
> >>>> include/fb_mmc.h                |  8 ++++ 7 files changed, 166
> >>>> insertions(+), 9 deletions(-) create mode 100644 common/fb_mmc.c
> >>>>    create mode 100644 include/fb_mmc.h
> >>>>
> >>>
> >>>
> >>>
> >> Thanks, Steve
> >
> >
> >



-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH v5 0/4] Implement "fastboot flash" for eMMC
  2014-08-27  7:04         ` Lukasz Majewski
@ 2014-08-28 13:24           ` Tom Rini
  2014-08-28 17:06             ` Steve Rae
  0 siblings, 1 reply; 21+ messages in thread
From: Tom Rini @ 2014-08-28 13:24 UTC (permalink / raw)
  To: u-boot

On Wed, Aug 27, 2014 at 09:04:09AM +0200, Lukasz Majewski wrote:
> Hi Steve,
> 
> > 
> > 
> > On 14-08-26 02:14 AM, Lukasz Majewski wrote:
> > > Hi Steve,
> > >
> > >>
> > >>
> > >> On 14-08-25 07:57 AM, Lukasz Majewski wrote:
> > >>> Hi Steve,
> > >>>
> > >>>> This series implements the "fastboot flash" command for eMMC
> > >>>> devices. It supports both raw and sparse images.
> > >>>>
> > >>>> NOTES:
> > >>>> - the support for the "fastboot flash" command is enabled with
> > >>>> CONFIG_FASTBOOT_FLASH
> > >>>> - the support for eMMC is enabled with
> > >>>> CONFIG_FASTBOOT_FLASH_MMC_DEV
> > >>>> - (future) the support for NAND would be enabled with
> > >>>> CONFIG_FASTBOOT_FLASH_NAND(???)
> > >>>>
> > >>>> This has been tested on ARMv7.
> > >>>>
> > >>>> ----
> > >>>>
> > >>>> This series depends on:
> > >>>>     http://patchwork.ozlabs.org/patch/379438/
> > >>>
> > >>> This patch is already applied.
> > >> Correct
> > >> (But it wasn't when I was preparing this....)
> > >>
> > >>>
> > >>>>     http://patchwork.ozlabs.org/patch/382443/ (to 382446)
> > >>>
> > >>> Could you resend the above patch series one more time?
> > >>>
> > >>>   From the links it seems that in PATCH 1/4 you add
> > >>> the ./common/aboot.c file and at PATCH 2/4 you remove it.
> > >>>
> > >>> Is this done on purpose?
> > >> yes: done on purpose (in order to see the history of the changes to
> > >> the file....) -- see the comments in the cover letter to that
> > >> patch-series!!!
> > >
> > > Ok, Now it is clear.
> > >
> > > Is fair as I know bsd-3L-clause license is compatible with GPL.
> > >
> > > However, to be 100% sure I'd like to ask Tom (as he has much more
> > > legal experience than me) to confirm that this code can be added to
> > > u-boot.
> > >
> > OK -- note that this "bsd-3L-clause" clause is almost identical to
> > the existing "bsd-3-clause"....
> 
> Tom, could you give your opinion on this?

So, upstream made a slight (and likely unintentional) change to the
normal BSD 3 clause license and changed the last clause from "the
copyright holders" to "The Linux Foundation".  I've poked our legal dept
about this but I suspect the best answer is to go back up to Android
folks and ask them to fix this quite likely unintentional change.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140828/0cd7bf76/attachment.pgp>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH v5 0/4] Implement "fastboot flash" for eMMC
  2014-08-28 13:24           ` Tom Rini
@ 2014-08-28 17:06             ` Steve Rae
  0 siblings, 0 replies; 21+ messages in thread
From: Steve Rae @ 2014-08-28 17:06 UTC (permalink / raw)
  To: u-boot



On 14-08-28 06:24 AM, Tom Rini wrote:
> On Wed, Aug 27, 2014 at 09:04:09AM +0200, Lukasz Majewski wrote:
>> Hi Steve,
>>
>>>
>>>
>>> On 14-08-26 02:14 AM, Lukasz Majewski wrote:
>>>> Hi Steve,
>>>>
>>>>>
>>>>>

>>>>> On 14-08-25 07:57 AM, Lukasz Majewski wrote:
[.. snip ...]

>>>>
>>>> Is fair as I know bsd-3L-clause license is compatible with GPL.
>>>>
>>>> However, to be 100% sure I'd like to ask Tom (as he has much more
>>>> legal experience than me) to confirm that this code can be added to
>>>> u-boot.
>>>>
>>> OK -- note that this "bsd-3L-clause" clause is almost identical to
>>> the existing "bsd-3-clause"....
>>
>> Tom, could you give your opinion on this?
>
> So, upstream made a slight (and likely unintentional) change to the
> normal BSD 3 clause license and changed the last clause from "the
> copyright holders" to "The Linux Foundation".  I've poked our legal dept
> about this but I suspect the best answer is to go back up to Android
> folks and ask them to fix this quite likely unintentional change.
>

Actually, there are three diffs, and I am thinking that they were 
intentional (especially the last one!):

$ diff bsd-3-clause.txt bsd-3L-clause.txt
5,6c5
<    notice, this list of conditions, and the following disclaimer,
<    without modification.
---
 >    notice, this list of conditions and the following disclaimer.
10,12c9,12
< 3. The names of the above-listed copyright holders may not be used
<    to endorse or promote products derived from this software without
<    specific prior written permission.
---
 > 3. Neither the name of The Linux Foundation nor
 >    the names of its contributors may be used to endorse or promote
 >    products derived from this software without specific prior written
 >    permission.
16,17c16,17
< THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
< PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
---
 > THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
PURPOSE AND
 > NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR

So, would U-Boot accept this BSD-3L-Clause, or should I contact Colin 
Cross to attempt to get a BSD-3-Clause version, or ????

Thanks, Steve

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2014-08-28 17:06 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-23 19:53 [U-Boot] [PATCH v5 0/4] Implement "fastboot flash" for eMMC Steve Rae
2014-08-23 19:53 ` [U-Boot] [PATCH v5 1/4] usb/gadget: fastboot: add eMMC support for flash command Steve Rae
2014-08-26  9:28   ` Lukasz Majewski
2014-08-26  9:41     ` Marek Vasut
2014-08-26 18:54       ` Steve Rae
2014-08-23 19:53 ` [U-Boot] [PATCH v5 2/4] usb/gadget: fastboot: add " Steve Rae
2014-08-26 11:53   ` Lukasz Majewski
2014-08-23 19:53 ` [U-Boot] [PATCH v5 3/4] usb/gadget: fastboot: minor cleanup Steve Rae
2014-08-26 11:55   ` Lukasz Majewski
2014-08-23 19:53 ` [U-Boot] [PATCH v5 4/4] usb/gadget: fastboot: implement sparse format Steve Rae
2014-08-26 11:58   ` Lukasz Majewski
2014-08-23 20:12 ` [U-Boot] [PATCH v5 0/4] Implement "fastboot flash" for eMMC Marek Vasut
2014-08-25  7:19   ` Lukasz Majewski
2014-08-25  7:52     ` Marek Vasut
2014-08-25 14:57 ` Lukasz Majewski
2014-08-25 17:10   ` Steve Rae
2014-08-26  9:14     ` Lukasz Majewski
2014-08-26 16:27       ` Steve Rae
2014-08-27  7:04         ` Lukasz Majewski
2014-08-28 13:24           ` Tom Rini
2014-08-28 17:06             ` Steve Rae

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.