Commit graph

611 commits

Author SHA1 Message Date
Hridya Valsaraju
aae84e813c Check maximum allowed download size for download command.
Bug: 117272937
Test: fastboot flashall
Change-Id: Ied34a89129813a7f9fce6d4f48d8b65967558731
2018-10-08 14:07:56 -07:00
Treehugger Robot
4aa42b46c9 Merge "Allow Conformance tests to verify userspace fastboot." 2018-10-08 16:34:26 +00:00
Treehugger Robot
e06850afdb Merge "Support fastboot variable battery-soc-ok" 2018-10-07 17:53:45 +00:00
Hridya Valsaraju
a534a5a973 Support fastboot variable battery-soc-ok
Bug: 79480454
Test: fastboot getvar battery-soc-ok

Change-Id: Icfd70a71f1598e437316d4b8f895fd851516febb
Merged-In: Icfd70a71f1598e437316d4b8f895fd851516febb
(cherry picked from commit 9a1203b7ac)
2018-10-05 16:16:49 -07:00
Hridya Valsaraju
bdc1429454 Allow Conformance tests to verify userspace fastboot.
Bug: 117220134
Test: ./fuzzy_fastboot --gtest_filter=Conformance.*

Change-Id: Iab04fdff71e7e90a56d53d24cf14e94c81131009
2018-10-05 15:56:12 -07:00
Treehugger Robot
02678f32be Merge "Don't hardcode the super partition name." 2018-10-04 19:29:34 +00:00
David Anderson
e5f2f06b00 liblp: Remove the guid field from LpMetadataPartition.
Bug: 117229984
Test: liblp_test gtest
Change-Id: Ie42b3a8005b1cf711303966a2a117c255f0fb08c
2018-10-03 14:48:42 -07:00
Treehugger Robot
49ef2c5897 Merge "Remove tests for sparse images with CRC from fuzzy_fastboot" 2018-10-02 23:05:13 +00:00
Tom Cherry
e6fc328d16 Merge "fastboot: remove engine.cpp/engine.h" 2018-10-02 21:21:50 +00:00
Hridya Valsaraju
94d05063ba Remove tests for sparse images with CRC from fuzzy_fastboot
Sparse images with CRC are currently not supported by the
Android build system.

Test: ./fuzzy_fastboot --gtest_filter=Conformance.*
Change-Id: I6a73fb0dc5d4c77a3d1a0384c137789eb06fa956
2018-10-02 17:21:39 +00:00
David Anderson
5cbd2e43ee Don't hardcode the super partition name.
If a device has logical partitions but does not use a partition called
"super", we will need this to be configurable. Note that the "slot"
argument is currently unused, but will be necessary for update_engine if
there are A and B super partitions.

Bug: 116608795
Test: super partition works
Change-Id: Ieb548a158faeb423f3561230f26d582325efbc6b
2018-10-01 14:13:22 -07:00
Hridya Valsaraju
47658caae4 Interface with health HAL to read battery voltage
Bug: 78793464
Test: fastboot getvar battery-voltage
Change-Id: Ie0763e4f08327ec7649c5629066eb73e8142e0e6
2018-09-28 14:28:49 -07:00
Hridya Valsaraju
7c9bbe948b Add support to read fastboot variable 'off-mode-charge'
Bug: 78793464
Bug: 79480454

Test: fastboot getvar off-mode-charge
Change-Id: I4c40847be292e8e2e420340f81bb624b247bc11b
Merged-In: I4c40847be292e8e2e420340f81bb624b247bc11b
(cherry picked from commit b05d278696)
2018-09-28 14:16:47 -07:00
Hridya Valsaraju
4af80901a6 Support fastboot variable 'variant'.
Bug: 79480454
Bug: 78793464
Test: fastboot getvar variant
Change-Id: Iefef82c147d8405318c793ad0a73f00674bbb63d
Merged-In: Iefef82c147d8405318c793ad0a73f00674bbb63d
(cherry picked from commit 4785287a00)
2018-09-28 11:38:58 -07:00
Treehugger Robot
e4931c5bd4 Merge "Support 'fastboot getvar unlocked' command." 2018-09-26 16:21:28 +00:00
Treehugger Robot
c448000e42 Merge "Pass OEM commands to HAL" 2018-09-26 00:29:21 +00:00
Hridya Valsaraju
dca328d55c Support 'fastboot getvar unlocked' command.
Test: fastboot getvar unlocked.
Bug: 78793464

