Commit graph

730 commits

Author SHA1 Message Date
David Anderson
ac892d7569 Merge "Don't require bootloader fastboot for VTS compliance." 2020-02-07 21:46:01 +00:00
David Anderson
7868246e30 Don't require bootloader fastboot for VTS compliance.
Bug: 144820025
Test: vts
Change-Id: Ib99ddbe611645fe0f89134a628ddb486b02df170
2020-02-06 13:13:56 -08:00
Bowgo Tsai
27d5fb344b Increases fastbootd response message size
Some output of `fastboot getvar` exceeds current message size.
Increases the message size to 256 to fix the issue.

Bug: 74445765
Bug: 144473561
Test: fastboot getvar system-fingerprint
Change-Id: Id5064be4bb500697ce87c473f662d86c7c344d65
2020-02-06 16:22:59 +08:00
Baligh Uddin
3d902d1637 Use SOONG_HOST_OUT_EXECUTABLES
Bug: 147699225
Test: m com.android.tzdata (apexer requires these executables)
Change-Id: I008d244e330d2113cb3f2dd4b6c770df3f2fac06
2020-01-23 14:09:01 +00:00
Bowgo Tsai
99f9a38a8b fastbootd: exporting more properties
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-22 23:29:07 +08:00
steven_fann
fde5e27602 Allow fuzzy_fastboot test devices over internet
Bug: 144667236
Test: fuzzy_fastboot --serial=192.168.1.104:5555 --gtest_filter=*Logical*

Change-Id: I02e62f706d0a3a19a9b7b56788abe05759d2d63d
2020-01-21 15:40:52 +00:00
Yifan Hong
38f3706ab3 Merge "fastboot: Mount /metadata before overlayfs teardown." 2020-01-15 01:31:59 +00:00
Dan Shi
754167b241 Add libc++ as static library
This is for the test to run without packaging libc++.so in vts-core
suite.

Bug: 147249791
Test: atest FastbootVerifyUserspaceTest
Change-Id: I0263d13a2dd08186502b30b2fad25d4f0f3a6be8
2020-01-09 14:24:23 -08:00
Dan Shi
44b29c643a Add fuzzy_fastboot to vts-core suite
The binary is required by FastbootVerifyUserspaceTest.
Disable test config generation as fuzzy_fasboot itself is not part of
vts-core suite.

Bug: 147249791
Test: atest FastbootVerifyUserspaceTest
Change-Id: Ief86f33b41990a354497b128e154da04fec58ae9
2020-01-06 15:52:10 -08:00
David Anderson
23243497fd fastboot: Mount /metadata before overlayfs teardown.
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-12-30 13:42:57 -08:00
Yifan Hong
712c32b2b9 fastboot: Flashall does proper snapshot cancel
Fix typo.
Test: flashall

Change-Id: I54a51a489aef2e1de5e682f5e97b95b2278085ec
2019-12-10 18:12:55 -08:00
David Anderson
bf55a76fd9 Merge "fastbootd: Disallow certain operations during snapshot updates." 2019-11-19 00:49:44 +00:00
Bowgo Tsai
33da5c9493 fastbootd: exporting CPU ABI info
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-13 17:22:22 +08:00
David Anderson
220ddb1f0f fastbootd: Disallow certain operations during snapshot updates.
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-11-10 23:07:13 -08:00
David Anderson
c399ccb345 Merge "fastboot: Implement helper commands for Virtual A/B." 2019-10-31 01:11:49 +00:00
David Anderson
ab8f466107 fastboot: Implement helper commands for Virtual A/B.
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-31 01:11:16 +00:00
David Anderson
376f04e047 Merge "avoid data overflow in low memory device" 2019-10-23 23:15:06 +00:00
JeiFeng Lee
ba117304ab avoid data overflow in low memory device
Bug: 142294642
Test: fastboot flash system system.img
Change-Id: Iec50817aaca5d31c194f0fdf409503829d14ca06
2019-10-23 13:20:41 +08:00
Chin-Ting Kuo
df6a780ee7 Allow --disable-verification when top-level vbmeta is in 'boot'
If top-level vbmeta struct is in 'boot' partition,
the "flags" element offset of top-level vbmeta header
from the beginning of boot partition is 123 plus
top-level vbmeta offset recorded in the boot image footer.

Bug: 139639521
Test: m fastboot
Test: fastboot --disable-verification flashall
Test: fastboot --disable-verification flash boot boot.img, checks the
      flag isn't changed if the device has vbmeta partition
Test: fastboot --disable-verification flash vbmeta vbmeta.img
Change-Id: Ibf73c9330639e971ee3873ac19f072cf7baed55b
2019-09-24 12:35:26 +08:00
Tom Cherry
fbb9535aae fastboot: don't use sparse_file_import_auto() in load_buf_fd()
load_buf_fd() attempts to find the size of the file that it is about
to load by first calling sparse_file_import_auto() then using
sparse_file_len() upon success or falling back to the file size on the
filesystem on failure.

