Commit graph

29 commits

Author SHA1 Message Date
David Anderson
2cb36706f4 fastboot: Add getvar commands to query battery part info.
This adds two commands to test the new v3 Health HAL, to query the
battery serial number (unlocked devices only) and part status.

Bug: 309792384
Test: adb reboot fastboot
      fastboot getvar battery-part-status
      fastboot getvar battery-serial-number
Change-Id: Ie0a14eda06483d047544833124c327fb88ba43a2
2023-12-11 11:59:23 -08:00
Harry Pan
7fa8dd655a Add new fastbootd battery-soc variable
Introduce new battery-soc variable to read battery
SSOC, this benefits manufacturing to better track
the SSOC after FSI image flashing in the userspace
fastbootd using the same approach as Android space,
otherwise it is difficult to implement the entire
battery SW stack from Android to fastboot bootloader
and generate the same test experience monotonically.

Bug: 303561559
Test: fastboot getvar battery-soc # in fastbootd
Change-Id: Ia3f68e314263d7dd4d4c45a908a0a49db6e761f9
Signed-off-by: Harry Pan <gspj@google.com>
2023-10-05 12:08:02 +00:00
Yi-Yo Chiang
38b68c6a0e fastbootd: Add getvar is-force-debuggable
Export ro.force.debuggable property so that the user can check image
compatibility prior to running fastboot flash.
For example, if is-force-debuggable is yes, then the "system" and
"vendor" build fingerprint must match.

Bug: 191649082
Test: fastboot getvar is-force-debuggable
Change-Id: I772d98253f58ba208d5803e18b589ff693deebd0
2022-11-22 17:32:21 +08:00
Bradley Furman
7518e8ba7e Updates the FB_COMMAND_SIZE from 64 to the linux max value of 4096 and
updates the relevant unit tests.

BUG=182864081

Test: Update the size check to the existing unit tests

Change-Id: I66b08884a5228e164c22c575a6f6c82a236fece2
2022-09-13 20:58:06 +00:00
David Anderson
ebc8fe19f8 fastboot: Add a command to get current kernel logs.
This adds "fastboot getvar dmesg", usable only in userspace fastboot,
and only on unlocked devices. This is to debug flashing failures when
serial log access is not available.

Bug: 230269532
Test: fastboot getvar dmesg
Change-Id: Ic57881e362efe3f0687f41ab986d30b3a59dc4e4
2022-06-21 19:32:19 -07:00
Yifan Hong
a4eb4753ac fastbootd: Add fetch command on device
Test: manual
Test: see follow up CL on fuzzy_fastboot
Bug: 173654501

Change-Id: I912d60d6dca0082734f2b84adc6a647c881bb5a1
2021-03-17 15:38:06 -07:00
Yifan Hong
b299cb7217 fastbootd: Add getvar max-fetch-size.
Test: run it
Test: see follow up CL on fuzzy_fastboot

Bug: 173654501

Change-Id: I5ed110c5569d83cbe791d04b4abea3a2af2765a9
2021-03-17 15:38:06 -07:00
Bowgo Tsai
27d5fb344b Increases fastbootd response message size
Some output of `fastboot getvar` exceeds current message size.
Increases the message size to 256 to fix the issue.

Bug: 74445765
Bug: 144473561
Test: fastboot getvar system-fingerprint
Change-Id: Id5064be4bb500697ce87c473f662d86c7c344d65
2020-02-06 16:22:59 +08:00
Bowgo Tsai
99f9a38a8b fastbootd: exporting more properties
Exporting more properties that can be useful for image compatibility
check, prior to run fastboot flash.

Bug: 74445765
Bug: 144473561
Test: fastboot getvar <new variable>
Change-Id: I2ddfa2c1e9e719e05a3a64b9ca1d608957aebf11
2020-01-22 23:29:07 +08:00
Bowgo Tsai
33da5c9493 fastbootd: exporting CPU ABI info
CPU ABI info, e.g., arm64-v8a, can be useful to determine image
compatibility, prior to flash. Adding this info in fastbootd.

Bug: 74445765
Test: fastboot getvar cpu-abi # arm64-v8a
Change-Id: Ied494b646c551320295956b7890c0102fdb88382
2019-11-13 17:22:22 +08:00
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
David Anderson
1d504e3342 fastbootd: Add command to remove GSI installs
Note: this only removes the bootable marker, since we're unable to
remove the userdata files within recovery.

