Commit graph

360 commits

Author SHA1 Message Date
David Pursell
c742a7f174 fastboot: add Socket timeout detection.
UDP fastboot will require re-transmission in the case of datagrams
getting lost. This CL adds Socket functionality to easily distinguish
between a normal timeout and a socket failure.

I also found some Windows docs that indicate sockets may become
invalid after a call to recv() times out. This has never occurred in
my testing, but to be safe this switches the timeout implementation
to use select() instead of SO_RCVTIMEO.

Bug: http://b/26154914
Change-Id: Id7b598f8aea5df1a3676d24702b489042d5f9e3a
2016-02-05 13:22:06 -08:00
Elliott Hughes
a8c7e98123 Merge "Fix the version number in the fastboot documentation." am: 80e88a1274
am: 0f242b2dbf

* commit '0f242b2dbfd076fb1a23e6d5f80e317e8afc0a50':
  Fix the version number in the fastboot documentation.
2016-02-03 23:20:23 +00:00
Elliott Hughes
d505cd8db2 Fix the version number in the fastboot documentation.
Bug: https://code.google.com/p/android/issues/detail?id=65414
Change-Id: Ia52101f7c8d59e79583fd9658e001648ff545c66
2016-02-03 14:30:01 -08:00
David Pursell
bafd9f7e63 Merge "fastboot: add TCP protocol." am: 80dc9d8584
am: 6e2adac0c7

* commit '6e2adac0c76b6485ad7eda85f731bfb3f132658a':
  fastboot: add TCP protocol.
2016-02-03 22:07:22 +00:00
David Pursell
2ec418a4c9 fastboot: add TCP protocol.
This CL implements a TCP protocol for use with fastboot. Protocol
description is given in fastboot_protocol.txt, some examples of
expected behavior can also be found in tcp_test.cpp.

Usage is:
  fastboot -s tcp:<hostname>[:port] <command>

Bug: http://b/26558551
Change-Id: If53a514a534489c617db32c4fea8819949121282
2016-02-03 13:57:45 -08:00
David Pursell
dfc0a5d840 Merge "fastboot: fix SocketMock send failures." am: e54ea1c12d
am: 91b4e68738

* commit '91b4e687388e9e90714412d09dd521593f03ef80':
  fastboot: fix SocketMock send failures.
2016-02-03 19:00:18 +00:00
David Pursell
2c094f7983 fastboot: fix SocketMock send failures.
Fixes SocketMock::ExpectSendFailure() to allow unit testing of errors
during send, and adds tests for ExpectSendFailure() and
AddReceiveFailure().

Also adds missing tests to make sure ReceiveAll() continues to read
until failure or all bytes have been read.

Bug: http://b/26157893
Change-Id: I67e7d6de8e8ec4a3b62a6b7d7217f7530862edf7
2016-02-03 10:43:01 -08:00
David Pursell
f722c253e6 Merge "libcutils/fastboot: improve multi-buffer write." am: f6f800ef3c
am: ef0e01c346

* commit 'ef0e01c346b2f60b1941bf3335906de5996785d8':
  libcutils/fastboot: improve multi-buffer write.
2016-02-03 18:13:02 +00:00
David Pursell
b34e4a06ee libcutils/fastboot: improve multi-buffer write.
Fixes libcutils multi-buffer write interface to be more friendly and
hooks into it from the fastboot Socket class.

Bug: http://b/26558551
Change-Id: Ibb3a8428fc379755602de52722c1260f9e345bc0
2016-02-03 10:01:38 -08:00
David Pursell
4659c63114 Merge "fastboot: socket testing improvements." am: f971b6a24b
am: fe12d889e4

* commit 'fe12d889e41b688a84b4727126fde66011ca0ae6':
  fastboot: socket testing improvements.
2016-02-02 19:44:03 +00:00
David Pursell
c3a466960f fastboot: socket testing improvements.
(This code was originally part of a huge fastboot CL but has been split
out to try to make the CLs a little more manageable).

More prep for fastboot TCP and UDP implementations. This CL adds a
SocketMock class that makes it easy to mock out network behavior so we
can unit test the TCP and UDP protocols.

Also uses the new libcutils socket_get_local_port() to avoid hardcoding
a server port in unit tests.

