Couldn't parse erase-block-size '0x'.
Couldn't parse logical-block-size '0x'.
mke2fs 1.43.3 (04-Sep-2016)
...
Some bootloaders explicitly return error on failed query (e.g. walleye),
while others return empty message (e.g. bullhead). We should just return
zero for empty message, instead of giving a misleading parsing error.
Test: `fastboot format userdata` on bullhead, with no parsing error.
Test: `fastboot format userdata` on walleye still works.
Change-Id: I194d41d24679929eccc65bfe895d6ab2a26315b7
Erase block sizes smaller than the ext4 block size may be valid, but
can incorrectly result in a stripe width smaller than the stride
size. Instead of reporting these sizes as invalid, add a check to
enforce that raid_stripe_width >= raid_stride.
Bug: 68770797
Test: Hack fb_getvar to report small erase block size, run fastboot
-w and confirm it does not print a warning or set stripe_width smaller
than stride.
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: I689ce4bdd5b38bd0952bb6de54785cca39176010
Previously fastboot would carry on regardless if decompression failed:
fastboot: archive does not contain 'vbmeta.img'
fastboot: extracting vendor.img (260 MB)...
fastboot: W/ziparchive(56777): Zip: unable to allocate 272781472 bytes at offset 0 : No space left on device
fastboot: failed to extract 'vendor.img': I/O error
fastboot: archive does not contain 'vendor_other.img'
fastboot: wiping userdata...
This is because all but "boot" and "system" are considered "optional",
and the implementation of "optional" was "ignore any failures". What it
_should_ have meant was "it's okay if these don't exist, but if they do,
failures matter".
Fix this logic, use die() more aggressively, and remove spurious "\n"s
from die() format strings.
Also fix spurious whitespace in the libziparchive format string. Before:
Zip: unable to allocate 272781472 bytes at offset 0 : No space left on device
After:
Zip: unable to allocate 272781472 bytes at offset 0: No space left on device
Bug: http://b/68383022
Test: `fastboot update` on marlin
Change-Id: I3cbf55f1a33ca125f293f873eafbcfb86c880ba8
we don't want to continue fastboot process if failed to
generate fs image. Print an error message and exit early.
Bug: 64915319
Change-Id: I5506d2a7a5063c188685633d6c3890239f9d658e
High Sierra restricts opening some USB devices (e.g. the touchbar)
to processes that have specific entitlements. Ignore devices that we
can't open.
Bug: http://b/64292422
Test: manual
Change-Id: I6074b53a365b8d936610bafea60244f8bba1a33f
This can be used to disable verity and/or verification when flashing a
build to a device. It works with both 'fastboot flashall' and
'fastboot flash vbmeta /path/to/vbmeta.img'.
Bug: 62903976
Test: Manually tested.
Change-Id: Iad22d42a9dd5befd70ecd0224803721a10a28d90
Set MKE2FS_CONFIG to empty to use mke2fs default configs
Test: fastboot --wipe-and-use-fbe
Bug: 35219933
Change-Id: Ibc97bb125899e1f1fe820d53709fdb2ab291c171
(cherry picked from commit d14d7c14cb)
mke2fs tool takes a filename and has its own open function to handle
output file. Change fastboot in preparation to switch from make_ext4
to mke2fs.
Test: fastboot format:ext4 userdata
Bug: 35219933
Change-Id: I7a31cb215f443a4a7cb0bfc23ec28c121a6101e6
Annoyingly folks parse the "adb --version" output so we have the
less-interesting protocol version first. But at least now we'll
have the "real" version somewhere...
Bug: N/A
Test: "adb --version"/"fastboot --version"
Change-Id: Ia85b561bd8d84c6fd6995923730d36f53b2f800b
Only show all the help if asked to, and have a few more descriptive
syntax errors.
Also show the help on stdout rather than stderr.
Bug: N/A
Test: manually ran "fastboot flash"/"fastboot update"/"fastboot flashall"
Change-Id: I59abd60e58a56fe7e44da5116a702087c36e14ce
This will let us see (a) whether the user has a legit build or something they
built themselves and (b) what Android release it corresponds to.
This isn't as useful as showing what Platform Tools release we correspond to,
but I'm planning on doing that as a separate line.
Bug: N/A
Test: adb --version ; fastboot --version
Change-Id: Idca489295e3c6f8571146f95822c08808e36b382
(cherry-picked from internal nyc-iot-dev to AOSP)
New user-level command usage:
* fastboot get_staged <outfile>
Reads staged data from the last command handled by the device. If the
last command did not result in staged data, this command will fail.
This enables data staged by OEM commands to be transferred from device
to host. get_staged wraps new device command "upload". Fastboot
clients are not required to support "upload", so get_staged won't
work on all devices.
Bug: 36002804
Test: Implemented "upload" in fastboot on imx6ul. Verified that uploading
~100K data from the device works.
Change-Id: I5b1a1ce023f362062505ee62746ea8ab6f36bfbf
(cherry-picked from commit 83a875de994bf48f0faa2a8a23ceb0b8f52b6b04)
(cherry-picked from internal nyc-iot-dev to AOSP)
New user-level command usage:
* fastboot stage <infile>
Sends the contents of <infile> to the device to stage for use in the
next command.
This enables OEM commands to use data downloaded from host to device.
Bug: 35811075
Test: Manual test on imx6ul
Change-Id: I483a18f9f4205d3289ee524656b9d741b16e9fe6
(cherry-picked from commit 001c75c6c0fe6a70a1db2a65253ab3c43ec17d46)
Adding methods to queue and download flashable images by fd instead of
by pointer, so that we can deal with sending large (up to 4GB) files
on windows and linux. This gets past limitations on linux to read
more than 2GB from a file at a time, as well as memory limitations
on win32, in order to download up to 4GB in a single transfer.
Test: fastboot -w
Test: "flash-all" from nexus factory images site (incl. fastboot -w update)
Test: fastboot flash with large and small image, large and small max-download-size
Test: Sanity check flashing on win32, darwin, linux.
Test: Sanity check 3GB image download (with 3GB max-download-size)
on win32, darwin, linux.
Bug: 36810152
Change-Id: I528d739d344eb080d59d721dadf3b3b34d4b375e
This is required for large (>INT_MAX) sparse limit reported by
the target.
Also, patch up return chains of "int" that need to deal with sizes
bigger than 2GB as well as return negative error codes.
Test: -S works with large max-download-size
Test: Flash 3GB system.img with max-download-size 2.5GB
Bug: 36810152
Change-Id: I562a50eabd706bd5b97c71a1aef07c1ffd1a2e5c
fastboot uses AdbWinUsbApi on Windows, let's keep it required.
Test: rm -rf out/host; mma fastboot and confirm AdbWinUsbApi is in out/
Bug: 36810152
Change-Id: Ica8b27cb1d0bca260f716dc61fdcea2ccc282623
Not sure how this code got missed when we moved everything else off
C string handling...
$ adb reboot bootloader
$ fastboot oem `perl -e 'print "x"x1024;'`
Before:
<crashes>
After:
error: Command length (1028) exceeds maximum size (64)
(The error says 1028 instead of 1024 because it includes the "oem ".)
Bug: http://b/36232671
Test: fastboot oem `perl -e 'print "x"x1024;'`
Change-Id: Ib4664e49222bd2b71be5aa3fe81f386d6073414f
The .clang-format files in the base, debuggerd, adb, libprocinfo, and
fastboot subdirectories each differ slightly from the top level
.clang-format-2 and .clang-format-4, but not in a substantially
meaningful way, as the source files in those directories have not been
re-formatted with clang-format. Therefore, let's reduce the
differences and use only the two top level clang-format files.
Secondly perform some small clean-up of the top level .clang-format
files. AllowShortBlocksOnASingleLine is already false in the Google
style, so it can be removed. AllowShortFunctionsOnASingleLine should
not change between the -2 and -4 versions, so leave it at the Google
default style in both, which is 'All'.
The diff stats for these changes are:
./base/
Old:
640 insertions(+), 531 deletions(-)
New:
563 insertions(+), 808 deletions(-)
./debuggerd/
Old:
910 insertions(+), 886 deletions(-)
New:
991 insertions(+), 1023 deletions(-)
./adb/
Old:
2623 insertions(+), 2886 deletions(-)
New:
2655 insertions(+), 3103 deletions(-)
./libprocinfo/
Old:
2 insertions(+), 1 deletion(-)
New:
4 insertions(+), 18 deletions(-)
./fastboot/
Old:
618 insertions(+), 743 deletions(-)
New:
726 insertions(+), 882 deletions(-)
./init/
Old:
1755 insertions(+), 1866 deletions(-)
New:
1715 insertions(+), 1952 deletions(-)
Test: Above clang-format stats
Change-Id: I3f7b8ab0660c8394c5008ba95ea15e70dd22b55b
If the bootloader provides erase-block-size and logical-block-size
getvar variables, then pass these to libext4_utils when building a new
userdata image. This info is used to tune stride and stripe-width.
Bug: 33243520
Test: Modify fb_getvar to return values for "erase-block-size" and
"logical-block-size" and check that fastboot -w sets userdata
parameters correctly.
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: Id48b7a3ebb9074983a4422a79a64dcb437c0f888
fastboot will try to set usb configuration on connected
usb devices. When it tries to change the usb configuration
on iBridge device on MBP 2016 model, it hangs, and frozen
the touchbar. Skip set usb configuration.
Bug: https://code.google.com/p/android/issues/detail?id=231129
Change-Id: Ib055fc0524d26092555fc135588fa362e70eeb39
Fix a crash when running "fastboot reboot bootloader"
Test: Manual run "fastboot reboot bootloader" and "fastboot reboot emergency"
Change-Id: I6d163a5b640afcae1dfa606f409e23ec5f499184
This now combines all the "libsparse" libraries into the same soong
target. A minor side-effect of this change is that the libsparse
static library depends on the libz shared library instead of the libz
static library. This minor change has no effect since targets using
the static libsparse library need to explicitly include either the
static libz or the shared one.
Bug: 34220783
Change-Id: I8f41586cf4c3336791cfa57ab4f5ae59a76d7ffa
The protocol doc states that calling `fastboot getvar` for an unknown
variable should return an empty OKAY message, but in reality modern
devices return a FAIL response in this case (tested with marlin and
shamu).
Additionally, some A/B logic in fastboot expects a FAIL response for
unknown variables in order to function properly.
This CL changes the documentation to match reality.
Bug: http://b/33756193
Test: none
Change-Id: I41f7c80585be73e60ca0ac216787596c4d60a1d5
Legacy A/B implementations use _a and _b slot names, but currently the
set_active command is unconditionally stripping the _ prefix. This CL
adds some code to add the _ back in if connected to a legacy A/B
implementation.
This isn't a complete fix (there are other places in the code that also
unconditionally strip the prefix) but is sufficient for Android Things
use case, and we want to keep this change as small and safe as possible
to avoid breaking anything else.
Bug: http://b/32996227
Test: `fastboot set_active _a` and `fastboot set_active a` works on
both AndroidThings Edison board and Marlin.
Test: AndroidThings Edison flashall script now completes successfully.
Change-Id: I1a07e48b9e2726f386e9ece5267a9f1d8edefe22