Change-Id: Ie59c6db90a503e9a6e9ac1c416e4ee5deac60479
2018-09-25 16:25:46 -07:00
Hridya Valsaraju
a15fe31507 Pass OEM commands to HAL
Bug: 78793464
Bug: 79480454
Test: fastboot oem command

Change-Id: Ibaabef6ea725857102f7531997fcff2a1dbdc1ca
Merged-In: Ibaabef6ea725857102f7531997fcff2a1dbdc1ca
(cherry picked from commit 993b4edb0f)
2018-09-25 22:55:47 +00:00
Tom Cherry
9027af0d40 fastboot: remove engine.cpp/engine.h
Replace the remnants of engine.cpp with better functionality in
FastBootDriver.  Particularly, add prolog() and epilog()
callbacks to FastBootDriver for printing actions and their result to
the console.  Then clean up the rest of fastboot.cpp to directly use
FastBootDriver.

Test: fastboot works
Change-Id: I0ff01d6a10f75e9dc1c82b46c6e9bb3bc4c68638
2018-09-25 14:32:56 -07:00
Tom Cherry
4aa60b382c fastboot: clean up CheckRequirements
CheckRequirements() had various issues that are cleaned up here,

1) Move from C string parsing to C++
2) Moved from C data structures to C++, including fixing memory leaks.
3) Removed the 'cur_product' global and the 'query_save' function that
   stores it
4) Actually writing tests for the parsing function for
android-info.txt
5) Check that a variable needs to be checked for a given product before
   trying to read it.  Previously, fastboot would fail if a variable
   isn't recognized on a device, even if the check should be ignored.

A lot of flexibility is allowed for the input strings, to keep
backwards compatibility with the previous parsers.

Test: fastboot works, unit tests

Change-Id: Idc3bba8b8fe829d8eefe5f6c495e63a9441c0b60
2018-09-21 12:50:39 -07:00
Tom Cherry
dfd85df11a Use vector<char> instead of char* and malloc() for images
And fix the associated memory leaks in the process.

Test: fastboot works
Change-Id: I6e41f351ca6cebf79282d30b1eca1506496e0c21
2018-09-20 16:48:36 -07:00
David Anderson
1109c92bea fastboot: Add vbmeta_mainline to the partition list.
Bug: 115939310
Test: fastboot flash vbmeta_mainline works
      fastboot flashall includes vbmeta_mainline

Change-Id: I081660cd8437ac66cab750b270f5019230050285
2018-09-17 17:34:22 -07:00
Treehugger Robot
e9997f8152 Merge "Integrate with fastboot HAL to get partition type" 2018-09-08 02:47:41 +00:00
Hridya Valsaraju
bf9f8d1a64 Integrate with fastboot HAL to get partition type
Bug: 79480454
Bug: 78793464

Test: fastboot getvar partition-type:userdata

Change-Id: Ib096ee8061568b8503f3a3f2dbb7e19a932162c4
2018-09-07 12:22:00 -07:00
David Anderson
c8ac4e7644 fastbootd: Wait for /dev/block paths when opening logical partitions.
Note that in addition to waiting for the path to appear, we must also
wait for it to be unlinked. Otherwise, we could accidentally access an
older device when opening and closing the same partition twice in a row.

Bug: 114198005
Test: fastboot flashall works
Change-Id: Iddffc34e1ac8aa066c28e7b1a92b09b6dfd7945c
2018-09-06 17:38:06 -07:00
Greg Kaiser
1fd4b364fc Merge changes I891f64fb,I6182d84e
* changes:
  logcat: Fix buffer size
  UsbTransportSniffer: Defensively use 'final'