Bug: http://b/26157893.
Change-Id: I1ba10f31e98d7349313fc15f240383d63378a8db
2016-02-02 11:29:10 -08:00
David Pursell
f6012df68d Merge "fastboot: use cutils socket functions." am: bbedd9523f
am: f0bfaf9503

* commit 'f0bfaf95038241c3f8ed65099c7d532a6c112e86':
  fastboot: use cutils socket functions.
2016-01-22 18:46:54 +00:00
David Pursell
572bce2908 fastboot: use cutils socket functions.
Now that cutils has cross-platform socket functionality, we can
restructure fastboot to remove platform-dependent networking code.

This CL adds socket_set_receive_timeout() to libcutils and combines the
fastboot socket code into a single implementation. It also adds TCP
functionality to fastboot sockets, but nothing uses it yet except for
the unit tests. A future CL will add the TCP protocol which will use
this TCP socket implementation.

Bug: http://b/26558551

Change-Id: If613fb348f9332b31fa2c88d67fb1e839923768a
2016-01-21 09:53:11 -08:00
David Pursell
cb56fb4b15 Merge "libcutils: share Windows networking code." am: 1906de1e0f
am: 7a568dbdd6

* commit '7a568dbdd6c1a39a90c01ab89092cb67a9a86198':
  libcutils: share Windows networking code.
2016-01-21 17:03:45 +00:00
David Pursell
1906de1e0f Merge "libcutils: share Windows networking code." 2016-01-21 16:40:00 +00:00
Josh Gao
08550d5cc9 Merge "fastboot: show progress when sending sparse images." am: 6a27196516
am: 69c9274c3e

* commit '69c9274c3ea023a7d3505592fab99f87144a61dd':
  fastboot: show progress when sending sparse images.
2016-01-19 23:08:28 +00:00
Josh Gao
163b83d01c Merge "fastboot: add .clang-format." am: d8ecde09c7
am: 5210031f9c

* commit '5210031f9c9873bbeca5f63af1ec22620590d2c1':
  fastboot: add .clang-format.
2016-01-19 23:06:32 +00:00
Josh Gao
9da9ac5b2a fastboot: show progress when sending sparse images.
Bug: http://b/25443220
Change-Id: Ica0c88aea2a0661f39ff1415ebba464c037651da
2016-01-19 14:50:18 -08:00
Josh Gao
cb73db7cd8 fastboot: add .clang-format.
Change-Id: Iacad00adfa3948118543d680651814b3c8c42858
2016-01-19 14:49:45 -08:00
David Pursell
0eb8e1b706 libcutils: share Windows networking code.
This CL moves Windows networking code from fastboot to libcutils so
that it can be shared with other host programs such as adb.

Not all libcutils networking functions have been implemented for
Windows, just those necessary for fastboot. In the next CL I will do
the same for adb, adding any additional required functions.

Unit tests have also been added to test the functions using a loopback
connection.

Bug: http://b/26236380.
Change-Id: Ibc51a67030fe69a04c23512eefa9d19b055c7c12
2016-01-15 15:57:35 -08:00
Daniel Rosenberg
ba3e38f9e1 Merge "fastboot: Add "--slot other"" am: 6bb8f752ec
am: abf108f6b2

* commit 'abf108f6b2cbcc4aaf7cea9719aff8b569245d60':
  fastboot: Add "--slot other"
2016-01-06 20:56:13 +00:00
Daniel Rosenberg
ed60d0706e Merge "fastboot: correct set_active behavior" am: 275d091441
am: f88b8cbe15

* commit 'f88b8cbe157b4372d4f1277e85ed25315ecd6c30':
  fastboot: correct set_active behavior
2016-01-06 19:49:25 +00:00
Daniel Rosenberg
c1743ba0d4 fastboot: Add "--slot other"
This allows you to flash to a slot other than the current one
without needing to enter the name of the slots.

Change-Id: I6bf8c29817be0a29b1abb005f1e72056cee126df
2016-01-06 19:42:01 +00:00
Daniel Rosenberg
15174d9bc7 fastboot: correct set_active behavior
Removed automatic reboot attached to set_active,
and fixed documentation error.

