Commit graph

49 commits

Author SHA1 Message Date
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
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
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
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
Elliott Hughes
e1746fda6a Remove the USB vendor id whitelist from fastboot.
Change-Id: I661a0538776d4ba74fcee37e2964d987eb861342
2015-08-10 15:30:54 -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
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
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
Mohamad Ayyash
94cd52391c am a15881a9: am ed926596: am 6900d34e: Merge "Add verbose param to sparse_file_import_auto"
* commit 'a15881a9e9d2951eda7a7a85fbaadd93bfb9da9b':
  Add verbose param to sparse_file_import_auto
2015-04-01 18:04:50 +00:00
Mohamad Ayyash
80cc1f6864 Add verbose param to sparse_file_import_auto
Change-Id: I0c5607f7aa5e964abc2031bbe71ff5c6e6ef56cc
Signed-off-by: Mohamad Ayyash <mkayyash@google.com>
2015-03-31 12:09:37 -07:00
Elliott Hughes
5b40fcbd1d am a782173a: am 261a82a6: Merge "Switch fastboot to ExtractEntryToFile."
* commit 'a782173a26f192fe9f51e1ee53e8d329501df409':
  Switch fastboot to ExtractEntryToFile.
2015-03-19 19:17:40 +00:00
Elliott Hughes
a82c89da1f Switch fastboot to ExtractEntryToFile.
Rather than malloc, ExtractToMemory, and write.

Also fix the tmpfile error check (tmpfile returns NULL on failure),
and improve error reporting.

Bug: 19765860
Change-Id: I236923e883128083377607f1519bb2e27b8f03f8
2015-03-19 11:44:32 -07:00
Elliott Hughes
ddaabcf22f am 41233fcc: am 294d3f74: Merge "Remove a prehistoric fastboot hack."
* commit '41233fcc35ce8c5efa06348f013c31072505229b':
  Remove a prehistoric fastboot hack.
2015-03-19 18:27:08 +00:00
Elliott Hughes
787ed98d68 am f99e47a0: am 445e5ede: Merge "Switch fastboot to libziparchive."
* commit 'f99e47a0a0604aef2f3b1d07953d5f220662353c':
  Switch fastboot to libziparchive.
2015-03-19 17:39:57 +00:00
Elliott Hughes
7c6d884e2b Remove a prehistoric fastboot hack.
If you don't have android-info.txt in your zip file, you're probably
not using a current fastboot binary anyway.

Change-Id: Ic721dc5f068f704c6792493d1e99f05f907678ba
2015-03-19 10:30:53 -07:00
Elliott Hughes
b7ca152be0 am 8e70f63a: am 57bf3109: Merge "Prepare for switching to libziparchive."
* commit '8e70f63aba8e14f3b40b2a0769522505c1019c33':
  Prepare for switching to libziparchive.
2015-03-19 16:01:06 +00:00
Elliott Hughes
d30ad8a2ee Switch fastboot to libziparchive.
Bug: 19765860
Change-Id: I83ea56e3b317893995d7106852b65584f99c0e64
2015-03-18 23:23:11 -07:00
Elliott Hughes
253c18d2fb Prepare for switching to libziparchive.
Bug: 19765860
Change-Id: I58249d28fbc4975428d0dcac5107d1994c35676c
2015-03-18 22:47:54 -07:00
Renamed from fastboot/fastboot.c (Browse further)