Commit graph

860 commits

Author SHA1 Message Date
Treehugger Robot
5785297922 Merge "fastboot: Add system_dlkm flashing support" 2022-01-04 00:28:41 +00:00
Ramji Jiyani
b3ddb534c3 fastboot: Add system_dlkm flashing support
Bug: 200082547
Test: TreeHugger
Signed-off-by: Ramji Jiyani <ramjiyani@google.com>
Change-Id: I35e081bbe8674c102324d22d440dcc38493ec25b
2021-12-29 21:00:25 +00:00
Yifan Hong
4cb88dc811 fastboot: use health AIDL HAL
Bug: 208543110
Test: fastboot getvar
Change-Id: Ib83e7ccd53e49367f7af218ffafb7c0a57a514f6
2021-12-06 23:18:32 -08:00
Konstantin Vyshetsky
d5f3da8dc5 fastbootd: use O_DIRECT for write partition
Direct writes for partition flashing significantly increase performance.
Use O_DIRECT flag when opening partition for flashing. Additionally use
a 4096b aligned buffer which is required for O_DIRECT.
Switch from using 8MB write buffer to 1MB write buffer, as the extra
allocation has no performance impact.

Test: flash locally and reach home screen
Bug: 205151372
Signed-off-by: Konstantin Vyshetsky <vkon@google.com>
Change-Id: I060f438cf698d0fda1e59e35338bb5dc1cd05b51
2021-11-04 13:24:33 -07:00
Konstantin Vyshetsky
81cc119eff fastbootd: allow passage of flags to open partition
Allow caller to pass additional flags when opening a partition. Obsolete
usage of boolean read, and make previous callers use O_RDONLY instead.
Explicitly OR (O_EXCL | O_CLOEXEC | O_BINARY) to keep existing design
working as is.

Test: flash locally and reach home screen
Bug: 205151372
Signed-off-by: Konstantin Vyshetsky <vkon@google.com>
Change-Id: I48fbca459a17fcf0b0926ab339585e3bd8e31e35
2021-11-04 12:05:48 -07:00
Colin Cross
8a87bdf80d Use HOST_OUT_EXECUTABLES instead of SOONG_HOST_OUT_EXECUTABLES
Soong is installing binaries directly to HOST_OUT_EXECUTABLES instead
of SOONG_HOST_OUT_EXECUTABLES, dist from the HOST_OUT_EXECUTABLES
location.

Bug: 204136549
Test: m checkbuild
Change-Id: Iee7ae8d1ed478aa2a0344fc9f54ad2c146841cb0
2021-10-25 22:41:07 -07:00
Ayushi Khopkar
ce5c033e2b Added fastboot_fuzzer
Test: ./fastboot_fuzzer
Bug: 189053436

Change-Id: Idf9be2f86238eb2c7090402adc54bbb9c0b43582
2021-10-14 00:32:38 +00:00
David Anderson
b72fa73ace Merge "fastboot: Support casefolding in ext4 partitions." 2021-08-27 01:18:06 +00:00
Colin Cross
fb66f3d13f Merge "Include sys/select.h for fd_set" 2021-08-17 18:56:16 +00:00
Yi-Yo Chiang
b33cfbfc4b Merge "fastboot/README.md: Update response packet max size to 256" 2021-08-17 14:15:36 +00:00
Colin Cross
cbca269d75 Include sys/select.h for fd_set
socket.cpp fails to compile on musl with a missing definition of
fd_set.  Include sys/select.h for the definition.

Bug: 190084016
Test: m USE_HOST_MUSL=true fastboot
Change-Id: I095a56381a85981f42444f4c39ae8e7786d8640f
2021-08-16 17:20:19 -07:00
Yi-Yo Chiang
a7656fa3b6 fastboot/README.md: Update response packet max size to 256
This change is to update the doc to reflect the current state and it
doesn't affect the runtime behavior.
The max packet size was updated to 256 by aosp/1226715.