Change-Id: Idbb1639dc80870c17a6622dc78a7d78c88e268ab
2016-01-05 19:35:54 -08:00
David Pursell
e19a7980b8 Merge "fastboot: implement UDP networking interface." am: b6dfab03b6
am: 9526f21b56

* commit '9526f21b563c13836c75c33495b52d0f6ebc44ce':
  fastboot: implement UDP networking interface.
2015-12-17 00:42:27 +00:00
David Pursell
815c7beae7 fastboot: implement UDP networking interface.
This CL creates a UdpSocket class that provides a simple unified
interface to send and receive UDP packets for all platforms. Nothing
uses this interface yet except for tests.

The eventual goal is to implement a UDP protocol for fastboot, but it
makes the code much simpler and more modular if we handle the low-level
networking here independently of our custom fastboot protocol.

Some of the Windows code is similar to adb. I'd like to create a
library to hold the common functionality, but it is going to be a
little delicate to separate out the features unique to adb (e.g. the
custom file descriptor system), and I don't want to risk breaking
something in adb before the holiday break, so I'm hoping to get this in
for now and merge them early next year.

Tests are included in this CL to exercise this functionality using a
loopback connection.

Bug: http://b/26154763.
Tests: `fastboot_test` loopback tests on Linux, Mac, and Windows 7.
Change-Id: I81d1b7ace8d864246b99f6c80b8e29f64b8aa375
2015-12-16 16:16:08 -08:00
Elliott Hughes
2e83684537 Merge "Share the new adb USB diagnostic code with fastboot." am: efd8c3289e
am: 40f80e25d3

* commit '40f80e25d3f399ece26d5f1ac145921ccb7f5f80':
  Share the new adb USB diagnostic code with fastboot.
2015-12-14 12:47:44 -08:00
Elliott Hughes
1b708d368f Share the new adb USB diagnostic code with fastboot.
Bug: http://b/26134129
Change-Id: Ieaf0651c7b3f8a028760982091ec63a21a5484ba
2015-12-14 10:50:21 -08:00
Elliott Hughes
f65569d497 Merge "Remove fastboot/genkey.sh." am: 796ea6a65d
am: 54a584d722

* commit '54a584d72233c107f58863c659a011f65d4074fb':
  Remove fastboot/genkey.sh.
2015-12-13 13:19:26 -08:00
Elliott Hughes
44b6aefeeb Remove fastboot/genkey.sh.
Some unknown cruft from the pre-cupcake era.

Change-Id: I8964892419cda9781d1506aa7006c51dc00ca33d
2015-12-11 17:57:53 -08:00
Daniel Rosenberg
589500fe2e resolve merge conflicts of b940309ec7 to master.
Change-Id: Icd6daa7385b8cd8c19f52dbc6805142e81b93dc9
2015-12-09 17:58:00 -08:00
Daniel Rosenberg
98a8257313 Merge "fastboot: Re-add set_active as a command." 2015-12-10 00:54:01 +00:00
Elliott Hughes
ef119a14b8 Merge "Track rename of base/ to android-base/." am: 912ed3d8ca am: e2a9563be1
am: 3608ee5e90

* commit '3608ee5e903689ea7c433587be664649689816e1':
  Track rename of base/ to android-base/.
2015-12-07 23:59:44 +00:00
Daniel Rosenberg
9b432054dc fastboot: Re-add set_active as a command.
It turns out that adding a -- allows suffixes
starting with - to work fine, and there are
edge cases where calling set_active twice in
a command is useful, so the command version
has been re-added.

Change-Id: I528c258bf23ade61db530eb27586c1a1721896bc
2015-12-07 13:42:48 -08:00
Elliott Hughes
4f71319df0 Track rename of base/ to android-base/.
Change-Id: Idf9444fece4aa89c93e15640de59a91f6e758ccf
2015-12-04 22:00:26 -08:00
Paul Crowley
8f7f56e25b Add --wipe-and-use-fbe option to fastboot for FBE userdata marker.
With this option, userdata is wiped and recreated with the
"convert_fbe" file in the root, which triggers conversion to FBE.

Bug: 25898323
Change-Id: I9347b7057b6278e7e6437504896b22c82dd01d89
2015-12-03 18:02:25 +00:00
David Pursell
0b15663830 fastboot: create Transport object (take 2).
(Second upload of this CL; original upload had the wrong version of
usb_windows.cpp that caused a compilation error. Fixed error and
re-tested.)