This is problematic however as sparse_file_import_auto() creates a
sparse_file out of the normal file, but does not resparse it, so an
assertion fails during the sparse_file_len() call.

This is fixed by using sparse_file_import() instead.  This will fail
in the case that the file is not sparse and the call to
sparse_file_len() will be properly skipped.

Bug: 140538105
Test: flash blueline factory image with assertions enabled in
      libsparse/sparse.cpp

Change-Id: I0283be33563a3301ce5b09bde41105a20f91086c
2019-09-17 13:43:56 -07:00
Yifan Hong
0e13bbade3 fastbootd: skip COW group
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-09-11 18:32:57 -07:00
Steven Moreland
a4eaf64de8 Remove libhwbinder/libhidltransport deps
Since these were combined into libhidlbase.

Bug: 135686713
Test: build only (libhwbinder/libhidltransport are empty)
Change-Id: I0bdffced6af52695c0ef98c9dd659348e56f7aa6
2019-09-05 14:17:42 -07:00
Tom Cherry
390b48bad2 Merge "fastboot: preserve partition_type if wants_wipe=true" 2019-08-29 20:24:52 +00:00
qiwu chen
325ba6ffa8 fastboot: Initialize UploadInner dsize value to 0
We must initialize UploadInner dsize value to 0, in case
stuck in ReadBuffer when receive DATA packet which dsize
is 0 or non DATA type packet. This will lead to fastboot
hang up unless USB unplugged.

Change-Id: I1e9752585c3d1013b1b1da38ead9ba4c532c2d34
Signed-off-by: qiwu chen <qiwuchen55@gmail.com>
2019-08-29 14:56:19 +08:00
cfig
f60613b4e8
fastboot: preserve partition_type if wants_wipe=true
originally if wants_wipe=true, program will erase and format partitions,
but after fb->Erase(), partition type should be raw(all 0xFFs),
then following fb_perform_format() will miss its original partition_type
Now we call fb_perform_format() with original fs type to keep the
partition consistent after wiping.

Change-Id: Ic778850588d5dd6fee23169d20c26bcbaa510627
2019-08-29 13:19:29 +08:00
Treehugger Robot
2d5395fec1 Merge "fastboot: add vendor_boot to list of images" 2019-08-29 02:54:51 +00:00
David Anderson
ad970fc055 fastbootd: Cancel snapshots when modifying partitions.
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
2019-08-27 14:03:44 -07:00
Steve Muckle
3611243e4d fastboot: add vendor_boot to list of images
The vendor_boot partition has been created, so add it to the list of
images which may be flashed.

Bug: 137297791
Change-Id: I27eaa16656a83dbcb8289680844bf58dd1fccf24
2019-08-21 11:17:55 -07:00
David Anderson
15aa9540df liblp: CreateLogicalPartition with a given mapped name
Introduce a parameter struct to eliminate parameter explosion, and refactor
existing callers to use the new helper.

Test: manual test
Bug: 135752105
Change-Id: I0c5ebe4e084ad7503c2ac6c65886a71505d50d00
2019-08-13 13:41:36 -07:00
David Anderson
470fe2b5f0 fs_mgr: Remove the timeout parameter to DestroyLogicalPartition.
This is no longer needed as CreateLogicalPartition() ensures the
obtained path will not race with device deletion.

Bug: 135771280
Test: device builds, flashes
Change-Id: I821290aa08fede99d5c51cd68681c351a1ea97bc
2019-07-11 15:39:53 -07:00
Justin Yun
5d0ac62995 Rename product_services to system_ext
Update adb, fastboot and mount point

Bug: 134359158
Test: build and check if system_ext.img can be flashed
Change-Id: I6219f72242c5fe42a508008c0b1fd218d74da5b6
2019-07-09 08:56:53 +00:00
David Anderson
7c84b9fea2 fastboot: add a wipe-super command.
Usage: fastboot wipe-super [super_empty.img]

This command will read the given super_empty.img (using the default one
in ANDROID_PRODUCT_OUT if not specified), and flash by generating a
temporary super.img with no partition data. This command will even work
on retrofit devices.

This command is intended to be used either during device bringup or with
scripts that will manually flash individual dynamic partitions, in place
of using "fastboot flashall".

Bug: 136282057
Test: fastboot wipe-super on retrofit and non-retrofit device
Change-Id: Icab368a63ff36fcce9ac9304eb3966dd38bd78c4
2019-06-28 21:09:03 +00:00
David Anderson
2747532f96 fastbootd: Don't include all of the fs_mgr namespace in commands.cpp.
Bug: N/A
Test: m fastbootd
Change-Id: Iea67a27a2d3637df5dfd55982bda1465b7ef7de8
2019-06-11 14:05:02 -07:00
David Anderson
196d2ba7b9 liblp: Add helpers for finding partitions and partition sizes.
These tend to get manually, so let's promote to actual helpers.