2018-09-06 17:11:13 +00:00
Tom Cherry
04ccbfd62c Merge "fastboot: remove command queue" 2018-09-06 16:07:18 +00:00
Greg Kaiser
33b07ba96c UsbTransportSniffer: Defensively use 'final'
UsbTransportSniffer invokes the virtual method Close() within
its destructor.  This usage is fine right now, but if a future
class inherited from UsbTransportSniffer and overrode the Close()
method, then this destructor would not act as expected.

To protect against this, we declare Close() 'final' in
UsbTransportSniffer, and add a comment.

Test: Treehugger
Change-Id: I6182d84e7caf67cb06f37c22c6203ad6d6e57f34
2018-09-06 06:18:01 -07:00
Treehugger Robot
8c0a3e0a7d Merge "fastbootd: Implement getvar hw-revision." 2018-09-06 00:55:32 +00:00
Treehugger Robot
950ec1a001 Merge "fastbootd: Perform CRC check when flashing sparse images." 2018-09-05 22:12:32 +00:00
Treehugger Robot
6e66d36c24 Merge "fastbootd: Fix getvar max-download-size formatting." 2018-09-05 22:11:40 +00:00
Treehugger Robot
61b6c5cdfe Merge "Remove request for read access to partitions." 2018-09-05 21:45:24 +00:00
Tom Cherry
11f12099cc fastboot: remove command queue
There is little advantage and increasingly much disadvantage to
queueing up fastboot commands before executing them.  This change
removes the queue in the most simple way possible to enable further
clean up.

Test: fastboot works
Change-Id: I9abab05df07ed167dbe6a42e1eb9eab8f8d4f157
2018-09-05 14:28:47 -07:00
David Anderson
c091c176cb fastbootd: Implement getvar hw-revision.
Bug: 78793464
Test: fastboot getvar hw-revision works
      fuzzy_fastboot Conformance.GetVarRevision passes

Change-Id: I5a3e9893d61e18567f2f818ef06cad8e862d637f
2018-09-05 12:52:15 -07:00
David Anderson
56843eec45 fastbootd: Perform CRC check when flashing sparse images.
Bug: 78793464
Test: fuzzy_fastboot Conformance.SparseCRCCheck passes
Change-Id: I717fbec42599a43bafafa1f73837e115a9f9109a
2018-09-05 12:52:15 -07:00
David Anderson
28b81cdc91 fastbootd: Fix getvar max-download-size formatting.
Bug: 78793464
Test: fuzzy_fastboot Conformance.GetVarDownloadSize passes
Change-Id: I8f33cb01e5b2ba66eab91b2481322d7fae593cf0
2018-09-05 12:52:14 -07:00
Hridya Valsaraju
3ffed21262 Remove request for read access to partitions.
It is not needed for flash or erase.

Bug: 113648914
Test: fastboot flashall
Change-Id: I34ba57ac809934556569e3b38ab594969860882a
2018-09-05 12:11:13 -07:00
David Anderson
4758967bf9 fastbootd: Fix partition size testing issues.
Partition sizes must be reported with an "0x" prefix for fuzzy_fastboot.
Also, with dynamic partitions, the size of a partition can be 0.

Bug: 78793464
Test: fuzzy_fastboot Conformance.PartitionInfo does not error on
      partition sizes when using fastbootd

Change-Id: I4148440bd9ed420878940829618cbf8cee85bf6a
2018-09-04 16:25:06 -07:00
David Anderson
6c30f6e3d2 fuzzy_fastboot: Use uint64_t for partition sizes.
Bug: N/A
Test: fuzzy_fastboot Conformance.PartitionInfo passes
Change-Id: I27182585a1522d22dd3ddfe83ce22e06dd7fc762
2018-09-04 15:58:28 -07:00
David Anderson
03de645aac fastbootd: Fix transport ownership.
This change moves Transport ownership back out of FastBootDriver.
Callers of set_transport must ensure that the previous transport is
destroyed. In addition, deleting a transport now ensures that it is
closed.