This CL creates a Transport object to provide a generic interface for
various transports. Specifically this is designed to be able to add UDP
support to fastboot in an upcoming CL without changing the main program
logic.

Also includes some minor code style fixes and replaces malloc/free
in the USB implementation files with smart pointers and std::string.

Bug: http://b/22029765
Change-Id: I1175bbce08690fbd15f51e68166be9b3e9973ea0
2015-11-16 09:31:07 -08:00
David Pursell
44c58471e4 Merge "Revert "fastboot: create Transport object."" 2015-11-14 00:18:43 +00:00
David Pursell
c0504e1873 Revert "fastboot: create Transport object."
This broke some stuff, will look into it Monday.

This reverts commit 6f233a7799.

Change-Id: I155bc85d21fda3b0ba1e5e17839059797fb15509
2015-11-14 00:15:57 +00:00
David Pursell
f131772a79 Merge "fastboot: create Transport object." 2015-11-13 22:49:08 +00:00
Daniel Rosenberg
996ecd8b7d Fix fastboot to not add '-' before suffix
Change-Id: I9351b385412151498f47ab46a2620f21b9ac38b8
2015-11-13 12:56:19 -08:00
David Pursell
6f233a7799 fastboot: create Transport object.
This CL creates a Transport object to provide a generic interface for
various transports. Specifically this is designed to be able to add UDP
support to fastboot in an upcoming CL without changing the main program
logic.

Also includes some minor code style fixes and replaces malloc/free
in the USB implementation files with smart pointers and std::string.

Bug: http://b/22029765
Change-Id: I68641af0da7d13db4647f5e20a18d04d67f0b327
2015-11-13 11:08:17 -08:00
Daniel Rosenberg
8336a96c9c Merge changes I8fb6b513,I6dd16245,I0c2753e2
* changes:
  Update fastboot help command with long options
  Changed set_active to be a flag
  Fix fastboot variable name
2015-11-12 23:22:00 +00:00
Elliott Hughes
a2db2618ec Cope with angler's whitespace-padded partition size reporting.
Before:

  $ fastboot -w
  wiping userdata...
  Couldn't parse partition size '0x        0x66257ee00'.
  wiping cache...
  Couldn't parse partition size '0x        0x6400000'.
  erasing 'userdata'...

Bug: http://b/25653580
Change-Id: I301b8410689c1e52681796c240a149d270360edf
2015-11-12 07:28:39 -08:00
Daniel Rosenberg
7aa38bc54c Update fastboot help command with long options
Change-Id: I8fb6b5139f81893b324202d4c68f29393213ee6f
2015-11-11 20:27:56 -08:00
Daniel Rosenberg
0d08856416 Changed set_active to be a flag
set_active must be able to accept flag like arguments

Change-Id: I6dd162453835d2d64fd8d877f2a7b98e8dd8a907
2015-11-11 20:27:50 -08:00
Daniel Rosenberg
a797479bd5 Fix fastboot variable name
Change-Id: I0c2753e2b79d715f227ee314c071ce68d91779b3
2015-11-11 20:27:43 -08:00
Elliott Hughes
c1fd492ac5 Revert "Revert "adb/base: fix adb push of Unicode filenames on Win32""
This reverts commit cc8cd59456.

With the dependency on libcutils (for gettid for non-bionic) removed,
this no longer breaks the build.

Change-Id: I645bd6876e2502ddc1535b69af1e645c0df9d178
2015-11-11 18:23:00 -08:00
Elliott Hughes
cc8cd59456 Revert "adb/base: fix adb push of Unicode filenames on Win32"
This reverts commit ac9514a452.

The new gettid dependency caused other breakage.

Change-Id: I74a75e40c30a45beb275f9dd38eb5c7beac15fbd
2015-11-11 18:01:12 +00:00
Spencer Low
ac9514a452 adb/base: fix adb push of Unicode filenames on Win32
ae5a6c06cd made adb push use
android::base::ReadFileToString() for small files, but that API did not
support UTF-8 filenames on Windows, until this fix which does the
following:

