summaryrefslogtreecommitdiff
path: root/fastboot
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-06-09fastboot: support vbmeta_vendor.imgBowgo Tsai
Bug: 181909612 Bug: 190564127 Test: build Change-Id: If61fff1c83513d71605c0cef2737a38f7575d69b Merged-In: If61fff1c83513d71605c0cef2737a38f7575d69b (cherry picked from commit a48a78356fa59c94e61482ab5bc39532530bac58)
2021-04-20Use libgtest_prod_headers.Elliott Hughes
Bug: http://b/185916167 Test: treehugger Change-Id: I9ece5926944b8c881e3a117cda2c99281c59b61e
2021-04-13Merge "Unable to mount filesystem in fastbootd mode on the user build."David Anderson
2021-04-12Merge "fastboot: Add a few missing fastboot commands from help"David Anderson
2021-04-12Merge "libsnapshot: Add diagnostics for DM_DEV_REMOVE failures."David Anderson
2021-04-12fastboot: Add a few missing fastboot commands from helpLuca Stefani
Test: m, fastboot help Change-Id: I8c40ad25123470ea214b9d93d7305945973a2b0b
2021-04-08libsnapshot: Add diagnostics for DM_DEV_REMOVE failures.David Anderson
Example log line: update_engine: Block device was lazily unmounted and is still in-use: /dev/block/dm-28; possibly open file descriptor or attached loop device. This will help diagnose bugs such as b/184715543 in the future. Bug: N/A Test: manual test Change-Id: Ia6b17fe9bd1796d59be7fc0b355218509acfd4af
2021-04-06fastboot: use --force to bypass requirementsAndrew Chant
Allow using --force to bypass flashing requirements from android-info.txt. We often provide builds to deviceholders who don't have an exact matching bootloader or radio image and it is unimportant. Having the option to override is useful. This shouldn't affect bootloader.img so should never prevent a device from returning to fastboot in case of gross error. Test: Downloaded a build w/ different radio. Got the following output: ... Checking 'version-baseband' FAILED Device version-baseband is 'xyz'. Update requires 'abc' or '123'. requirements not met! but proceeding due to --force Setting current slot to 'a' OKAY [ 0.065s] Bug: 184661990 Change-Id: I8680b8275b854304026cff3b2e663b7ef2594383
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-29Merge "fastboot: Don't fail when unable to get boot partition size"David Anderson
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-25fastboot: Refactor bootimg_utils.cpp:mkbootimg()Yi-Yo Chiang
Change mkbootimg() to return void, as we already have a |out| parameter. Bug: 183455415 Test: Presubmit Change-Id: I51439e273752ab9e21f8d7138e900ea55bdfdfc0
2021-03-25fastboot: [boot] and [flash:raw] command support boot v4Yi-Yo Chiang
Boot v4 is mostly compatible with boot v3, so these minimal changes should be sufficient. The newly introduced field of v4, signature_size, is left zero because this field is only meant to be read by VTS testcases, so the value doesn't matter for the debugging purposes of boot and flash:raw. Bug: 183455415 Test: Manual Change-Id: I5c2737ce35dd25f318b19a429de805ea16c46607
2021-03-24Merge "fastboot driver: ftrucate64->ftruncate."Treehugger Robot
2021-03-24fastboot: Don't fail when unable to get boot partition sizeMichael Bestas
* Some devices don't report boot partition size Change-Id: If83f785e235569ee8ef0de2b37f11dbd2a9a71f4
2021-03-24Merge "fastboot driver: add virtual dtor to ImageSource."Treehugger Robot
2021-03-23fastboot driver: ftrucate64->ftruncate.Yifan Hong
Also, -D_FILE_OFFSET_BITS=64 so that off_t is always 64 bits. This fixes mac build. Test: forrest Change-Id: I584e136a5f3ca9874fd5364cc4c93f8b1e8feb19
2021-03-23Merge "fastboot device: Disallow implicit conversion from unique_fd to int."Treehugger Robot
2021-03-23Merge "fastboot driver: Disallow implicit conversion from unique_fd to int."Treehugger Robot
2021-03-23Merge "fastboot driver: Fix fd ownership."Treehugger Robot
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-22fastboot driver: 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: Iaf40a6eed3fcfd001651980c865ed5efb85ac0eb
2021-03-22fastboot driver: Fix fd ownership.Yifan Hong
load_sparse_files assumes that the client maintains the lifetime of the input fd is longer than the output sparse_file handle. Bug: 183409401 Bug: 183223098 Test: flash super image Change-Id: I295b912c665577b5767a133f3148e58a22733998
2021-03-22[LSC] Add LOCAL_LICENSE_KINDS to system/coreBob Badour
Added SPDX-license-identifier-Apache-2.0 to: fastboot/testdata/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Exempt-From-Owner-Approval: janitorial work Change-Id: I32847c8706facb4fe46ea8d4d6089a629cee2321
2021-03-19fastboot driver: add virtual dtor to ImageSource.Yifan Hong
Test: Treehugger Change-Id: Ia91d6d344186a07d90e3983c153d8170859eed5b
2021-03-19fastboot driver: Avoid use after std::move()Greg Kaiser
Test: TreeHugger Change-Id: I2857f6d6384c8c80809f21202dbbbfc9ed71beeb
2021-03-17fuzzy_fastboot: Add tests for fetch:vendor_bootYifan Hong
Test: run test against bootloader Test: run test against fastbootd Bug: 173654501 Change-Id: Ia3182b4f4390048139d2cafe9b1654b6fb92eb7b
2021-03-17fuzzy_fastboot: Add conformance test for getvar:max-fetch-size.Yifan Hong
Test: run against bootloader Test: run against fastbootd Bug: 173654501 Change-Id: Ide38eee6b801110fef52f0f9213c038a72c775f2
2021-03-17fastboot driver: repack vendor boot ramdiskYifan Hong
When a user issues `fastboot flash vendor_boot:foo ramdisk.img`, the fastboot driver fetches the vendor_boot image from the device, determines if `foo` is a valid vendor ramdisk fragment, repacks a new vendor boot image, then flash the vendor boot image back. This requires vendor boot header V4. As a convinent alias, `fastboot flash vendor_boot:default ramdisk.img` flashes the whole vendor ramdisk image. This works on vendor boot header V3 & 4. Fixes: 173654501 Test: pass Change-Id: I42b2483a736ea8aa9fd9372b960502a642934cdc
2021-03-17fastboot driver: Allow colon in partition name when flashingYifan Hong
If fastboot flash vendor_boot:default, only call has-slot on the first token, and append slot to the first token only. Test: fastboot flash vendor_boot:default Bug: 173654501 Change-Id: I8ff7b3a0bafb964792ab8a788d64d14bc47ae83d
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-17fastboot driver: RunAndReadBuffer don't allocate too much memYifan Hong
Instead of allocating the buffer for the whole upload (which can be arbitrary number of bytes as the device determines), read 1 MiB at a time. Test: pass Bug: 173654501 Change-Id: Ib601b0341b10b7dccbb429cd21aad86a2d3bfda8
2021-03-17fastboot driver: add RunAndReadBuffer helperYifan Hong
Refactor UploadInner and add a new RunAndReadBuffer helper function that handles the generic procedure of: 1. Sending a command 2. Receiving a DATA response with N bytes 3. Receiving another response Test: pass Bug: 173654501 Change-Id: I568bea127315e42d8a111c23602fc582e7bc935b
2021-03-17fastboot driver: Fix ownership of fd in fastboot_buffer.Yifan Hong
fastboot_buffer owns the fd. Make ImageSource::Open() returns a unique_fd and pass ownership all the way down to the fastboot_buffer to avoid leaking fds. Test: none Change-Id: I9e7e176fc1da74c532a86d0fdba0113bdc81a166
2021-03-17fastboot driver: fix messageYifan Hong
Test: pass Bug: 173654501 Change-Id: I7d5e7ce817a5ec4e3aba6b44bab3149683a46fdd
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-26fastboot: Bring back legacy A/B supportLuK1337
Some devices, such as the Essential PH-1, don't have an updated bootloader and the bootloader is appending an extra underscore. This patch works around that issue by sanitizing the slot to be inline with modern expectations. Offending commit: https://github.com/aosp-mirror/platform_system_core/commit/42b18a518bac85c3eea14206f6cbafbd1e98a31f Most of the commit above is not needed because an underscore + slot is automatically appended when flashing to a partition. Normally, this would result in something like boot__b instead of boot_b, where b is the current slot. Test: flash an image on mata without specifying slot, boots Change-Id: Ia0b7cee603a4f9ba2e3a61ce6e369ca8c07a7caf
2021-02-23Merge "Add include directory to -header-filter"Chih-hung Hsieh
2021-02-19Add include directory to -header-filterChih-Hung Hsieh
* Only add owned header directories. * Do not add extra quotes around -header-filter argument, or the quotes will be part of the regex and fail to match header file paths. Bug: 179530304 Test: make with WITH_TIDY=1 Change-Id: Icea867cb22264fb2dbbff079a1fc914bf48bbdef
2021-02-19[LSC] Add LOCAL_LICENSE_KINDS to system/coreBob Badour
Added SPDX-license-identifier-Apache-2.0 to: bootstat/Android.bp cli-test/Android.bp code_coverage/Android.bp cpio/Android.bp debuggerd/crasher/Android.bp debuggerd/proto/Android.bp diagnose_usb/Android.bp fs_mgr/libdm/Android.bp fs_mgr/libfiemap/Android.bp fs_mgr/liblp/Android.bp fs_mgr/libsnapshot/Android.bp fs_mgr/libstorage_literals/Android.bp fs_mgr/libvbmeta/Android.bp fs_mgr/tests/Android.bp fs_mgr/tools/Android.bp gatekeeperd/Android.bp healthd/Android.bp healthd/testdata/Android.bp init/Android.bp init/Android.mk init/sysprop/Android.bp init/test_kill_services/Android.bp init/test_service/Android.bp libappfuse/Android.bp libasyncio/Android.bp libbinderwrapper/Android.bp libcrypto_utils/Android.bp libcrypto_utils/tests/Android.bp libdiskconfig/Android.bp libgrallocusage/Android.bp libkeyutils/mini_keyctl/Android.bp libmodprobe/Android.bp libnetutils/Android.bp libpackagelistparser/Android.bp libprocessgroup/Android.bp libprocessgroup/cgrouprc/Android.bp libprocessgroup/cgrouprc_format/Android.bp libprocessgroup/profiles/Android.bp libprocessgroup/setup/Android.bp libqtaguid/Android.bp libsparse/Android.bp libstats/push_compat/Android.bp libsuspend/Android.bp libsync/Android.bp libsystem/Android.bp libsysutils/Android.bp libusbhost/Android.bp libutils/Android.bp libvndksupport/Android.bp libvndksupport/tests/Android.bp llkd/Android.bp llkd/tests/Android.bp property_service/libpropertyinfoparser/Android.bp property_service/libpropertyinfoserializer/Android.bp property_service/property_info_checker/Android.bp qemu_pipe/Android.bp reboot/Android.bp rootdir/Android.bp rootdir/Android.mk rootdir/avb/Android.bp rootdir/avb/Android.mk run-as/Android.bp sdcard/Android.bp set-verity-state/Android.bp shell_and_utilities/Android.bp storaged/Android.bp toolbox/Android.bp trusty/apploader/Android.bp trusty/confirmationui/Android.bp trusty/confirmationui/fuzz/Android.bp trusty/coverage/Android.bp trusty/fuzz/Android.bp trusty/fuzz/test/Android.bp trusty/gatekeeper/Android.bp trusty/gatekeeper/fuzz/Android.bp trusty/keymaster/Android.bp trusty/keymaster/fuzz/Android.bp trusty/libtrusty/Android.bp trusty/libtrusty/tipc-test/Android.bp trusty/secure_dpu/Android.bp trusty/storage/interface/Android.bp trusty/storage/lib/Android.bp trusty/storage/proxy/Android.bp trusty/storage/tests/Android.bp trusty/utils/spiproxyd/Android.bp trusty/utils/trusty-ut-ctrl/Android.bp usbd/Android.bp watchdogd/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to: debuggerd/Android.bp fastboot/Android.bp libkeyutils/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD SPDX-license-identifier-MIT to: libcutils/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-MIT to: fs_mgr/Android.bp fs_mgr/libfs_avb/Android.bp trusty/Android.bp trusty/utils/rpmb_dev/Android.bp Added SPDX-license-identifier-BSD to: fastboot/fuzzy_fastboot/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Exempt-From-Owner-Approval: janitorial work Change-Id: Id740a7d2884556081fdb68876584b25eb95e1bef
2021-02-16Revert "[LSC] Add LOCAL_LICENSE_KINDS to system/core"Elliott Hughes
This reverts commit 187b7d19504ca8bdcbc6217c06a117017b4c6287. Reason for revert: system/core is multiple projects, not one. Change-Id: I790ea41741f8cd9b8b6db2f59a49e71fb0958fd6
2021-02-16[LSC] Add LOCAL_LICENSE_KINDS to system/coreBob Badour
Added SPDX-license-identifier-Apache-2.0 to: bootstat/Android.bp cli-test/Android.bp code_coverage/Android.bp cpio/Android.bp debuggerd/crasher/Android.bp debuggerd/proto/Android.bp diagnose_usb/Android.bp fs_mgr/libdm/Android.bp fs_mgr/libfiemap/Android.bp fs_mgr/liblp/Android.bp fs_mgr/libsnapshot/Android.bp fs_mgr/libstorage_literals/Android.bp fs_mgr/libvbmeta/Android.bp fs_mgr/tests/Android.bp fs_mgr/tools/Android.bp gatekeeperd/Android.bp healthd/Android.bp healthd/testdata/Android.bp init/Android.bp init/Android.mk init/sysprop/Android.bp init/test_kill_services/Android.bp init/test_service/Android.bp libappfuse/Android.bp libasyncio/Android.bp libbinderwrapper/Android.bp libcrypto_utils/Android.bp libcrypto_utils/tests/Android.bp libdiskconfig/Android.bp libgrallocusage/Android.bp libkeyutils/mini_keyctl/Android.bp libmodprobe/Android.bp libnetutils/Android.bp libpackagelistparser/Android.bp libprocessgroup/Android.bp libprocessgroup/cgrouprc/Android.bp libprocessgroup/cgrouprc_format/Android.bp libprocessgroup/profiles/Android.bp libprocessgroup/setup/Android.bp libqtaguid/Android.bp libsparse/Android.bp libstats/push_compat/Android.bp libsuspend/Android.bp libsync/Android.bp libsystem/Android.bp libsysutils/Android.bp libusbhost/Android.bp libutils/Android.bp libvndksupport/Android.bp libvndksupport/tests/Android.bp llkd/Android.bp llkd/tests/Android.bp property_service/libpropertyinfoparser/Android.bp property_service/libpropertyinfoserializer/Android.bp property_service/property_info_checker/Android.bp qemu_pipe/Android.bp reboot/Android.bp rootdir/Android.bp rootdir/Android.mk rootdir/avb/Android.bp rootdir/avb/Android.mk run-as/Android.bp sdcard/Android.bp set-verity-state/Android.bp shell_and_utilities/Android.bp storaged/Android.bp toolbox/Android.bp trusty/apploader/Android.bp trusty/confirmationui/Android.bp trusty/confirmationui/fuzz/Android.bp trusty/coverage/Android.bp trusty/fuzz/Android.bp trusty/fuzz/test/Android.bp trusty/gatekeeper/Android.bp trusty/gatekeeper/fuzz/Android.bp trusty/keymaster/Android.bp trusty/keymaster/fuzz/Android.bp trusty/libtrusty/Android.bp trusty/libtrusty/tipc-test/Android.bp trusty/secure_dpu/Android.bp trusty/storage/interface/Android.bp trusty/storage/lib/Android.bp trusty/storage/proxy/Android.bp trusty/storage/tests/Android.bp trusty/utils/spiproxyd/Android.bp trusty/utils/trusty-ut-ctrl/Android.bp usbd/Android.bp watchdogd/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to: debuggerd/Android.bp fastboot/Android.bp libkeyutils/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD SPDX-license-identifier-MIT to: Android.bp libcutils/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-MIT to: fs_mgr/Android.bp fs_mgr/libfs_avb/Android.bp trusty/utils/rpmb_dev/Android.bp Added SPDX-license-identifier-BSD to: fastboot/fuzzy_fastboot/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Exempt-From-Owner-Approval: janitorial work Change-Id: I5bd81adb5cdcf2b4dd4141b204eb430ff526af8f
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