Bug: 121210348
Test: fastboot gsi wipe
      fastboot gsi disable
Change-Id: I64fe848c787d426ae9d18a1557a9d6b340bfc2cf
2019-01-17 18:33:14 +00:00
David Anderson
90fe0a43ab fastboot: Query the name of the super partition.
This patch adds a new variable, "super-partition-name", to query the
name of the super partition (with a slot suffix if it has one). The
fastboot flashing tool has been updated to query this variable.

Since the super partition name can no longer be determined without
fastbootd, the presence of super_empty.img is used to test for
dynamic partition support rather than the presence of a super partition.

Bug: 116802789
Test: fastboot flashall on retrofit device
Change-Id: If830768eba6de7f31ac3183c64167fae973c77a4
2018-11-06 11:43:04 -08: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
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
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
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
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
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
38b3c7a122 fastbootd: Add an update-super command to sync the super partition.
This change introduces an "update-super" command to the fastboot
protocol. Unlike the "flash" command, which copies raw or sparse data to
a partition, the "update-super" command requires the data to be a super
image generated by lpmake.

If the super partition is not yet formatted (or is corrupt), then it
will be formatted using the given image. Otherwise, "update-super" will
preserve the existing partition layout, and only ensure that logical
partition entries exist for all the new partitions in the given image.
All new partitions added this way will have a zero size, and it is the
host's responsibility to size them as needed afterwards with the
"resize-logical-partition" command.

In addition, the "update-super" command supports a "wipe" argument,
which will force the super partition to be reformatted with the given
image, overwriting any existing partition tables.

Bug: 78793464
Test: fastboot flashall with a super partition
Change-Id: If37d839a03e396e11b6c08a9c32984106613d1dc
2018-08-22 15:05:03 -07:00
David Anderson
d9ba061e77 fastbootd: Add is-userspace variable.
Bug: 78793464
Test: fastboot getvar is-userspace
          returns true for fastbootd
      fastboot getvar is-userspace
          returns false or error for bootloader fastboot.

Change-Id: I80e1ef6dcf3922e4f555cb2e409e3e098c16fbbc
2018-08-09 15:06:53 -07:00
David Anderson
0d4277d7b3 fastbootd: Add commands for logical partitions.
This patch adds the following new commands to fastbootd:

    getvar is_logical:<partition>
    create-logical-logical-partition <partition> <size>
    delete-logical-partition <partition>
    resize-logicallogical-partition <partition> <size>

All of these commands operate on logical partitions only, and require a
properly configured "super" partition to operate.

Bug: 78793464
Test: fastboot create-logical-partition example 4096
      fastboot create-logical-partition example 4096 returns error
      fastboot getvar is-logical:example returns "yes"
      fastboot getvar partition-size:example returns "1000"
      fastboot resize-logicalpartition example 8000
      fastboot getvar partition-size:example returns "2000"
      fastboot delete-logical-partition example
      fastboot getvar is-logical:example returns error
      fastboot getvar is-logical:system_a returns "no"

Change-Id: Iff323eabcf5c559fa04c7c92574650b01803eb1f
2018-08-09 15:06:52 -07:00
Hridya Valsaraju
31d2c26409 fastbootd: Implement the getvar command.
This implements basic "fastboot getvar" support, including commands supported
by IBootControl.

Bug: 78793464
Test: fastboot getvar <fastboot variable>

Change-Id: Iee1a7b3f43dea46f80dcdf73c45034e2ffe4727d
2018-08-08 11:41:53 -07:00
Hridya Valsaraju
dea91b4b53 Add fastbootd.
Fastbootd is started by recovery, and communicates
over usb with the fastboot protocol.

Add additional fastboot commands to move in and out of
fastbootd. "fastboot reboot recovery" and "fastboot reboot fastboot"

Bug: 78793464
Test: fastboot reboot recovery, fastboot reboot fastboot
Change-Id: Iffb77b2d3ceefb7335c38aa9fba7bd17821484f0
2018-08-02 09:43:23 -07:00
Jerry Zhang
769a9c1d11 fastboot: Refactor string constants to constants.h
This allows them to be shared between host and device
implementations.

Test: fastboot works
Bug: 78793464
Change-Id: I79271687850ade2a904fd03d6a97dad1a9ab8e1c
2018-07-16 14:18:41 -07:00