- Add android::base::{WideToUTF8,UTF8ToWide}() which are only available
  on Windows. The signatures are based on Chromium's APIs of the same
  name.

- Add the namespace android::base::utf8 which has versions of APIs that
  take UTF-8 strings. To use this, make sure your code is in a namespace
  and then do "using namespace android::base::utf8;". On Windows, this will
  make calls to open() call android::base::utf8::open(), and on other
  platforms, it will just call the regular ::open().

- Make ReadFileToString() and WriteStringToFile() use utf8::open() and
  utf8::unlink().

- Adapt unittests from Chromium.

- fastboot needs to link with libcutils because it links with libbase
  which depends on libcutils for gettid() for logging.

Change-Id: I1aeac40ff358331d7a1ff457ce894bfb17863904
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2015-11-10 15:48:54 -08:00
Daniel Rosenberg
f8e70a3a60 Merge "Fastboot changes to support A/B partitioning" 2015-11-06 03:43:49 +00:00
Daniel Rosenberg
b7bd4ae529 Fastboot changes to support A/B partitioning
Introduce support for -slot option for specifying slots,
and set_active, for changing the current slot.
Change-Id: Ib3b2a75491c0d0413534dd0c1d7bcb52555bba66
2015-11-05 18:07:46 -08:00
Elliott Hughes
4ca547be67 Merge "Fix fastboot to cope with hammerhead\'s implicit hex."
am: 2b7b3bd100

* commit '2b7b3bd100747fb7a02f1d8c7c2e8a5ee6cdc82f':
  Fix fastboot to cope with hammerhead's implicit hex.
2015-11-03 16:55:42 +00:00
Elliott Hughes
2030bac88b Fix fastboot to cope with hammerhead's implicit hex.
Before:

  wiping userdata...
  Couldn't parse partition size '3321fa800'.
  wiping cache...
  Couldn't parse partition size '2bc00000'.

Groan. So much variation between bootloaders. I wish we had a reference
bootloader like ChromeOS does.

I've also removed a harmless warning:

  couldn't parse max-download-size ''

Change-Id: Ia1099d2f87000ebb96622ad9171819a1326fa249
2015-11-03 08:20:30 -08:00
Elliott Hughes
d09dc85d63 Merge "Work around an angler bootloader bug."
am: 9eab787560

* commit '9eab7875602dec9910002f080df513077f56a2dd':
  Work around an angler bootloader bug.
2015-11-03 00:07:18 +00:00
Elliott Hughes
77c0e66bef Work around an angler bootloader bug.
It's probably not the only device whose bootloader is similarly broken.
NVIDIA did a sufficiently good job with Nexus 9 that it's almost a bad
idea for me to do most of my development there...

Change-Id: I71436cc5c33023be077ca77f6dad5dbe75b11b09
2015-11-02 15:51:12 -08:00
Elliott Hughes
a2a6b0bfa9 Merge "Clarify and fix the intent of the partition-type checking code."
am: d0f45aa24c

* commit 'd0f45aa24c09c0802784263fe2dccd38e226e23a':
  Clarify and fix the intent of the partition-type checking code.
2015-11-02 23:47:39 +00:00
Elliott Hughes
8ab9a32323 Clarify and fix the intent of the partition-type checking code.
Change-Id: I202dab4ee91208b632bc2086d1e5c387a4c29edd
2015-11-02 14:05:57 -08:00
Elliott Hughes
1de89478ac Merge "Fix ParseInt/ParseUint to handle explicit "0x" hex."
am: ddf5edacc2

* commit 'ddf5edacc24125730b537265f69a081b19606246':
  Fix ParseInt/ParseUint to handle explicit "0x" hex.
2015-11-02 18:30:59 +00:00
Elliott Hughes
3ab05869d8 Fix ParseInt/ParseUint to handle explicit "0x" hex.
Also improve fastboot error reporting around max-download-size.

Change-Id: Ic3aec9460de01e5264a2803a0a6be3706d73026b
2015-11-02 09:01:53 -08:00
Elliott Hughes
5e58724b33 Merge "fastboot shouldn\'t erase non-existent cache partitions."
am: 9ebdf72a54

* commit '9ebdf72a5465b75ab4ce359e11c1ff6c2f3e376a':
  fastboot shouldn't erase non-existent cache partitions.
