Re: [U-Boot] [PATCH v8 15/18] net: fastboot: Merge AOSP UDP fastboot

2018-06-12 Thread Joe Hershberger
On Tue, May 29, 2018 at 10:30 AM, Alex Kiernan  wrote:
> Merge UDP fastboot support from AOSP:
>
>   
> https://android.googlesource.com/platform/external/u-boot/+/android-o-mr1-iot-preview-8
>
> Signed-off-by: Alex Kiernan 
> Signed-off-by: Alex Deymo 
> Signed-off-by: Jocelyn Bohr 
> Reviewed-by: Simon Glass 


Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v8 15/18] net: fastboot: Merge AOSP UDP fastboot

2018-05-29 Thread Alex Kiernan
Merge UDP fastboot support from AOSP:

  
https://android.googlesource.com/platform/external/u-boot/+/android-o-mr1-iot-preview-8

Signed-off-by: Alex Kiernan 
Signed-off-by: Alex Deymo 
Signed-off-by: Jocelyn Bohr 
Reviewed-by: Simon Glass 
---

Changes in v8: None
Changes in v7: None
Changes in v6:
- add docbook comments
- rename fastboot_download_data() to fastboot_data_download(), rename
  fastboot_get_bytes_remaining() to fastboot_data_remaining()
- split fastboot_data_complete() out from fastboot_data_download() so we
  can call it at the end of the transfer phase for USB

Changes in v5:
- make fastboot_bytes_received/expected static and add function
  fastboot_get_bytes_remaining()
- move fastboot_buf_addr/fastboot_buf_size/fastboot_progress_callback
  into fastboot-internal.h
- delete redundant fb_ prefixes from statics

Changes in v4:
- guard fb_getvar/fb_command with UDP_FUNCTION_FASTBOOT in Makefile
- add docbook comments
- remove parameter from fastboot_boot() since we always want
  fastboot_buf_addr (and if we're using fastboot_bootcmd then it's
  ignored)
- split oem format into new patch

Changes in v3:
- use FASTBOOT as our guard in Kconfig not a list of USB || UDP
- correct mis-translation from AOSP introduced when cleaning up for
  checkpatch - we should write when buffer is not NULL, rather than
  erasing, and erase when buffer is NULL
- use CMD_RET_USAGE from do_fastboot
- remove do_fastboot_udp from cmd/net.c and rewrite using net_loop()
- rename timed_send_info to fastboot_send_info, rename fastboot_send_info to
  fastboot_udp_send_info
- replace FASTBOOT_HEADER_SIZE with sizeof(struct fastboot_header)
- move start time into timed_send_info() rather than passing it in
- make calls to fastboot_udp_send_info a runtime dependency, not a compile
  time one
- set ${filesize} to size of downloaded image
- add progress meter from USB path during download
- add support for 'oem format' command from the USB path
- rename 'fastbootcmd' to 'fastboot_bootcmd' to make clear that this is the
  fastboot boot command
- make getvar implementation table driven
- add fastboot_buf_addr, fastboot_buf_size to override buffer address and
  size
- return correct filesystem type in getvar partition-type on MMC
- process "fastboot." prefixed env variables in getvar first so you
  can override the normal values (this also lets you set a fs type for
  NAND devices)
- squash subsequent patches which change this code into this one:
  - If the fastboot flash/erase commands are disabled, remove that support
so we still build correctly.
  - Add NAND support to fastboot UDP flash/erase commands
  - If we don't have a partition name passed, report it as not found.
  - Change the behaviour of the fastboot net code such that
"reboot-bootloader" is no longer written to CONFIG_FASTBOOT_BUF_ADDR for
use as a marker on reboot (the AOSP code in common/android-bootloader.c
uses this marker - this code could be reinstated there if that gets
merged).
  - Merge USB and UDP boot code. The USB implementation stays the same, but
UDP no longer passes an fdt. We introduce a new environment variable
'fastboot_bootcmd' which if set overrides the hardcoded boot command,
setting this then allows the UDP implementation to remain the same. If
after running 'fastboot_bootcmd' the board has not booted, control is
returned to U-Boot and the fastboot process ends.
  - Separate the fastboot protocol handling from the fastboot UDP code in
preparation for reusing it in the USB code.

Changes in v2:
- ensure fastboot syntax is backward compatible - 'fastboot 0' means
  'fastboot usb 0'

 cmd/Kconfig   |   4 +-
 cmd/fastboot.c|  91 +-
 drivers/fastboot/Kconfig  |   7 +
 drivers/fastboot/Makefile |   3 +-
 drivers/fastboot/fb_command.c | 302 
 drivers/fastboot/fb_common.c  |  93 ++
 drivers/fastboot/fb_getvar.c  | 230 
 drivers/fastboot/fb_mmc.c |  84 -
 drivers/fastboot/fb_nand.c|  19 +-
 include/fastboot-internal.h   |  36 
 include/fastboot.h| 104 +++
 include/fb_mmc.h  |  18 +-
 include/fb_nand.h |  19 +-
 include/net.h |   2 +-
 include/net/fastboot.h|  21 +++
 net/Makefile  |   1 +
 net/fastboot.c| 317 ++
 net/net.c |   7 +
 18 files changed, 1338 insertions(+), 20 deletions(-)
 create mode 100644 drivers/fastboot/fb_command.c
 create mode 100644 drivers/fastboot/fb_getvar.c
 create mode 100644 include/fastboot-internal.h
 create mode 100644 include/net/fastboot.h
 create mode 100644 net/fastboot.c

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 30cf63f172..17ca0bb267 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -655,8 +655,8 @@ config CMD_FASTBOOT
  This enables the command "fastboot" which enables the Android