summaryrefslogtreecommitdiff
path: root/fastboot/device/variables.cpp
Commit message (Collapse)AuthorAgeFilesLines
* fastboot: Prefer ro.boot.hardware.revision for hw-revisionMichael Bestas2022-08-301-1/+4
| | | | | | | | | | | ro.revision defaults to 0 if it's not set in cmdline. Some devices might want to set it in their device specific init files, however it's not possible to override ro properties. Test: Set ro.boot.hardware.revision in device specific init.rc and observe fastboot getvar hw-revision in fastbootd Change-Id: I6e785c3fe3a49409e815af269a9a8db732b80ada
* fastboot: Fallback to "raw" partition type if fastboot hal isn't presentLuK13372022-03-021-2/+2
| | | | | | | | | Fastboot format fails to wipe any partition that doesn't at least return "raw" partition type. Also both android.hardware.fastboot@1.0-impl.pixel and android.hardware.fastboot@1.1-impl-mock return FileSystemType::RAW so I assume this is fine. Change-Id: I5707bddb1ba32edb6359858853d7b1afbf138b9f
* fastboot: use health AIDL HALYifan Hong2021-12-061-12/+5
| | | | | | Bug: 208543110 Test: fastboot getvar Change-Id: Ib83e7ccd53e49367f7af218ffafb7c0a57a514f6
* fastbootd: Add getvar max-fetch-size.Yifan Hong2021-03-171-0/+16
| | | | | | | | | Test: run it Test: see follow up CL on fuzzy_fastboot Bug: 173654501 Change-Id: I5ed110c5569d83cbe791d04b4abea3a2af2765a9
* fastbootd: exporting more propertiesBowgo Tsai2020-01-221-0/+51
| | | | | | | | | | 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
* Merge "fastbootd: Disallow certain operations during snapshot updates."David Anderson2019-11-191-8/+2
|\
| * fastbootd: Disallow certain operations during snapshot updates.David Anderson2019-11-101-8/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a snapshot is applied or is merging, requests to erase or flash userdata, metadata, or misc must be protected. In addition, the set_active command must be restricted when a merge is in progress. In addition, introduce a "snapshot-update merge" command for assisting with erase requests when a merge is in progress. As in recovery, this will force a merge to complete. Bug: 139154945 Test: apply update fastboot erase userdata fastboot erase metadata fastboot erase misc fastboot set_active Change-Id: I152446464335c62c39ffb4cc6366be9de19eac30
* | fastbootd: exporting CPU ABI infoBowgo Tsai2019-11-131-0/+6
|/ | | | | | | | | 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
* fastboot: Implement helper commands for Virtual A/B.David Anderson2019-10-311-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* fastbootd: Support two super partitions for retrofit devices.David Anderson2018-11-201-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Retrofit devices will have two super partitions, spanning the A and B slots separately. By design an OTA will never cause "A" or "B" partitions to be assigned to the wrong super. However, the same is not true of fastbootd, where it is possible to flash the inactive slot. We do not want, for example, logical "system_a" flashing to super_b. When interacting with partitions, fastbootd now extracts the slot suffix from a GetSuperSlotSuffix() helper. On retrofit devices, if the partition name has a slot, that slot will override FastbootDevice::GetCurrentSlot. This forces partitions in the inactive slot to be assigned to the correct super. There are two consequences of this. First, partitions with no slot suffix will default to the current slot. That means it is possible to wind up with two "scratch" partitions, if "adb remount" is used on both the "A" and "B" slots. However, only the active slot's "scratch" will be visible to the user (either through adb or fastboot). Second, if one slot does not have dynamic partitions, flashing will default to fixed partitions. For example, if the A slot is logical and B is not, flashing "system_a" will be logical and "system_b" will be fixed. This works no matter which slot is active. We do not try to upgrade the inactive slot to dynamic partitions. Bug: 116802789 Test: fastboot set_active a fastboot flashall # dynamic partitions fastboot getvar is-logical:system_a # true fastboot getvar is-logical:system_b # false fastboot set_active b fastboot flashall --skip-secondary fastboot getvar is-logical:system_a # true fastboot getvar is-logical:system_b # true Booting both slots works. Change-Id: Ib3c91944aaee1a96b2f5ad69c90e215bd6c5a2e8
* fastboot: Query the name of the super partition.David Anderson2018-11-061-0/+10
| | | | | | | | | | | | | | 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
* Merge "Check validity of partition for getvar:partition-type"Treehugger Robot2018-10-091-0/+7
|\
| * Check validity of partition for getvar:partition-typeHridya Valsaraju2018-10-091-0/+7
| | | | | | | | | | | | | | Test: fastboot getvar partition-type:product_services_a Bug: 79480454 Change-Id: I4020b0c94daf8fb86c29104aecc1eb8f44f89999
* | Merge "Return partition size in hex format."Treehugger Robot2018-10-091-1/+1
|\ \
| * | Return partition size in hex format.Hridya Valsaraju2018-10-091-1/+1
| |/ | | | | | | | | | | | | | | | | | | This is required to pass fuzzy_fastboot conformance tests. Also, allow for zero sized partitions in fuzzy_fastboot. Test: ./fuzzy_fastboot --gtest_filter=Conformance.Slots Bug: 117220134 Change-Id: Ifb12994a7796b081215084cb68b37674210aaa12
* / Check maximum allowed download size for download command.Hridya Valsaraju2018-10-081-1/+0
|/ | | | | | Bug: 117272937 Test: fastboot flashall Change-Id: Ied34a89129813a7f9fce6d4f48d8b65967558731
* Support fastboot variable battery-soc-okHridya Valsaraju2018-10-051-19/+56
| | | | | | | | | Bug: 79480454 Test: fastboot getvar battery-soc-ok Change-Id: Icfd70a71f1598e437316d4b8f895fd851516febb Merged-In: Icfd70a71f1598e437316d4b8f895fd851516febb (cherry picked from commit 9a1203b7acf7cf3a09ccec022c4698c994143bbd)
* Interface with health HAL to read battery voltageHridya Valsaraju2018-09-281-0/+25
| | | | | | Bug: 78793464 Test: fastboot getvar battery-voltage Change-Id: Ie0763e4f08327ec7649c5629066eb73e8142e0e6
* Add support to read fastboot variable 'off-mode-charge'Hridya Valsaraju2018-09-281-0/+22
| | | | | | | | | | Bug: 78793464 Bug: 79480454 Test: fastboot getvar off-mode-charge Change-Id: I4c40847be292e8e2e420340f81bb624b247bc11b Merged-In: I4c40847be292e8e2e420340f81bb624b247bc11b (cherry picked from commit b05d278696cbb25e14085362651999204aa51b40)
* Support fastboot variable 'variant'.Hridya Valsaraju2018-09-281-0/+21
| | | | | | | | | Bug: 79480454 Bug: 78793464 Test: fastboot getvar variant Change-Id: Iefef82c147d8405318c793ad0a73f00674bbb63d Merged-In: Iefef82c147d8405318c793ad0a73f00674bbb63d (cherry picked from commit 4785287a0043ddea2f784433d8a4fc8a168efc79)
* Support 'fastboot getvar unlocked' command.Hridya Valsaraju2018-09-251-1/+1
| | | | | | | Test: fastboot getvar unlocked. Bug: 78793464 Change-Id: Ie59c6db90a503e9a6e9ac1c416e4ee5deac60479
* Merge "Integrate with fastboot HAL to get partition type"Treehugger Robot2018-09-081-0/+44
|\
| * Integrate with fastboot HAL to get partition typeHridya Valsaraju2018-09-071-0/+44
| | | | | | | | | | | | | | | | | | Bug: 79480454 Bug: 78793464 Test: fastboot getvar partition-type:userdata Change-Id: Ib096ee8061568b8503f3a3f2dbb7e19a932162c4
* | fastbootd: Implement getvar hw-revision.David Anderson2018-09-051-0/+6
| | | | | | | | | | | | | | | | Bug: 78793464 Test: fastboot getvar hw-revision works fuzzy_fastboot Conformance.GetVarRevision passes Change-Id: I5a3e9893d61e18567f2f818ef06cad8e862d637f
* | fastbootd: Fix getvar max-download-size formatting.David Anderson2018-09-051-1/+1
| | | | | | | | | | | | Bug: 78793464 Test: fuzzy_fastboot Conformance.GetVarDownloadSize passes Change-Id: I8f33cb01e5b2ba66eab91b2481322d7fae593cf0
* | fastbootd: Fix partition size testing issues.David Anderson2018-09-041-1/+1
|/ | | | | | | | | | | 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
* fastbootd: Implement getvar all.David Anderson2018-08-311-0/+34
| | | | | | | | | | | 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
* fastbootd: Refactor for getvar all.David Anderson2018-08-311-51/+100
| | | | | | | | | | | 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
* fastbootd: Complete the implementation of getvar has-slot.David Anderson2018-08-141-3/+7
| | | | | | Bug: 78793464 Test: fastboot getvar has-slot:super returns "no" Change-Id: I80f171df062c008718b810bbe12070834d4aa3fb
* fastbootd: Add is-userspace variable.David Anderson2018-08-091-0/+4
| | | | | | | | | | 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
* fastbootd: Add commands for logical partitions.David Anderson2018-08-091-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* fastbootd: Add support for flashing logical partitions.David Anderson2018-08-091-0/+8
| | | | | | | | | | | | | | When flashing logical partitions, we read the "super" partition metadata corresponding to the current slot. We then temporarily create a device-mapper device for that partition, and immediately destroy the device after all operations are complete. We do not mount partitions ahead of time, or keep them mounted, because a fastboot operation may change the layout of the logical partition table (or change which slot is current). Bug: 78793464 Test: fastboot flash a logical partition under "super" Change-Id: Id2a61d3592decabeebfd283c4fd6e6cbe576a18c
* fastbootd: Enable erase and flash commands for physical partitions.David Anderson2018-08-091-0/+15
| | | | | | | Bug: 78793464 Test: adb reboot fastboot && fastboot flashall Change-Id: Ibe802c36f6efe20111a2315616ef34d3a027950f
* fastbootd: Allow returning errors from getvar handlers.David Anderson2018-08-081-37/+42
| | | | | | | | | | Currently a few getvar handlers will return invalid strings when an error occurs. This change allows those handlers to instead send a proper failure message. Bug: 78793464 Test: N/A Change-Id: I7ff7d036c1e6fb0a3d700ecf21b1103ab77278d2
* fastbootd: Implement the getvar command.Hridya Valsaraju2018-08-081-0/+122
This implements basic "fastboot getvar" support, including commands supported by IBootControl. Bug: 78793464 Test: fastboot getvar <fastboot variable> Change-Id: Iee1a7b3f43dea46f80dcdf73c45034e2ffe4727d