2015-10-30 21:42:04 +00:00
Elliott Hughes
2fd45a9cea fastboot shouldn't erase non-existent cache partitions.
Check that the cache partition exists before trying to erase it.

Also clean up some of the C string handling and int booleans.

Bug: http://b/25375777
Change-Id: I1880e542b729f2026ab3a2943d4bee9d659b1eeb
2015-10-30 14:15:22 -07:00
Elliott Hughes
259ad4a8e7 Fix the fastboot build.
load_file takes an int64_t rather than a size_t to support large files on LP32.

Change-Id: I8d3032cab63c30c4158dbc521d3d520415cdf58f
2015-09-02 20:33:44 -07:00
Elliott Hughes
45be42e89e resolved conflicts for merge of 7af48652 to mnc-dr-dev-plus-aosp
Change-Id: Icde642757a1335da49d2f884de33b368888ae709
2015-09-02 20:15:48 -07:00
Dan Willemsen
87a419c8b1 Remove USE_MINGW/CYGWIN; Whitelist windows modules
CYGWIN is not supported, USE_MINGW and HOST_OS==windows are being
replaced with LOCAL_..._windows variables.

Bug: 23566667
Change-Id: I3e4a1e4097dc994cf5abdce6939e83a91758fd75
2015-09-02 17:10:35 -07:00
Patrick Tjin
51e8b03f84 fastboot: add flashing bootloader commands
add the following commands:
    flashing unlock_bootloader
    flashing lock_bootloader
    flashing get_unlock_bootloader_nonce

Change-Id: Ia4f56ebdcb6785a5196cc669d68da1553ed53c58
Signed-off-by: Patrick Tjin <pattjin@google.com>
2015-09-01 12:40:12 -07:00
Elliott Hughes
3ab8b859c2 Fix missing <stdarg.h>.
system/core/fastboot/engine.cpp:84:5: error: use of undeclared identifier 'va_start'

Change-Id: I8aff9a40d33f403c0d0d91a15638863fe24dca2e
2015-08-25 19:34:13 -07:00
Elliott Hughes
fc79767fc2 Use 64-bit file sizes in fastboot.
Bug: 20110580
Change-Id: I5d3718103ff581ff3b5241c8b0e52b585b4f37e5
2015-08-25 19:11:52 -07:00
Elliott Hughes
b46964f3c9 fastboot should say which device it's waiting for.
Change-Id: Ia8a04b2727983cb05a9a3e85d9a9586b15c71600
2015-08-19 17:49:45 -07:00
Matt Reimer
81c24f6f86 Get fastboot working on OS X
Get fastboot working on OS X by calling USBDeviceOpen() before
calling SetConfiguration().

Change-Id: I5034721d5f33ef18273153ff40eb940baa8261cd
2015-08-19 14:46:17 -07:00
Elliott Hughes
2d4f852da4 Start iterating USB pipe endpoints from 1.
Bug: http://b/22829602
Change-Id: I5051880730ba8fadae5d78f1d19b5d527610d4a5
2015-08-13 16:00:12 -07:00
Elliott Hughes
e1746fda6a Remove the USB vendor id whitelist from fastboot.
Change-Id: I661a0538776d4ba74fcee37e2964d987eb861342
2015-08-10 15:30:54 -07:00
Elliott Hughes
2ae8d2ebae More Mac fastboot failure debugging.
Bug: http://b/22829602
Change-Id: I27738883eb545ed72eaae55fe3a077e6d1421302
2015-08-07 10:49:36 -07:00
Elliott Hughes
6e02c24cfc Include the error code if GetPipeProperties fails.
Bug: http://b/22829602
Change-Id: I90a89e70518053a4581e1862a7dbd5d09e06dadc
2015-08-06 10:48:19 -07:00
Elliott Hughes
93f65faee8 Document the current MAX_USBFS_BULK_SIZE situation.
Bug: http://b/22688598
Change-Id: I8e5b92996d635f6b939f3add4dda0b9023629a8b
2015-07-28 14:18:50 -07:00
Yusuke Sato
07447544ad Rename ZipEntryName to ZipString
since the struct is now used for other purposes. Also add some
comparator functions to the struct to simplify zip_archive.cc.

