Commit graph

16 commits

Author SHA1 Message Date
David Anderson
ab8f466107 fastboot: Implement helper commands for Virtual A/B.
This introduces two new commands to the fastboot protocol:

  - getvar snapshot-update-status - Return "none", "snapshotted", or
    "merging" depending on the current status set by the boot control
    HAL.
  - snapshot-update [cancel] - Cancel any pending snapshot-based updates
    via the boot control HAL. After this, the HAL should return
    MergeStatus::CANCELLED and "update-merge-status" should be "none".
    If no argument is specified, the snapshot-update-status is returned
    via an INFO response.

Bootloaders are expected to implement this in a manner consistent with
the boot control HAL.

Fastboot-based tooling should expect wipes of userdata to fail when
update-merge-status returns "merging". Thus, the force flag now cancel
any pending snapshots.

Bug: 139154945
Test: fastboot getvar snapshot-update-status
      fastboot snapshot-update cancel
      fastboot snapshot-update

Change-Id: Idc423fe7656b212e929e64eb0e6b85b453e0e8dc
2019-10-31 01:11:16 +00:00
Mark Salyzyn
8e7e9cb395 fastboot: use constants.h values
Cleanup to utilize all the manifest values in constants.h.

If the cli command _and_ the protocol name match, use a common
source of convenient truth.  This should set a pattern for future
additional commands.  When the command and the protocol differ,
we want to introduce resistance as it results in confusion and
maintenance issues.

Test: compile
Change-Id: Idad413c63cbbfcb6e851856105a5d5a9ef53ef29
2018-10-18 14:26:27 +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
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
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
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
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
1d887434da fastboot: Automatically reboot to userspace fastboot.
In order to flash logical partitions, "flashall" must be run against
userspace fastboot. When the bootloader supports the "reboot-fastboot"
command, we now attempt to automatically reboot into userspace fastboot.

We do this by closing the transport, sleeping for one second, and then
polling for a new connection until one is available. FastBootDriver is
then assigned the new transport.

Bug: 78793464
Test: fastboot flashall on device with logical partitions, while booted
      into bootloader fastboot

Change-Id: I6949871b93ab5e352784cabe0963c6ecfc0af36d
2018-08-28 09:07:40 -07:00
Aaron Wisner
00737b3939 Create fuzzy-fastboot pen tester
Test: Run on Sailfish, Walleye, and other devices
Bug: http://b/111126621
Change-Id: I309af79411d0a16d11874a048ce0db024770d7b2
2018-08-22 11:30:29 -05:00
Aaron Wisner
9812b58fc4 Add support to fastboot_driver for sending sparse images with CRC check
The default argument will prevent anything from breaking

Test: Build on glinux
Change-Id: Ib427ab210476db1ec1c69c0a3238d0653e98b79a
2018-08-22 11:02:47 -05:00
Chris Fries
3b984c7efe Merge "Increase fastboot timeout to 30 seconds" 2018-08-13 14:58:34 +00:00
Aaron Wisner
50acca7226 Increase fastboot timeout to 30 seconds
Some OEM commands can take quite a while.
The current 10 second timeout is too small.

Test: fastboot tool
Change-Id: Icf59615919c92dc85807abe3ec5793504cf7a162
2018-08-10 17:44:28 -05:00
Aaron Wisner
c771ae0fd4 Minor fixes to fastboot_driver
- Make RCString() static
- Add clearer error message for 0 length upload error
- Fix regex hex matching for partition-size
- Move ZLP packet checking to SparseWriteCallback()

Test: build fastboot on glinux
Change-Id: I51a040e07b9698a41f64b35a9e2baa8d575527a9
2018-08-02 17:47:38 -05:00
Aaron Wisner
db511207ed Refactor libfastboot
This change creates a nice and clean API for issuing
fastboot commands without using the fastboot tool itself.

Test: fastboot tool itself (now using libfastboot2)
on sailfish, walleye, and other devices.
Test: flash bootloader bootloader.img
Test: flash radio radio.img
Test: -w update img.zip
Test: Manually getvar and reboot commands.

Bug: 111126621
Change-Id: I0022536b204ce0c5ad8329367fd522fa3c57877d
2018-07-19 15:16:47 -05:00