summaryrefslogtreecommitdiffstats
path: root/fastboot
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Fix non-aio USB read issue for fastbootd" into qt-devTreeHugger Robot2019-05-291-1/+2
|\
| * Fix non-aio USB read issue for fastbootdchihhao.chen2019-05-291-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | non-aio USB read function was stuck in a loop waiting for more data because data length parameter is always set 64 for fastbootd commands. It should be a normal case to get less data than expected since lengths of these commands are usually less than 64. Add logic to check this and one more parameter to distinguish fastbootd from general adbd case. Bug: 133189029 Test: try various fastbootd commands Change-Id: I6690324840d78f3f1e04235040301520329976db
* | fastbootd: reduce USB buffer size to 16KHridya Valsaraju2019-05-221-1/+1
| | | | | | | | | | | | | | | | | | | | Some USB controllers can only support transfers upto 16K. Bug: 133208811 Test: fastboot flashall Change-Id: Ic025bdd8e7a6cf2634fc24524fd189e0cc9efbb5 Merged-In: Ic025bdd8e7a6cf2634fc24524fd189e0cc9efbb5 (cherry picked from commit d747dba9c0fd5bb81e4b616cfb562a10c64b9e54)
* | Merge "Get max-download-size from device during fastbootd for ↵TreeHugger Robot2019-05-211-0/+4
|\ \ | | | | | | | | | flashall/update" into qt-dev
| * | Get max-download-size from device during fastbootd for flashall/updateHridya Valsaraju2019-05-201-0/+4
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, during a 'fastboot flashall/fastboot update', the 'getvar max-download-size' command is issued once to the device when it is in bootloader mode and the same value is used even after the device boots into fastbootd. If the max-download-size returned by bootloader is greater than the max-download-size in fastbootd, this could break flash as large images are broken down into chunks before downloading by using the max-download-size variable. This will cause fastbootd to return an error since it checks whether the buffer being downloaded has a size greater than the max-download-size limit. Test: fastboot flashall Bug: 132917902 Change-Id: Ife7c1ec0583d80d4a31ecf01f1fc14a8365afe0d Merged-In: Ife7c1ec0583d80d4a31ecf01f1fc14a8365afe0d (cherry picked from commit 83d856e4c59b6c02eeb7d468892b157a13f7cbf5)
* | Merge "Allow CreateResizeDeleteLP test case to run on non-A/B devices" into ↵TreeHugger Robot2019-05-151-5/+18
|\ \ | | | | | | | | | qt-dev
| * | Allow CreateResizeDeleteLP test case to run on non-A/B devicesHridya Valsaraju2019-05-151-5/+18
| |/ | | | | | | | | | | | | | | | | Test: fuzzy_fastboot --gtest_filter=*Logical* Bug: 117220134 Change-Id: Ic7c2b246b7c5646d3589f8f57eceb9ba5feeef2b Merged-In: Ic7c2b246b7c5646d3589f8f57eceb9ba5feeef2b (cherry picked from commit f81bd17179c039ee19cbc5e0b32dafd4c7032d63)
* | Allow fuzzy_fastboot number to run for a specific device serial numberHridya Valsaraju2019-04-123-8/+18
| | | | | | | | | | | | | | | | Test: ./fuzzy_fastboot --serial=826X003L --gtest_filter=*Logical* Bug: 117181762 Change-Id: I9dec510aa604b7994f25ce26edb87d7f6ec3e875 Merged-In: I9dec510aa604b7994f25ce26edb87d7f6ec3e875 (cherry picked from commit b9051a3e6559b14759015d679c97d0e9e5fad9a4)
* | Test is-logical command for vendor and boot partitions.Hridya Valsaraju2019-04-081-7/+17
| | | | | | | | | | | | | | | | | | | | | | Vendor must be a logical partition and boot must not be a logical partition. Test: fuzzy_fastboot --gtest_filter=*Logical* Bug: 117220134 Change-Id: Ifc6f2f715ca92cd1fe779e8fce2d6a10a1f140b9 Merged-In: Ifc6f2f715ca92cd1fe779e8fce2d6a10a1f140b9 (cherry picked from commit 61a5bc6cf4cf22186505d87db31a449ed960818e)
* | Open image files in binary modeHridya Valsaraju2019-04-041-1/+1
|/ | | | | | | | | | | | | This is required for read() to function correctly in Windows since it behaves differently in text mode and binary mode and may cause unpredictable behavior depending on the contents of the image file. Bug: 129281908 Test: fastboot.exe flashall Change-Id: I64370af44a050bafea60ff1b0b2be18cc531480a Merged-In: I64370af44a050bafea60ff1b0b2be18cc531480a (cherry picked from commit 1a6f6feff425edf6076269c0f971675fa41de56c)
* fastboot: Avoid extra std::string copiesGreg Kaiser2019-03-261-2/+2
| | | | | | | | The function do_for_partitions() takes a const std::string reference, so it's inefficient to pass a std::string::c_str(). Test: TreeHugger Change-Id: Ia84ed9ec691ee2f524c61dd25a81b2995bb0bb33
* Merge "Fuzzy_fastboot must set back the original slot after test"Hridya Valsaraju2019-03-222-0/+6
|\
| * Fuzzy_fastboot must set back the original slot after testHridya Valsaraju2019-03-182-0/+6
| | | | | | | | | | | | | | Test: ./fuzzy_fastboot --gtest_filter=Conformance.SetActive Bug: 117220134 Change-Id: I1fb6975dda52ace3e6d2a81a50cba5ff55310818
* | Add more tests for dynamic partitionsHridya Valsaraju2019-03-191-0/+55
| | | | | | | | | | | | Test: ./fuzzy_fastboot --gtest_filter=LogicalPartitionCompliance* Bug: 117220134 Change-Id: Ica489b0f9b252b2981cd44676bb892ded977de22
* | Add a test for logical partitions.Hridya Valsaraju2019-03-193-18/+57
| | | | | | | | | | | | | | Test: ./fuzzy_fastboot --gtest_filter=LogicalPartitionCompliance* Bug: 117220134 Change-Id: Ib68f98ec5c8c402f9a80139134a0118ab65f8cd3
* | fastboot: reset timeout if INFO is received during long commandsDima Zavin2019-02-281-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As part of a refactor, commit db511207ed3b2bb4fc422ef83868009b03692e61 added a timeout for receving responses for commands. Unfortunately, the timeout is optimistic as to how quickly target devices can complete such operations. Flash and erase commands can be quite slow on devices with traditional flash chips. The fastboot protocol is already adept at handling such cases because it allows for sending INFO packets during these periods. We may receive one or more INFO packets during tehse long operations. Every time we receive an INFO packet, it proves the remote end is alive, but busy, which should reset our timeout timer. Change-Id: Ia3bba21c497b22639b626d89711ecd4eb02504ed Signed-off-by: Dima Zavin <dmitriyz@waymo.com>
* | fastboot: switch the timeout clock source to steady_clockDima Zavin2019-02-281-2/+2
|/ | | | | | | | Previously, system_clock was used for remote command timeouts which can get disturbed by NTP adjustments (jumps). Change-Id: I0ffc159bf34d12e8d3713044524114d60a6a45ca Signed-off-by: Dima Zavin <dmitriyz@waymo.com>
* fastboot: Fix "fastboot gsi".David Anderson2019-01-292-7/+50
| | | | | | | | | | | | This command erroneously reports that no GSI is installed, because /metadata is not mounted in recovery. To address this, temporarily mount /metadata when the gsi command is invoked. Bug: 122556707 Test: fastboot gsi disable fastboot gsi wipe Change-Id: Ib21971b49b46fd580b902ff75f01cfb96192afc0
* Remove the rest of users of the old style fstabTom Cherry2019-01-281-8/+10
| | | | | | | | And deprecate one more old style function that is not used after this change. Test: boot, disable and enable verity Change-Id: Id509f479850120352b4ea4dc3b6c40f6e8e2e53e
* Make 'fastboot boot' command support boot header version 2Hridya Valsaraju2019-01-253-18/+46
| | | | | | | | | | | | | New arguments 'dtb' and 'dtb-offset' have been added to support boot image header version 2 for the 'fastboot boot' and 'fastboot flash:raw boot' commands. Test: fastboot boot Image.lz4 --dtb <dtb_path> --header-version 2 Test: fastboot flash:raw boot Image.lz4 --dtb <dtb_path> --header-version 2 Bug: 111136242 Change-Id: Idf5c2eb138609dc7e915e80c4db64677c89f24b6
* fastbootd: Add command to remove GSI installsDavid Anderson2019-01-176-0/+35
| | | | | | | | | | 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
* fastbootd: Better error message when boot_devices is missing.David Anderson2018-12-201-0/+5
| | | | | | Bug: 121333158 Test: N/A Change-Id: Ifac7ae382d9e57864f6a3915987300eb91355293
* Merge "fastbootd: Only flash slots listed by the boot control HAL."Treehugger Robot2018-12-184-6/+14
|\
| * fastbootd: Only flash slots listed by the boot control HAL.David Anderson2018-12-184-6/+14
| | | | | | | | | | | | | | | | Bug: N/A Test: flash when metadata slot count is >2 Change-Id: I67481be0de162cab5da8d32c2e318489427f1932 Merged-In: I67481be0de162cab5da8d32c2e318489427f1932 (cherry picked from commit 8568dcb057d63023feca09b031e456592c133f0e)
* | Fix performance-for-range-copy warningsChih-Hung Hsieh2018-12-111-11/+11
| | | | | | | | | | | | Bug: 30413223 Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,performance* Change-Id: I3ad102f2b0f971266d57488a3bd57d312f7ee3e6
* | Merge "fastboot: Wait for reboot-fastboot to complete before signaling success."David Anderson2018-12-081-5/+5
|\ \
| * | fastboot: Wait for reboot-fastboot to complete before signaling success.David Anderson2018-12-071-5/+5
| | | | | | | | | | | | | | | | | | Bug: N/A Test: manual test Change-Id: I07495c1befcf63607c9996d6da6b4df05c060641
* | | fastboot: Check if super_empty.img exists before reading it.David Anderson2018-12-041-1/+1
|/ / | | | | | | | | | | | | | | | | | | On non-DAP devices, fastboot flash <partition> will spam error messages about not being able to read super_empty.img. We should check that super_empty.img exists before trying to read it. Bug: 120429424 Test: fastboot flash system on non-DAP device Change-Id: I6c4eec19cb3ef8d24595a75e072e1d75baaa8cdd
* | Merge "C++17 is the default now."Treehugger Robot2018-12-041-3/+0
|\ \
| * | C++17 is the default now.Elliott Hughes2018-12-031-3/+0
| | | | | | | | | | | | | | | Test: builds Change-Id: I6814455e9ad2cdcf99ad66de38a3ad0bfb440d80
* | | fastboot: call fs_mgr_overlayfs_teardown() in UpdateSuperMark Salyzyn2018-12-031-0/+2
|/ / | | | | | | | | | | | | | | | | | | | | When the update-super command is issued, we want overlayfs overrides to disappear without a doubt, which includes non-A/B utilizing /cache/overlay/ tree. Call fs_mgr_overlayfs_teardown() on successful return. Test: adb-remount-test.sh Bug: 120034852 Change-Id: Ia5cdb797f7e8350b5591a51fc8ae5f323901aee4
* / fastboot: Delete logical "other" partitions on retrofit devices.David Anderson2018-11-281-0/+23
|/ | | | | | | | | | | | | | | | | | | | | | On retrofit devices, if both slots contain dynamic partition builds, then "flashall" will attempt to write secondary images to dynamic partitions in the other slot. At worst, this can fail with an error. At best, it will result in the "other" partition not being mounted on first boot. This patch therefore deletes logical partitions for secondary images, on retrofit devices only. On a Pixel device on the "b" slot, this means "system_a" and "vendor_a" will be deleted before flashing, and therefore system_other and vendor_other will be flashed to physical partitions instead. Bug: 120034852 Test: fastboot set_active a fastboot flashall fastboot set_active b fastboot flashall Change-Id: I6affe9a6c639b0495bffc77fcf20f329b86ad159
* Merge changes Ic4e1a1de,Icfceaa46Treehugger Robot2018-11-281-10/+8
|\ | | | | | | | | | | * changes: fastboot: propagate error for format command fs_mgr: overlayfs: resize scratch should it be too small
| * fastboot: propagate error for format commandMark Salyzyn2018-11-271-10/+8
| | | | | | | | | | | | | | | | If fastboot format command fails, return error. Test: adb-remount-test.sh Bug: 109821005 Change-Id: Ic4e1a1dea8861028f19ac7f9c834d26e8adba56c
* | fastboot: do not die if ANDROID_PRODUCT_OUT undefinedDavid Anderson2018-11-281-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When checking for existence of "super_empty.img" to determine if flash image product set is meant for logical partitions, we die if ANDROID_PRODUCT_OUT environment is unset or empty. This check is done before we look at the flash image name to determine if it is a candidate to look at the logical metadata. Instead, allow this check to conservatively fail for now. Test: export ANDROID_PRODUCT_OUT= fastboot flash bootloader Bug: 120041144 Change-Id: I43f124015f9d26c79a0feb9123522432fe937343 Merged-In: I43f124015f9d26c79a0feb9123522432fe937343
* | Merge "make_f2fs: use -g android by default"Jaegeuk Kim2018-11-281-7/+2
|\ \ | |/ |/|
| * make_f2fs: use -g android by defaultJaegeuk Kim2018-11-221-7/+2
| | | | | | | | | | | | Bug: 119875846 Change-Id: I0c6d642d474df5cc678ced9ec4c04027ee51c6d1 Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
* | Merge "Switch from dist-for-goals to dist in Android.bp"Treehugger Robot2018-11-272-5/+8
|\ \ | |/ |/|
| * Switch from dist-for-goals to dist in Android.bpDan Willemsen2018-11-192-5/+8
| | | | | | | | | | | | | | Removes a few more Android.mk files. Test: check for adb, mkbootfs, and fastboot in the build artifacts Change-Id: Ie4e50a363a734d0b9207f0d0098c54719f038e76
* | Merge "fastbootd: Support two super partitions for retrofit devices."David Anderson2018-11-215-50/+102
|\ \
| * | fastbootd: Support two super partitions for retrofit devices.David Anderson2018-11-205-50/+102
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Warn when flashing dynamic partitions in the bootloader.David Anderson2018-11-203-0/+52
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On retrofit devices, it is easy to accidentally overwrite system/vendor/product by flashing system in the bootloader. The reason is that GPT system_a is really the super partition, and the bootloader doesn't know it. Addressing this in bootloaders would require two separate commands: one that rejects flashing system/vendor/product, and another for expert/factory use that would allow direct flashing. This patch introduces protection into the host fastboot tool instead. It's not mutually exclusive with bootloader changes; having protection in the host tool affords us better and consistent UI. However it does rely on users having newer builds. With this change, the following will not work in the bootloader: fastboot flash system # or vendor, product, etc The message is the same whether or not the device is a retrofit. To continue anyway, you can do: fastboot flash --force system If we decide on bootloader protection as well, the --force flag can be re-used. Bug: 119689480 Test: fastboot flash system # disallowed in bootloader, allowed in fastbootd fastboot flash --force system # allowed in bootloader Change-Id: I0861e3f28a15be925886d5c30c7ebd4b20c477cf
* switch to using android-base/file.h instead of android-base/test_utils.hMark Salyzyn2018-11-141-1/+0
| | | | | | Test: compile Bug: 119313545 Change-Id: I4f7ad84743e974b4b4d1d7256088f6c8b749a237
* fastboot: pin USB interface versions on darwin.Eran Messeri2018-11-111-10/+10
| | | | | | | | | Similar to the change to adb in Id26760bc62c89a1f7ef67511b21f9d9252ab69f3, pin the interface version to IOUSBFamily 5.0.0. Bug: 119264733 Test: Manual Change-Id: Ied9164532c0ba6f20415dafecb0c774578aa5c57
* fastboot: Query the name of the super partition.David Anderson2018-11-065-26/+22
| | | | | | | | | | | | | | 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
* fastboot: Fix flashing both slots with dynamic partitions.David Anderson2018-11-062-8/+38
| | | | | | | | | | | | | | | | | | When updating the super partition, attempt to preserve partitions from the other slot. If any partition can't be preserved, fail and require a wipe (-w) to proceed. This allows two bootable builds to be flashed to both slots. The preserve operation can fail if the metadata is not compatible with the old partition layout. For example, if the partition references a group that no longer exists, or a group changed its capacity, or the metadata's block device list or list contents changed. Bug: N/A Test: liblp_test gtest fastboot flashall --skip-secondary Change-Id: I53fdd29bc1f0ef132005a93d3cf1cdcd7f2fc05f
* fastbootd: Partition commands should update all metadata slots.David Anderson2018-11-011-4/+7
| | | | | | | | | | | | Without this, it is much more difficult to ensure that the "a" and "b" slots are both bootable during development. We already update all metadata slots for update-super, so we should here as well. Bug: N/A Test: fastboot flashall fastboot set_active other fastboot flashall Change-Id: Ib661e35fa89171a68a0b1da195dc5ba0375d72e4
* Merge "fastboot: wipe overlayfs for partition"Treehugger Robot2018-10-271-2/+30
|\
| * fastboot: wipe overlayfs for partitionMark Salyzyn2018-10-261-2/+30
| | | | | | | | | | | | | | | | | | | | Arrange to delete the overlayfs backing when a specified partition has been flashed. Test: manual Bug: 109821005 Bug: 117605276 Change-Id: I1c6a0341c6cd2ecfbb7c71bec5679a74d579aadd
* | Merge "fastbootd: Remove metadata merging code."David Anderson2018-10-262-40/+5
|\ \