Commit graph

102 commits

Author SHA1 Message Date
Elliott Hughes
d2d8b68f70 Merge "Show install path in "adb --version" and "fastboot --version"." 2017-04-04 01:16:11 +00:00
Vineeta Srivastava
20ef986715 Add vbmeta image support for verified boot 2017-03-31 13:22:34 -07:00
Elliott Hughes
1fd46dfa72 Show install path in "adb --version" and "fastboot --version".
Bug: http://b/36766455
Bug: http://b/34691048
Test: ran tests
Change-Id: I4b67ec54d41a281fe7a33c017d3cfbc8055e3b43
2017-03-30 15:10:24 -07:00
Elliott Hughes
4a66730d6a Move "fastboot oem" to std::string.
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
2017-03-15 09:40:28 -07:00
Connor O'Brien
ce16a8a940 Fastboot: use flash erase & logical block size for building userdata
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
2017-02-08 18:30:40 -08:00
Pavlin Radoslavov
6adbd4e787 Fix a crash when parsing fastboot command-line arguments
Fix a crash when running "fastboot reboot bootloader"

Test: Manual run "fastboot reboot bootloader" and "fastboot reboot emergency"
Change-Id: I6d163a5b640afcae1dfa606f409e23ec5f499184
2017-01-25 19:07:46 -08:00
Alexey Polyudov
e0bfb759cb fastboot: add EDL mode support
reboot device into emergency download mode (if HW supports it)

Change-Id: If068fdd041c5bdc7bf65515a78aabf18082cba2a
Signed-off-by: Alexey Polyudov <apolyudov@google.com>
2017-01-24 18:55:17 -08:00
David Pursell
04396f62da fastboot: fix set_active for legacy A/B.
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
2016-12-15 16:27:48 -08:00
Elliott Hughes
290a228fdc Switch fastboot/init/libprocessgroup to std::this_thread::sleep_for.
Bug: http://b/32878766
Test: boots
Change-Id: Ie0ddfb7e60f2da5f6eefbb10c83a92e88c137ae3
2016-11-14 17:08:47 -08:00
Elliott Hughes
da46b392f1 Move off std::sto* function which abort on failure.
Bug: http://b/31403370
Test: builds, boots, libbase tests pass
Change-Id: I89cd7ca3d8f1c8a1bad0ddf3043439449d19a293
2016-10-13 15:34:05 -07:00
Mitchell Wills
31dce302db Add fastboot --skip-reboot flag
Add a flag to fastboot that will cause it to not reboot the device after
performing commands like update and flashall.

Fixed: 31743001
Test: run fastboot update with and without --skip-reboot flag
Change-Id: I7f4056249a52779c7fc752c9d1009a58a44762df
2016-09-26 11:27:16 -07:00
Elliott Hughes
82ff315bb0 Add android::base::GetExecutablePath, switch adb and fastboot over.
We'd long had two copies of this stuff, so rather than rewrite both
Linux versions to use android::base::Readlink, let's kill the duplication
too...

Bug: http://b/30988271
Change-Id: I4de58a94a22a4b1faf969a6fc70ca1560a4d5121
2016-09-01 09:24:24 -07:00
Daniel Rosenberg
559cc01e3e resolve merge conflicts of 40eff95 to stage-aosp-master
Change-Id: I91935ba9603ffd41af2009adc13a024701619c52
2016-08-22 20:13:52 -07:00
Daniel Rosenberg
92b4476aa0 Add skip-secondary flag
The skip-secondary flag now replaces flash-primary. This flag will
skip over the secondary images for both flashall and update.

Change-Id: I9f380f3195006d325d6c45776bf79ecec17506ad
(cherry-picked from commit e180929866)
2016-08-19 16:52:26 -07:00
Daniel Rosenberg
8091947847 Switch fastboot to new A/B spec
Slots are now referred to as a and b instead
of _a and _b. For the moment, _a and _b will
still be supported. For old devices that
support A/B, they are assumed to have 2 slots.

Bug: 29643845
Change-Id: Ieab6bed7b4977d8386dcec0afa434371f54bd63f
(cherry-picked from commit 563fcf6f69)
2016-08-19 16:52:26 -07:00
Alex Light
bb9b8a5abf Add Fastboot support for flashing secondary images
Fastboot update and flashall will now flash secondary
images if provided, and if the --slot flag is not set
to 'all'. Also added flash-primary to preserve the
previous behavior, and flash-secondary to just flash
the secondary images.

Fixes from: I5bd2de1c1e0e6224a195b566f7dcbe383555a80a

Bug: 29278988
Change-Id: Ia870e4be55617c0eefa4e1381287f8cd14affe7e
(cherry-picked from commit 6c98509c34)
2016-08-19 16:52:26 -07:00
Daniel Rosenberg
ad3d3c184e Handle invalid suffix lists
Some devices will report an error string as a value
when unknown variables are queried. This can lead to
unexpected behavior, so we attempt to detect this case
by seeing if the suffix list doesn't make sense.

Change-Id: I939b1e01c40ddc05d881fd54423406db250cc8e5
(cherry-picked from commit 190d968414)
2016-08-19 15:31:01 -07:00
Daniel Rosenberg
1345409537 Call set_active after flashall and update
If the device has previously failed to boot, and the current slot is
marked as unbootable, we must call set_active to reenable the slot.