Bug: 78793464
Test: fastboot, fuzzy_fastboot works
Change-Id: I8f9ed2f7d5b09fd0820b2677d087a027378f26db
2018-09-04 15:01:12 -07:00
David Anderson
0f6266305e fastbootd: Implement getvar all.
This implements getvar all by invoking each callback and writing an INFO
status for each result. For commands that take arguments, the variable
handler can specify a function that returns all possible arguments.
Currently this only applies to partition variables.

Bug: 78793464
Test: fastboot getvar all works
Change-Id: I1cf84e06bf67614b6f56171c0ee6ca5d7ac383c9
2018-08-31 18:39:28 -07:00
David Anderson
1fb3fd7242 fastbootd: Refactor for getvar all.
It is easier to implement getvar all if we can invoke each variable
handler and collect their results. This change reverts the handlers to
return their messages as an outparam, rather than going through
FastbootDevice.

Bug: 78793464
Test: fastboot getvar works
Change-Id: I8544251ce517526b26435526756359ce220520cc
2018-08-31 17:03:50 -07:00
Dan Willemsen
822465a930 Fix the mac fastboot build
The Carbon framework isn't on the list of libraries that Soong allows
linking against, so this broke the Mac build. This compiles just fine
without Carbon though, and I don't see any references to Carbon in the
code.

Test: mma
Change-Id: I83044d244f7cec778c8b8b6132249c0f016c10fc
2018-08-30 18:26:11 -07:00
Dan Willemsen
4d8929773b Merge "Convert fastboot to Soong" 2018-08-30 23:36:54 +00:00
Treehugger Robot
c47c508dcd Merge "fastboot: Use a single codepath for flashall and update." 2018-08-30 20:12:16 +00:00
Dan Willemsen
ab971b5e7e Convert fastboot to Soong
Also fix adb's version number to match.

See build/soong/README.md for more information.

Test: cd system/core/fastboot; mma
Test: fastboot --version
Test: adb --version
Test: out/host/linux-x86/nativetest/fastboot_test/fastboot_test
Test: out/host/linux-x86/nativetest64/fastboot_test/fastboot_test
Change-Id: I65ea39af9183c602e84f3bc0e4a0d066a30fc464
2018-08-30 11:28:18 -07:00
David Anderson
cf444f3633 fastboot: Use a single codepath for flashall and update.
This patch extracts the common logic out of the flashall and update
command implementations. There is now a FlashAllTool helper class, and
an ImageSource class for commands to specify how to find built images.

With these paths merged, the update command now supports logical
partitions.

Bug: 78793464
Test: flashall works with or without a super partition
      update works with or without a super partition

Change-Id: I63a8690bbc4da6ea98a07eb2c07166ddd993a7b7
2018-08-29 15:58:34 -07:00
Tom Cherry
e51dadb8a7 fastboot: remove 'verify'
This isn't sent by the fastboot client.
This isn't in our bootloader requirement document.
Neither my hikey nor sailfish respond to this.

Test: fastboot still works
Change-Id: I11ff0aed818d98f3427ed427605d99b3c76ccb06
2018-08-29 15:29:20 -07:00
Tom Cherry
566751444d fastboot: remove 'powerdown'
This isn't sent by the fastboot client.
This isn't in our bootloader requirement document.
Neither my hikey nor sailfish respond to this.
The README.md literally uses this as an example for 'unknown command'

Test: fastboot still works.
Change-Id: Ia442a41de517dae078dd7e73c951aadb97646c73
2018-08-29 14:10:47 -07:00
David Anderson
0debda098f fastboot: Clean up the image array a bit.
This makes the following changes to the images array:
 * The "optional_if_no_partition" flag is removed, as it was a temporary
   workaround for super.img.
 * The "flashall" flag is removed.
 * The "needed_for_fastbootd" flag is now an ImageType enum.

Bug: N/A
Test: fastboot builds, flashall works
Change-Id: Id000ea20cf83639cec2c9ae94f28c799b34606f1
2018-08-28 15:17:48 -07:00