Commit Graph

10 Commits

Author SHA1 Message Date
Sam Protsenko
cacb03e490 fastboot: Use const qualifier for char *part_name
In fastboot_*_get_part_info() functions we can use stronger typing by
expecting const strings.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
2019-06-14 12:39:54 +02:00
Alex Kiernan
f73a7df984 net: fastboot: Merge AOSP UDP fastboot
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 <alex.kiernan@gmail.com>
Signed-off-by: Alex Deymo <deymo@google.com>
Signed-off-by: Jocelyn Bohr <bohr@google.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2018-05-30 11:59:21 +02:00
Alex Kiernan
d1a119d4f0 fastboot: Rename public fb_ functions to fastboot_
Rename fb_mmc_flash_write/fb_mmc_erase/fb_nand_flash_write/fb_nand_erase to
fastboot_... as they form a public interface

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2018-05-30 11:59:21 +02:00
Alex Kiernan
c4ded03ef6 fastboot: Refactor fastboot_okay/fail to take response
Add the response string as a parameter to fastboot_okay/fail, instead
of modifying a global, to match the contract expected by the AOSP
U-Boot code.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2018-05-30 11:59:21 +02:00
Tom Rini
83d290c56f SPDX: Convert all of our single license tags to Linux Kernel style
When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from.  So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry.  Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents.  There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>
2018-05-07 09:34:12 -04:00
Steve Rae
9bc34799c8 fastboot: sparse: resync common/image-sparse.c (part 2)
- update fastboot_okay() and fastboot_fail()

This file originally came from upstream code.

While retaining the storage abstraction feature, this is the second
set of the changes required to resync with the
  cmd_flash_mmc_sparse_img()
in the file
  aboot.c
from
  https://us.codeaurora.org/cgit/quic/la/kernel/lk/plain/app/aboot/aboot.c?h=LE.BR.1.2.1

Signed-off-by: Steve Rae <srae@broadcom.com>
2016-06-27 16:37:38 -04:00
Steve Rae
64ece84854 fastboot: sparse: remove session-id logic
This "session-id" alogrithm is not required, and currently corrupts
the stored image whenever more the one "session" is required.

Signed-off-by: Steve Rae <srae@broadcom.com>
2016-06-27 16:36:33 -04:00
Maxime Ripard
6c9e00eebf fastboot: Implement flashing session counter
The fastboot flash command that writes an image to a partition works in
several steps:

1 - Retrieve the maximum size the device can download through the
    "max-download-size" variable

2 - Retrieve the partition type through the "partition-type:%s" variable,
    that indicates whether or not the partition needs to be erased (even
    though the fastboot client has minimal support for that)

3a - If the image is smaller than what the device can handle, send the image
     and flash it.

3b - If the image is larger than what the device can handle, create a
     sparse image, and split it in several chunks that would fit. Send the
     chunk, flash it, repeat until we have no more data to send.

However, in the 3b case, the subsequent transfers have no particular
identifiers, the protocol just assumes that you would resume the writes
where you left it.

While doing so works well, it also means that flashing two subsequent
images on the same partition (for example because the user made a mistake)
would not work withouth flashing another partition or rebooting the board,
which is not really intuitive.

Since we have always the same pattern, we can however maintain a counter
that will be reset every time the client will retrieve max-download-size,
and incremented after each buffer will be flashed, that will allow us to
tell whether we should simply resume the flashing where we were, or start
back at the beginning of the partition.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2015-11-12 13:17:32 -05:00
Dileep Katta
897923819c usb: gadget: fastboot: Add fastboot erase
Adds the fastboot erase functionality, to erase a partition
specified by name. The erase is performed based on erase group size,
to avoid erasing other partitions. The start address and the size
is aligned to the erase group size for this.

Currently only supports erasing from eMMC.

Signed-off-by: Dileep Katta <dileep.katta@linaro.org>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
2015-02-25 17:47:02 +01:00
Steve Rae
c0aebb3382 usb/gadget: fastboot: add eMMC support for flash command
- add support for 'fastboot flash' command for eMMC devices

Signed-off-by: Steve Rae <srae@broadcom.com>
2014-09-24 18:30:27 -04:00