Bug: 29827625
Change-Id: I8b723dda80e246b48e5967aff4503c3d120bfb9b
(cherry-picked from commit 9c9a6c62e5)
2016-08-19 15:31:01 -07:00
Greg Kaiser
0c8a67bbfd Merge "fastboot: Don't leak file in error case"
am: 3a197b3799

Change-Id: Ieaab2ed5c1619f75fa4c334d61afaf858ad7d46c
2016-08-12 17:45:32 +00:00
Greg Kaiser
dc9b62ba74 fastboot: Don't leak file in error case
This is probably not very significant in this standalone tool,
but makes it easier for us to find leaks in our other system
code via static analysis.

(cherry-pick of 407a2195391685627e6be947491041ae3c8cbe61.)

Change-Id: I4e14cadc1e53bac0848e0e0c7f531f920e43cb0a
2016-08-12 08:57:22 -07:00
Chih-Hung Hsieh
4c4fa90462 Merge \"Fix clang-tidy performance warnings in syste/core.\"
am: 4efbce14b5

Change-Id: I84f6b0134fae6e9f40710f243f4825e3f31fa15f
2016-08-01 20:23:10 +00:00
Chih-Hung Hsieh
8f7b9e3d39 Fix clang-tidy performance warnings in syste/core.
* Use const reference type for parameters to avoid unnecessary copy.
* Suppress warning of not using faster overloaded string find function.

Bug: 30407689
Bug: 30411878
Change-Id: I6cfdbbd50cf5e8f3db6e5263076d3a17a9a791ee
Test: build with WITH_TIDY=1
Merged-In: Ie79dbe21899867bc62031f8618bb1322b8071525
2016-08-01 11:55:42 -07:00
Elliott Hughes
7191a56e96 Merge \"Remove unnecessary ARRAY_SIZE macros.\"
am: c37d8ea22a

Change-Id: Id3443d7247e893ee549ae5b799a8f0bf42088d35
2016-06-29 00:16:44 +00:00
Elliott Hughes
749ae2d32f Remove unnecessary ARRAY_SIZE macros.
Use the canonical one instead.

Change-Id: Id80f19455f37fd2a29d9ec4191c1a0af80c5c0e7
2016-06-28 14:48:45 -07:00
Elliott Hughes
7f80f04a2c Merge "Report errno more often in fastboot." am: 8c5384e50b
am: 272b2694cd

* commit '272b2694cd3556120a3e39b88a0702103e2ed58a':
  Report errno more often in fastboot.

Change-Id: Ie26d2c70e65b70c08017f848f21fb91d6f20e3a4
2016-05-11 21:50:07 +00:00
Elliott Hughes
53ec495b40 Report errno more often in fastboot.
Change-Id: I4b4b47c584a146b38876a379f26ceb20d071c643
2016-05-11 12:39:27 -07:00
Elliott Hughes
a73dfe0cf9 Merge "Use more std::string in fastboot." am: 17f3b1bad7
am: 05ec41963d

* commit '05ec41963d7e219a78ef9ffad6d1b1dcf5f4135c':
  Use more std::string in fastboot.

Change-Id: I819aefd792b1c3cd98403f0b25afa21717086e44
2016-04-29 17:58:07 +00:00
Elliott Hughes
2810d00dd9 Use more std::string in fastboot.
Change-Id: Ic8c77eac1e0088627ab650050d9c97c5749e5c39
2016-04-29 08:30:13 -07:00
Alex Deymo
1b245719f1 Merge "fastboot: Minor fix to help text."
am: 92a7043

* commit '92a70439d6767f577546ccf7baf215b113265ae0':
  fastboot: Minor fix to help text.
2016-03-25 04:49:37 +00:00
Alex Deymo
f62d0cd943 fastboot: Minor fix to help text.
Help text had some missing end of line markers.

Bug: None
TEST=make out/host/linux-x86/bin/fastboot; fastboot

Change-Id: Iaa9e4e0a2d70c7d427f5e99e72fe1c2e2c26ee92
2016-03-24 19:51:05 -07:00
David Pursell
22317f2b5a Merge "fastboot: add UDP protocol."
am: c7f43c6ae1

* commit 'c7f43c6ae16a475627e6b3da44dde1cad17ab45a':
  fastboot: add UDP protocol.
2016-02-10 20:03:48 +00:00
David Pursell
4601c978ca fastboot: add UDP protocol.
Implements a UDP protocol for fastboot, documented in
fastboot_protocol.txt.

This version of the protocol does not include multi-packet windowing,
which will likely be needed to achieve reasonable speeds over WiFi.
Since we don't have any WiFi use cases yet, we'd like to get this in
now and update the protocol later if it becomes necessary.

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

Bug: http://b/26154914
Change-Id: Ia5bbae6bcd6405671f594d7120b3994746d234d3
2016-02-10 10:21:30 -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
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
9da9ac5b2a fastboot: show progress when sending sparse images.
Bug: http://b/25443220
Change-Id: Ica0c88aea2a0661f39ff1415ebba464c037651da
2016-01-19 14:50:18 -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
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
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