This is a follow-up CL for f1d3d3b247.

Bug: 21957428
Change-Id: I60d4171eeacc561d59226d946e9eb5f9c96d80cf
2015-06-26 10:34:01 -07:00
Elliott Hughes
fbcb93abe2 Fix Mac fastboot build.
Change-Id: I516c07cee39845caaa47608604eeb30ce15f06cb
2015-06-24 13:28:24 -07:00
Elliott Hughes
75d47421d0 Merge "Move fastboot's Windows code to C++." 2015-06-24 19:30:58 +00:00
Elliott Hughes
20750ad823 Move fastboot's Mac OS code to C++.
Change-Id: I4f452860a401a115b6e8349237923949f2f476d1
2015-06-24 11:17:28 -07:00
Elliott Hughes
c636b64e31 Move fastboot's Windows code to C++.
Change-Id: I92414594cbdbc1896402c6d950d890042f8df6cf
2015-06-24 10:48:43 -07:00
Elliott Hughes
b3748de33f Move fastboot to C++.
Minimal conversion.

Change-Id: I32cbf125be481a8757720d10fa303c38a7fd5e38
2015-06-23 20:56:01 -07:00
Elliott Hughes
08df533e2a Fix fastboot --help formatting.
Bug: http://b/21755417
Change-Id: I827d8e9ebe7ba8e8f75c2fa0ca975560817c18fa
2015-06-10 12:10:00 -07:00
Elliott Hughes
8bdd4bbc1c Add a working Windows tmpfile(3) to fastboot.
Windows' tmpfile(3) implementation requires administrator rights because
it creates temporary files in the root directory. Write an alternative
that uses the user's temporary directory instead.

Bug: http://b/21558406
Change-Id: Ic9aece5c69429797a332a97681a76b76ac3551bf
(cherry picked from commit a26fbeeaa4)
2015-06-05 13:28:44 -07:00
Elliott Hughes
966339b2d6 Don't say "update package missing" unless we mean it.
unzip_to_file reports failures itself these days, so there's it's unhelpful
of the caller to just guess what might have gone wrong.

Bug: http://b/21558406
Change-Id: I1e3d06c6cf902b8c6ef333dc60fd8f49680a493b
(cherry picked from commit acdbe92c60)
2015-06-04 13:26:57 -07:00
Elliott Hughes
c688c23286 'usb' doesn't need to be global in fastboot.
Bug: http://b/21558406
Change-Id: Id014399640865d889918661bae0161b3165eee48
(cherry picked from commit c0ce65f961)
2015-06-04 13:26:48 -07:00
Elliott Hughes
e283ca29c5 Add "fastboot --version".
So bug reporters can actually tell us what they're running.

Bug: http://b/21558406
Bug: http://b/21583225
Change-Id: If2a4ae97b4792aa321566603ce2c354a72d32307
(cherry picked from commit 379646b2ca)
2015-06-04 13:26:40 -07:00
Narayan Kamath
67ab5d9505 Use base::WriteFully in zip_archive.
We're already linking against libbase but we'll have to add
a libbase dependency to every target that includes libziparchive
as a STATIC_LIBRARY dependency, given that there's no way to
express that what we want (except by adding a LOCAL_WHOLE_STATIC_LIBRARY
dependency on libbase to libziparchive but that seems bad too)

Bug: http://b/21558406
Change-Id: I294ad389a9c61a1134a7bc323da25b0004a8f1e0
(cherry picked from commit e97e66ea7c)
2015-06-04 13:26:22 -07:00
Elliott Hughes
a26fbeeaa4 Add a working Windows tmpfile(3) to fastboot.
Windows' tmpfile(3) implementation requires administrator rights because
it creates temporary files in the root directory. Write an alternative
that uses the user's temporary directory instead.

Bug: http://b/21558406
Change-Id: Ic9aece5c69429797a332a97681a76b76ac3551bf
2015-06-03 15:27:52 -07:00
Narayan Kamath
f6e9ffbc73 Fix file descriptor leak when opening invalid archives.
Also add -Wunreachable-code to the set of compiler flags, otherwise
noreturn becomes considerably less useful.