Bug: 134536978
Test: liblp_test gtest
Change-Id: Ifb79c8d6f247cc3f9635bf6adfd1c99907340002
2019-06-07 11:09:28 -07:00
Greg Kaiser
8acf8c2da7 fastboot: windows: Minor printf format fixes
We recently changed 'xfer' to a size_t, so update the DBG format
accordingly.  We also fix a long standing issue with format for
the unsigned 'read'.

Test: TreeHugger
Change-Id: I3dc5f26a033fea64119016802bc9cdb54bbb7b52
2019-06-03 14:12:42 -07:00
Fernando Lugo
b7eac2d084 fastboot: windows: fix Read function
Read function exits before reading all requested bytes. Fix that by
looping until the len requested is completed.

This will fix the issue execting get_staged command for a staged image
bigger than 1MB

Test: fastboot get_staged file.txt
Change-Id: Ic70ab48f3a8c8d78c225db638892501d4dc20b13
Signed-off-by: Fernando Lugo <flugo@google.com>
2019-05-30 17:47:49 -07:00
chihhao.chen
8c544b6fd8 Fix non-aio USB read issue for fastbootd
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
Merged-In: I6690324840d78f3f1e04235040301520329976db
2019-05-29 23:10:50 +00:00
Treehugger Robot
9ab0471734 Merge "fastbootd: reduce USB buffer size to 16K" 2019-05-22 03:45:18 +00:00
Hridya Valsaraju
d747dba9c0 fastbootd: reduce USB buffer size to 16K
Some USB controllers can only support transfers upto 16K.

Bug: 133208811
Test: fastboot flashall
Change-Id: Ic025bdd8e7a6cf2634fc24524fd189e0cc9efbb5
2019-05-21 13:08:52 -07:00
Treehugger Robot
b545055f6d Merge "Get max-download-size from device during fastbootd for flashall/update" 2019-05-20 22:50:10 +00:00
Hridya Valsaraju
83d856e4c5 Get max-download-size from device during fastbootd for flashall/update
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: 536870912

Change-Id: Ife7c1ec0583d80d4a31ecf01f1fc14a8365afe0d
2019-05-20 09:37:22 -07:00
Treehugger Robot
3afe5f22b3 Merge "Allow CreateResizeDeleteLP test case to run on non-A/B devices" 2019-05-15 03:53:37 +00:00
Hridya Valsaraju
f81bd17179 Allow CreateResizeDeleteLP test case to run on non-A/B devices
Test: fuzzy_fastboot --gtest_filter=*Logical*
Bug: 117220134

Change-Id: Ic7c2b246b7c5646d3589f8f57eceb9ba5feeef2b
2019-05-14 16:37:10 -07:00
Treehugger Robot
9426110d37 Merge "fastboot: demote OS X USB error." 2019-05-10 21:23:42 +00:00
Josh Gao
16f992e228 fastboot: demote OS X USB error.
We can't create interface iterators for all devices (e.g. the keyboard,
touchbar, etc.), so we get multiple instances of this log spam on every
command.

Demote it to a warning that only shows up on debug builds.

Test: none
Change-Id: I20581b9134c05360d5723b09ffe8de8c4cfd6a3f
2019-05-10 11:29:13 -07:00
Elliott Hughes
b17bf521d5 libziparchive: report errors on over-long names.
Switch FindEntry and the ZipString constructor to std::string_view. This
lets us accept an over-long name so that we can reject it as too long.

Also fastboot changes to track the API change.

Bug: http://b/129068177
Test: treehugger
Change-Id: I7df7acd1fe2c46380b789c25f8909e0553e2d55e
2019-05-04 08:41:12 -07:00
Treehugger Robot
6e28863442 Merge "Handle failed usb/reads and writes correctly" 2019-04-16 23:03:17 +00:00
Hridya Valsaraju
8efadf70e1 Handle failed usb/reads and writes correctly
Currently if the device is unplugged from host,
there is a lot of log spamming since fastbootd
does not not recognize that the device has been
disconnected and keeps trying to read/write to the
device.

2856 printk messages dropped ** [  169.941904] c7    579 fastbootd: aio: got error event on
read total bufs 1: No such devie
** 2960 printk messages dropped ** [  169.953328] c7    579 fastbootd: Fastboot command:
** 2074 printk messages dropped ** [  169.961355] c7    579 fastbootd: aio: got error event
on read total bufs 1: No such devie

Bug: 121333158
Test: unplug device and check for log spam multiple times

Change-Id: I1d4c6f48f34e313c5ebce23d62a4fe6a6373f94f
2019-04-15 10:36:42 -07:00
Treehugger Robot
1a17b09174 Merge "Allow fuzzy_fastboot number to run for a specific device serial number" 2019-04-11 22:33:22 +00:00
Hridya Valsaraju
b9051a3e65 Allow fuzzy_fastboot number to run for a specific device serial number
Test: ./fuzzy_fastboot --serial=826X003L --gtest_filter=*Logical*
Bug: 117181762
Change-Id: I9dec510aa604b7994f25ce26edb87d7f6ec3e875
2019-04-11 09:52:09 -07:00