Bug: 196676392
Test: Presubmit; doc update doesn't affect build
Change-Id: I73b0a416730d09fdb24ea81bffe52ddd89534132
2021-08-14 22:12:34 +08:00
Christopher Ferris
4a9a79e3ff Merge "Remove jmgao from OWNERS files." 2021-08-11 17:28:27 +00:00
Christopher Ferris
0ef9b4d365 Remove jmgao from OWNERS files.
Josh no longer works on Android, so remove him from OWNERS files.

Test: NA
Change-Id: I676cd803b5e3167db1b5175a630d85d1edfcaaaf
2021-08-10 21:42:14 -07:00
Treehugger Robot
d82efe0bf0 Merge "fastboot: fix --disable-verifiation error message" 2021-08-11 04:09:46 +00:00
Bowgo Tsai
671249a3d2 fastboot: fix --disable-verifiation error message
There is an unclear error message if we run
`fastboot --disable-verification flash boot boot.img` on a
AVB-disabled device without a /vbmeta partition.

Error message:
  terminating with uncaught exception of type std::out_of_range: basic_string
  Aborted

This is because the buf->fd of the loaded boot.img is not reset,
before returning from function copy_boot_avb_footer().

Also reset some changes in copy_boot_avb_footer() from commit
If83f785e235569ee8ef0de2b37f11dbd2a9a71f4, to prevent the
unnecessary read of the boot vbmeta if no need to copy the
boot image avb footer.

Bug: 191903922
Test: `fastboot --disable-verification flash boot boot.img` on a device
      without /vbmeta and without setting BOARD_AVB_ENABLE to true.
Change-Id: If84f08f1b2e12c4c6ded5cafda2bd1d30e75c662
2021-08-10 17:05:17 +08:00
David Anderson
1f670ef7a8 fastbootd: Delete all VAB partitions during "flashall".
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
2021-08-09 12:36:13 -07:00
David Anderson
6f70cc6f92 fastboot: Support casefolding in ext4 partitions.
Bug: 191929411
Test: manual test
Change-Id: I9bd0a906fa9a2605d56cc3f37247fcc2a3d5f858
2021-07-13 17:32:03 -07:00
Treehugger Robot
db14785382 Merge "Remove --wipe-and-use-fbe option from fastboot" 2021-06-16 17:55:36 +00:00
Paul Crowley
47770a1040 Remove --wipe-and-use-fbe option from fastboot
As per the bug, this option has been obsolete for years
and only causes confusion.

Bug: 167694738
Test: fastboot can still wipe
Change-Id: I24a21cb6110d61dec4af800a1fab0bcedc0a3d5c
2021-06-15 16:07:57 -07:00
Pierre-Clément Tosi
96941a0962 fastboot: document second parameter of 'fetch'
Add the OUT_FILE parameter to the documentation of fetch which fails if
used as currently (erroneously) documented:

    $ fastboot fetch boot
    fastboot: usage: expected argument

Test: fastboot help
Change-Id: Ia06d40c2f754e1a55a2052cb84e81f96e71b4573
2021-06-14 12:46:32 +00:00
Bowgo Tsai
a48a78356f fastboot: support vbmeta_vendor.img
Bug: 181909612
Test: build
Change-Id: If61fff1c83513d71605c0cef2737a38f7575d69b
2021-06-04 00:59:43 +00:00
Elliott Hughes
02a83245ef Use libgtest_prod_headers.
Bug: http://b/185916167
Test: treehugger
Change-Id: I9ece5926944b8c881e3a117cda2c99281c59b61e
2021-04-20 15:22:02 -07:00
David Anderson
7723c72cab Merge "Unable to mount filesystem in fastbootd mode on the user build." 2021-04-13 23:45:01 +00:00
David Anderson
9a95ed928f Merge "fastboot: Add a few missing fastboot commands from help" 2021-04-12 21:17:42 +00:00
David Anderson
055f802086 Merge "libsnapshot: Add diagnostics for DM_DEV_REMOVE failures." 2021-04-12 21:04:08 +00:00
Luca Stefani
173667b7e7 fastboot: Add a few missing fastboot commands from help
Test: m, fastboot help
Change-Id: I8c40ad25123470ea214b9d93d7305945973a2b0b
2021-04-12 19:16:52 +02:00
David Anderson
0b903f9910 libsnapshot: Add diagnostics for DM_DEV_REMOVE failures.
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-08 11:06:12 -07:00
Andrew Chant
d64b988959 fastboot: use --force to bypass requirements
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-04-06 15:28:41 -07:00
joker.yang
09090946a8 Unable to mount filesystem in fastbootd mode on the user build.
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-30 01:21:52 +00:00
David Anderson
527cdd4617 Merge "fastboot: Don't fail when unable to get boot partition size" 2021-03-29 18:56:28 +00:00
Oleg Matcovschi
d0a16c20fc fastboot: derive device locked state from Android property
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-25 14:45:54 -07:00
Yi-Yo Chiang
ac4a136e59 fastboot: Refactor bootimg_utils.cpp:mkbootimg()
Change mkbootimg() to return void, as we already have a |out| parameter.