bug: https://code.google.com/p/android/issues/detail?id=171099
Change-Id: I9a95d45633c731c7046d4e4a39844d9cebfd1718
(cherrypick of 241bcf05e0e394bbf2681f359f52646dd6c707f6.)
2015-06-03 12:16:43 -07:00
Elliott Hughes
acdbe92c60 Don't say "update package missing" unless we mean it.
unzip_to_file reports failures itself these days, so there's it's unhelpful
of the caller to just guess what might have gone wrong.

Bug: http://b/21558406
Change-Id: I1e3d06c6cf902b8c6ef333dc60fd8f49680a493b
2015-06-03 11:01:41 -07:00
Elliott Hughes
f26eb51c2a Merge "Add "fastboot --version"." 2015-06-03 02:36:50 +00:00
Elliott Hughes
379646b2ca Add "fastboot --version".
So bug reporters can actually tell us what they're running.

Bug: http://b/21583225
Change-Id: If2a4ae97b4792aa321566603ce2c354a72d32307
2015-06-02 13:50:00 -07:00
Elliott Hughes
c0ce65f961 'usb' doesn't need to be global in fastboot.
Change-Id: Id014399640865d889918661bae0161b3165eee48
2015-06-02 13:34:07 -07:00
Badhri Jagan Sridharan
a873e1dc02 fastboot: Add support for fastboot flashing commands
Commands added:
fastboot flashing lock
      - Prevents flashing partitions
fastboot flashing unlock
      - Enable user to flashing partitions
fastboot flashing lock_critical
      - Prevents flashing bootloader related
        paritions
fastboot flashing unlock_critical
      - Enables user to flash bootloader
        related partitions
fastboot flashing get_unlock_ability
      - Query bootloader to check if device is
        locked.

(cherry picked from commit bf11095f92)
Change-Id: Id6db16ba32f7a2b1c3f041a76bd3bdf2d3ab471e
2015-05-28 19:15:27 +00:00
Badhri Jagan Sridharan
bf11095f92 fastboot: Add support for fastboot flashing commands
Commands added:
fastboot flashing lock
      - Prevents flashing partitions
fastboot flashing unlock
      - Enable user to flashing partitions
fastboot flashing lock_critical
      - Prevents flashing bootloader related
        paritions
fastboot flashing unlock_critical
      - Enables user to flash bootloader
        related partitions
fastboot flashing get_unlock_ability
      - Query bootloader to check if device is
        locked.

Change-Id: Id6db16ba32f7a2b1c3f041a76bd3bdf2d3ab471e
2015-05-15 18:00:50 -07:00
Narayan Kamath
241bcf05e0 Fix file descriptor leak when opening invalid archives.
Also add -Wunreachable-code to the set of compiler flags, otherwise
noreturn becomes considerably less useful.

bug: https://code.google.com/p/android/issues/detail?id=171099
Change-Id: I9a95d45633c731c7046d4e4a39844d9cebfd1718
2015-05-13 09:20:44 +00:00
Elliott Hughes
fe93e8d2a7 Remove dead files.
Auto-imported from cupcake, not touched since then, or used anyway.

Change-Id: If2d50cddff0238dff818c7bae92fe8e1100fccdf
2015-05-11 21:57:33 -07:00
Narayan Kamath
e97e66ea7c Use base::WriteFully in zip_archive.
We're already linking against libbase but we'll have to add
a libbase dependency to every target that includes libziparchive
as a STATIC_LIBRARY dependency, given that there's no way to
express that what we want (except by adding a LOCAL_WHOLE_STATIC_LIBRARY
dependency on libbase to libziparchive but that seems bad too)

Change-Id: I294ad389a9c61a1134a7bc323da25b0004a8f1e0
2015-04-29 14:31:45 +00:00
Colin Cross
1c3a69151b am 10766eac: am 6de70784: am 631cf146: Merge "Fix windows adb build"
* commit '10766eac61120732f11b82b1695207a3a5870a47':
  Fix windows adb build
2015-04-20 20:53:10 +00:00
Colin Cross
dc1e482b20 Fix windows adb build
libc++ is not available on windows yet, but it already defaults to
static libstdc++.

Change-Id: I85a766ead84f71fe1f2f59be6ac739b0b833b6db
2015-04-20 12:43:02 -07:00