summaryrefslogtreecommitdiff
path: root/fastboot/device
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-08-11fastbootd: Delete all VAB partitions during "flashall".David Anderson
With VAB we encourage a smaller super partition, so make sure we delete "other" slot partitions during flashing. Otherwise, we may not have enough space in super. Bug: 195930130 Test: set_active, flashall, ensure other slot is deleted Change-Id: Ic6a4f60e8f4c7abb8af7b38228753ad8ed85eedf Merged-In: Ic6a4f60e8f4c7abb8af7b38228753ad8ed85eedf
2021-04-13Merge "Unable to mount filesystem in fastbootd mode on the user build."David Anderson
2021-03-30Unable to mount filesystem in fastbootd mode on the user build.joker.yang
for GSI XTS self-test, we need to mount filesystem(/metadata) in fastbootd mode. so we add a qualification since there is no overlayfs on user build anyway. bug: 181097763 Change-Id: Ie36bd2f5b3981e6774dc4a2123c33180cddb99d1
2021-03-25fastboot: derive device locked state from Android propertyOleg Matcovschi
We shall rely on Android property instead of parsing kernel command line directly: parameters could be originated from kernel command line or bootconfig. Bug: 183237066 Bug: 183719613 Signed-off-by: Oleg Matcovschi <omatcovschi@google.com> Change-Id: Ia70d286646a83a95967ca4293168a6550ffff7f0
2021-03-22fastboot device: Disallow implicit conversion from unique_fd to int.Yifan Hong
Do not use the implicit cast from unique_fd to int so that it is clearer to the reader what the ownership model is. Test: pass Change-Id: I66563eb2bd06f6a712a5afd4c6009f9b25a55de6
2021-03-17fastboot driver: add fetch command in driverYifan Hong
The `fastboot fetch` command is a wrapper around the fetch protocol. It: - getvar max-fetch-size - get the size of the partition - read the data by chunks, chunk size = max-fetch-size. The name of the partition is passed directly to the device (with the usual has-slot magic for flashing etc.) If we support fetching partitions other than vendor_boot in the future, no change in the driver is needed. Bug: 173654501 Test: manual Change-Id: Ie576eea668234df236b096a372e65c5e91c1e48c
2021-03-17fastbootd: add O_CLOEXEC/O_BINARY for OpenPartitionYifan Hong
O_CLOEXEC ensures fastbootd does not leak fds to the parent process (recovery). O_BINARY has no effect in Linux, but it is explicit that the file (partition) to read is a binary file. Test: pass Bug: 173654501 Change-Id: Idba922965ce666af1b7ee460ec7449fabd511c35
2021-03-17fastbootd: add read arg to OpenPartitionYifan Hong
Allow it to read partitions. Bug: 173654501 Test: pass Change-Id: I115e84734dd258243ca3f4f1b373b06adcaa4080
2021-03-17fastbootd: Add fetch command on deviceYifan Hong
Test: manual Test: see follow up CL on fuzzy_fastboot Bug: 173654501 Change-Id: I912d60d6dca0082734f2b84adc6a647c881bb5a1
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
2021-03-06Merge "fastbootd: Fix USB transport data is repeated every 256K"Treehugger Robot
2021-03-05fastbootd: Fix USB transport data is repeated every 256KYifan Hong
When Write() is called on data > 256K, the written data repeats every 256K because of the buggy line in this change. Test: fastboot fetch vendor_boot.img Fixes: 180654366 Change-Id: I33b129de27000d3f32f284469998daf540d4f856
2021-02-04Add support for compressed snapshot merges in fastboot.David Anderson
SnapshotManager::New() is now preferred in recovery. Previously we used NewForFirstStageMount(), which is technically incorrect as that enables code paths specifically for first-stage init. We also explicitly label the snapuserd context, since rootfs in recovery has unlabelled files. Finally, we add a timeout to internal calls to CreateSnapshotsAndLogicalPartitions. Without this, WaitForDevice() calls will terminate immediately, which breaks VABC given the more complex device stacking that is created. Bug: 168258606 Test: fastboot snapshot-update merge Change-Id: I3a663b95c0b1eabaf14e6fde409c6902653c3c5e
2020-12-02Merge rvc-qpr-dev-plus-aosp-without-vendor@6881855Xin Li
Bug: 172690556 Merged-In: I22cc7bb8ac579d0e03f92ec5a16e8c0f2c768051 Change-Id: Ide85f5a8acd02dead55dc87f9d6a80b3261027b4
2020-10-28Refactor fs_mgr_overlayfs_teardown()Yo Chiang
Right now fs_mgr_overlayfs_teardown() does slightly different things when called from the userspace or recovery. This is accomplished by many runtime checks, runtime assumptions and conditional execution of code. This makes the control flow of the function very hard to follow, and assumptions becomes more fragile as the function becomes more complex. This CL forks fs_mgr_overlayfs_teardown() and removes "recovery" bits from it. A new entry point TeardownAllOverlayForMountPoint() is added for recovery. Recovery (fastbootd) should call TeardownAllOverlayForMountPoint() to teardown overlays of all sources (cache dir, scratch device or DSU). While fs_mgr_overlayfs_teardown() should only be called from the userspace. Also apply some linter suggestions. Bug: 165925766 Test: adb-remount-test.sh Change-Id: I7ff7e3409c910782e1ec207fcd02b967a9762bc1
2020-10-12fastbootd: Add more logging for when the USB transport fails.David Anderson
Bug: 161542676 Test: fastboot flashall Change-Id: Ief4e7452b72504c51c807dd38a07765ad65c96a4
2020-10-01fastboot: add new oem command for post wipe userdatajosephjang
When Android userdata partition has been erased in fastbootd, call oem specific API doOemSpecificErase() to wipe other userdata in device. If oem doesn't implement this specific API in fastboot_hal lib, fastbootd will receive 'NOT_SUPPORTED' return status. Bug: 169173873 Change-Id: I9b6a5a4aaed31d1168e633418b189f9bb6d34d01
2020-09-25Merge "fastboot: add new oem command for post wipe userdata" into ↵TreeHugger Robot
rvc-qpr-dev am: 46ef208603 Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/12626459 Change-Id: Ieae4b452be87163f15589bf8ae081e507ded8f2b
2020-09-25fastboot: add new oem command for post wipe userdatajosephjang
When user input fastboot erase userdata, need a follow up oem command to wipe other user data in device. We support this new postwipedata command in "fastboot erase userdata" only. Bug: 150929955 Change-Id: I9b6a5a4aaed31d1168e633418b189f9bb6d34d01 Ignore-AOSP-First: I9b6a5a4aaed31d1168e633418b189f9bb6d34d01
2020-05-29Merge "fastboot: Allow fastboot to asynchronously differentiate between ↵David Anderson
fastboot and fastbootd."
2020-05-28fastboot: Allow fastboot to asynchronously differentiate between fastboot ↵David Anderson
and fastbootd. It's not possible to programmatically determine which fastboot mode a device is in, without sending a getvar:is-userspace query. Unfortunately this is not possible asynchronously, and may interrupt other queries being processed. This patch changes fastbootd's USB interface name to "fastbootd". Note that tools use the protocol number/class and not this string, so it should be safe to extend. When using "fastboot devices", the interface name is now listed if set. Note that currently only the Linux version of the fastboot tool is capable of reading the interface name. Bug: 156966319 Test: fastboot devices on Linux Change-Id: I57ccf2bec1dda573fe3ac628a646624b76f45905
2020-05-19fastbootd: Support TCP protocol.Hongguang Chen
The current fastbootd only supports USB protocol. But some Android TV devices are built without USB port. The fastbootd cannot be used on those ATV devices due to it. This change adds TCP protocol for such devices and fastbootd.protocol property is added to control which protocol to use. BUG: 152544169 BUG: 155198345 Test: manual test. Change-Id: Idc391e677eb6a1880036419ba5f6c4160e8dbcbc Merged-In: Idc391e677eb6a1880036419ba5f6c4160e8dbcbc
2020-05-18Merge "fastbootd: Support TCP protocol."Treehugger Robot
2020-05-18Merge "fastbootd: copy AVB footer on boot image to end of block device" into ↵TreeHugger Robot
rvc-dev
2020-05-17fastbootd: copy AVB footer on boot image to end of block deviceSteve Muckle
If the flashed boot image is smaller than the block device, the AVB footer will not be at the end of the partition. Although images are normally created to match the partition size the GKI boot.img must work on all devices, and the size of the boot partition will vary. Copy the AVB footer to the end of the partition before flashing, if it is not there already. Bug: 156036850 Change-Id: I11f0c7d32d1b6c74edd4f84f815d175605280cb8 Merged-In: I11f0c7d32d1b6c74edd4f84f815d175605280cb8
2020-05-13fastbootd: Support TCP protocol.Hongguang Chen
The current fastbootd only supports USB protocol. But some Android TV devices are built without USB port. The fastbootd cannot be used on those ATV devices due to it. This change adds TCP protocol for such devices and fastbootd.protocol property is added to control which protocol to use. BUG: 152544169 Test: manual test. Change-Id: Idc391e677eb6a1880036419ba5f6c4160e8dbcbc
2020-05-12fastbootd: copy AVB footer on boot image to end of block deviceSteve Muckle
If the flashed boot image is smaller than the block device, the AVB footer will not be at the end of the partition. Although images are normally created to match the partition size the GKI boot.img must work on all devices, and the size of the boot partition will vary. Copy the AVB footer to the end of the partition before flashing, if it is not there already. Bug: 156036850 Change-Id: I11f0c7d32d1b6c74edd4f84f815d175605280cb8
2020-05-04fastboot: Fix snapshot-update merge behavior.David Anderson
When merging in recovery, the "imminent data wipe" code was used, which made the assumption the /metadata and /data state would be zapped. This caused future OTAs to error because the old snapshots were detected. This CL allows OTAs to proceed even if unexpected snapshots are present. It also forces the state to "MergeCompleted" after a merge in recovery, so that the next normal boot can perform cleanup. Bug: 155339165 Test: fastboot snapshot-update merge, then take another OTA vts_libsnapshot_test Change-Id: Ief6dea3ba76323044e61307272dda320a4494aea Merged-In: Ief6dea3ba76323044e61307272dda320a4494aea
2020-05-02fastboot: Fix snapshot-update merge behavior.David Anderson
When merging in recovery, the "imminent data wipe" code was used, which made the assumption the /metadata and /data state would be zapped. This caused future OTAs to error because the old snapshots were detected. This CL allows OTAs to proceed even if unexpected snapshots are present. It also forces the state to "MergeCompleted" after a merge in recovery, so that the next normal boot can perform cleanup. Bug: 155339165 Test: fastboot snapshot-update merge, then take another OTA vts_libsnapshot_test Change-Id: Ief6dea3ba76323044e61307272dda320a4494aea
2020-04-01Merge changes from topic "minadbd_static_libadbd" into rvc-devTreeHugger Robot
* changes: Statically link libadbd into minadbd. adb: temporarily kill adb_benchmark. Move adbd's legacy USB implementation to fastboot.
2020-03-31Move adbd's legacy USB implementation to fastboot.Josh Gao
This code path is effectively dead in adbd, and fastboot's dependency on libadbd makes it hard to refactor adbd's dependencies. Bug: http://b/150317254 Test: built and flashed aosp_walleye-eng Change-Id: I5118136d32fdcbbd011559ed0a4a71e1dc7bf064 Merged-In: I5118136d32fdcbbd011559ed0a4a71e1dc7bf064 (cherry picked from commit 0871824de6c5b868f2a2e67c9b5673cb2181b4c6)
2020-03-31fastbootd: Unmount /cache before flashing.David Anderson
Bug: 150112538 Test: fastboot flash cache on non-A/B device Change-Id: I8a86bc4d12e4b3be020bbe47e02262a5aaa913a7 Merged-In: I8a86bc4d12e4b3be020bbe47e02262a5aaa913a7
2020-03-31fastbootd: sync() after flashing partitions or updating superTom Cherry
There is a chance that devices are failing to reboot in the lab due to sync() taking explicitly long during reboot. Let's add the sync()'s here to ensure they get accounted for in the flashing process. A side benefit is it's likely safer to sync immediately after flashing than to hope init does it during reboot. Bug: 150863651 Test: flash local devices successfully Change-Id: I4c4b0114f3cde8af4b8b2cb283ec21f869ef9f6f
2020-03-30Move adbd's legacy USB implementation to fastboot.Josh Gao
This code path is effectively dead in adbd, and fastboot's dependency on libadbd makes it hard to refactor adbd's dependencies. Bug: http://b/150317254 Test: built and flashed aosp_walleye-eng Change-Id: I5118136d32fdcbbd011559ed0a4a71e1dc7bf064
2020-03-25fastbootd: Unmount /cache before flashing.David Anderson
Bug: 150112538 Test: fastboot flash cache on non-A/B device Change-Id: I8a86bc4d12e4b3be020bbe47e02262a5aaa913a7
2020-03-03fastbootd: use FastbootDevice::GetCurrentSlot to get current slot suffixHridya Valsaraju
Using FastbootDevice::GetCurrentSlot to get the current slot suffix instead of reading the same from the device's boot control HAL is required to account for the prior set_active commands issued via fastbootd in the same boot. Test: fuzzy_fastboot --gtest_filter=Conformance.Slots:Conformance.SetActive --gtest_repeat=10 Bug: 146589281 Change-Id: I2edb0f024d93c2483659623423ef5c69c717c7af Merged-In: I2edb0f024d93c2483659623423ef5c69c717c7af
2020-03-02fastbootd: use FastbootDevice::GetCurrentSlot to get current slot suffixHridya Valsaraju
Using FastbootDevice::GetCurrentSlot to get the current slot suffix instead of reading the same from the device's boot control HAL is required to account for the prior set_active commands issued via fastbootd in the same boot. Test: fuzzy_fastboot --gtest_filter=Conformance.Slots:Conformance.SetActive --gtest_repeat=10 Bug: 146589281 Change-Id: I2edb0f024d93c2483659623423ef5c69c717c7af
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
2020-01-21Allow fuzzy_fastboot test devices over internetsteven_fann
Bug: 144667236 Test: fuzzy_fastboot --serial=192.168.1.104:5555 --gtest_filter=*Logical* Change-Id: I02e62f706d0a3a19a9b7b56788abe05759d2d63d
2019-12-30fastboot: Mount /metadata before overlayfs teardown.David Anderson
fs_mgr_overlayfs needs access to /metadata to tell whether or not the scratch partition exists on /data. Bug: 134949511 Test: adb remount, fastboot flash system Change-Id: I3a09aae495d691e9c1a1e25a8fb3514e355ecd05
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-31Merge "fastboot: Implement helper commands for Virtual A/B."David Anderson
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
2019-10-23Merge "avoid data overflow in low memory device"David Anderson
2019-10-23avoid data overflow in low memory deviceJeiFeng Lee
Bug: 142294642 Test: fastboot flash system system.img Change-Id: Iec50817aaca5d31c194f0fdf409503829d14ca06
2019-09-11fastbootd: skip COW groupYifan Hong
Skip importing COW group because they are dynamically created by OTA clients and will never show up in built images. Test: flash Change-Id: I44e7693cfb4c15e64455b56212a02f9abde88d61
2019-08-27fastbootd: Cancel snapshots when modifying partitions.David Anderson
When flashing or resizing partitions, remove the LP_PARTITION_ATTR_UPDATED flag. This will cause first-stage init to skip any snapshots for that partition, and the backing storage (if any) will later be reclaimed. Bug: 139155473 Test: manual test Change-Id: I3b185f68dfecb5a93636af0b5ae289ead1363fd0