Bug: 183455415
Test: Presubmit
Change-Id: I51439e273752ab9e21f8d7138e900ea55bdfdfc0
2021-03-25 04:23:08 +00:00
Yi-Yo Chiang
c0c9e3059c fastboot: [boot] and [flash:raw] command support boot v4
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-25 04:22:58 +00:00
Treehugger Robot
47229793e5 Merge "fastboot driver: ftrucate64->ftruncate." 2021-03-24 08:34:51 +00:00
Michael Bestas
a495be742c fastboot: Don't fail when unable to get boot partition size
* Some devices don't report boot partition size

Change-Id: If83f785e235569ee8ef0de2b37f11dbd2a9a71f4
2021-03-24 01:18:45 +00:00
Treehugger Robot
4f898d4e33 Merge "fastboot driver: add virtual dtor to ImageSource." 2021-03-24 00:10:31 +00:00
Yifan Hong
c8715002ab fastboot driver: ftrucate64->ftruncate.
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-23 11:14:22 -07:00
Treehugger Robot
2af0504896 Merge "fastboot device: Disallow implicit conversion from unique_fd to int." 2021-03-23 06:48:02 +00:00
Treehugger Robot
981f79be3c Merge "fastboot driver: Disallow implicit conversion from unique_fd to int." 2021-03-23 06:47:52 +00:00
Treehugger Robot
15acff029f Merge "fastboot driver: Fix fd ownership." 2021-03-23 05:33:20 +00:00
Yifan Hong
07e947fc5d fastboot device: Disallow implicit conversion from unique_fd to int.
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-22 19:30:59 -07:00
Yifan Hong
58532dfacd fastboot driver: Disallow implicit conversion from unique_fd to int.
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-22 19:30:59 -07:00
Yifan Hong
e9f067b4eb fastboot driver: Fix fd ownership.
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 19:30:59 -07:00
Bob Badour
559488ce17 [LSC] Add LOCAL_LICENSE_KINDS to system/core
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-22 19:02:03 -07:00
Yifan Hong
d2e8cb5556 fastboot driver: add virtual dtor to ImageSource.
Test: Treehugger
Change-Id: Ia91d6d344186a07d90e3983c153d8170859eed5b
2021-03-19 11:46:48 -07:00
Greg Kaiser
f4c6ce4a10 fastboot driver: Avoid use after std::move()
Test: TreeHugger
Change-Id: I2857f6d6384c8c80809f21202dbbbfc9ed71beeb
2021-03-19 09:10:18 -07:00
Yifan Hong
f09c1efd0a fuzzy_fastboot: Add tests for fetch:vendor_boot
Test: run test against bootloader
Test: run test against fastbootd
Bug: 173654501
Change-Id: Ia3182b4f4390048139d2cafe9b1654b6fb92eb7b
2021-03-17 15:38:06 -07:00
Yifan Hong
2a7a14bfc4 fuzzy_fastboot: Add conformance test for getvar:max-fetch-size.
Test: run against bootloader
Test: run against fastbootd
Bug: 173654501
Change-Id: Ide38eee6b801110fef52f0f9213c038a72c775f2
2021-03-17 15:38:06 -07:00
Yifan Hong
e71fe2441a fastboot driver: repack vendor boot ramdisk
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-17 15:38:06 -07:00