summaryrefslogtreecommitdiff
path: root/fastboot/device/variables.cpp
AgeCommit message (Collapse)Author
2022-05-02fastboot: Fallback to "raw" partition type if fastboot hal isn't presentLuK1337
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
2021-03-17fastbootd: Add getvar max-fetch-size.Yifan Hong
Test: run it Test: see follow up CL on fuzzy_fastboot Bug: 173654501 Change-Id: I5ed110c5569d83cbe791d04b4abea3a2af2765a9
2020-01-22fastbootd: exporting more propertiesBowgo Tsai
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
2019-11-19Merge "fastbootd: Disallow certain operations during snapshot updates."David Anderson
2019-11-13fastbootd: exporting CPU ABI infoBowgo Tsai
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-10fastbootd: Disallow certain operations during snapshot updates.David Anderson
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
2019-10-31fastboot: Implement helper commands for Virtual A/B.David Anderson
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
2018-11-20fastbootd: Support two super partitions for retrofit devices.David Anderson
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
2018-11-06fastboot: Query the name of the super partition.David Anderson
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-10-09Merge "Check validity of partition for getvar:partition-type"Treehugger Robot
2018-10-09Merge "Return partition size in hex format."Treehugger Robot
2018-10-09Check validity of partition for getvar:partition-typeHridya Valsaraju
Test: fastboot getvar partition-type:product_services_a Bug: 79480454 Change-Id: I4020b0c94daf8fb86c29104aecc1eb8f44f89999
2018-10-09Return partition size in hex format.Hridya Valsaraju
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
2018-10-08Check maximum allowed download size for download command.Hridya Valsaraju
Bug: 117272937 Test: fastboot flashall Change-Id: Ied34a89129813a7f9fce6d4f48d8b65967558731
2018-10-05Support fastboot variable battery-soc-okHridya Valsaraju
Bug: 79480454 Test: fastboot getvar battery-soc-ok Change-Id: Icfd70a71f1598e437316d4b8f895fd851516febb Merged-In: Icfd70a71f1598e437316d4b8f895fd851516febb (cherry picked from commit 9a1203b7acf7cf3a09ccec022c4698c994143bbd)
2018-09-28Interface with health HAL to read battery voltageHridya Valsaraju
Bug: 78793464 Test: fastboot getvar battery-voltage Change-Id: Ie0763e4f08327ec7649c5629066eb73e8142e0e6
2018-09-28Add support to read fastboot variable 'off-mode-charge'Hridya Valsaraju
Bug: 78793464 Bug: 79480454 Test: fastboot getvar off-mode-charge Change-Id: I4c40847be292e8e2e420340f81bb624b247bc11b Merged-In: I4c40847be292e8e2e420340f81bb624b247bc11b (cherry picked from commit b05d278696cbb25e14085362651999204aa51b40)
2018-09-28Support fastboot variable 'variant'.Hridya Valsaraju
Bug: 79480454 Bug: 78793464 Test: fastboot getvar variant Change-Id: Iefef82c147d8405318c793ad0a73f00674bbb63d Merged-In: Iefef82c147d8405318c793ad0a73f00674bbb63d (cherry picked from commit 4785287a0043ddea2f784433d8a4fc8a168efc79)
2018-09-25Support 'fastboot getvar unlocked' command.Hridya Valsaraju
Test: fastboot getvar unlocked. Bug: 78793464 Change-Id: Ie59c6db90a503e9a6e9ac1c416e4ee5deac60479
2018-09-08Merge "Integrate with fastboot HAL to get partition type"Treehugger Robot
2018-09-07Integrate with fastboot HAL to get partition typeHridya Valsaraju
Bug: 79480454 Bug: 78793464 Test: fastboot getvar partition-type:userdata Change-Id: Ib096ee8061568b8503f3a3f2dbb7e19a932162c4
2018-09-05fastbootd: Implement getvar hw-revision.David Anderson
Bug: 78793464 Test: fastboot getvar hw-revision works fuzzy_fastboot Conformance.GetVarRevision passes Change-Id: I5a3e9893d61e18567f2f818ef06cad8e862d637f
2018-09-05fastbootd: Fix getvar max-download-size formatting.David Anderson
Bug: 78793464 Test: fuzzy_fastboot Conformance.GetVarDownloadSize passes Change-Id: I8f33cb01e5b2ba66eab91b2481322d7fae593cf0
2018-09-04fastbootd: Fix partition size testing issues.David Anderson
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-08-31fastbootd: Implement getvar all.David Anderson
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-31fastbootd: Refactor for getvar all.David Anderson
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-14fastbootd: Complete the implementation of getvar has-slot.David Anderson
Bug: 78793464 Test: fastboot getvar has-slot:super returns "no" Change-Id: I80f171df062c008718b810bbe12070834d4aa3fb
2018-08-09fastbootd: Add is-userspace variable.David Anderson
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-09fastbootd: Add commands for logical partitions.David Anderson
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-09fastbootd: Add support for flashing logical partitions.David Anderson
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
2018-08-09fastbootd: Enable erase and flash commands for physical partitions.David Anderson
Bug: 78793464 Test: adb reboot fastboot && fastboot flashall Change-Id: Ibe802c36f6efe20111a2315616ef34d3a027950f
2018-08-08fastbootd: Allow returning errors from getvar handlers.David Anderson
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
2018-08-08fastbootd: Implement the getvar command.Hridya Valsaraju
This implements basic "fastboot getvar" support, including commands supported by IBootControl. Bug: 78793464 Test: fastboot getvar <fastboot variable> Change-Id: Iee1a7b3f43dea46f80dcdf73c45034e2ffe4727d