Commit Graph

1014 Commits

Author SHA1 Message Date
Donghua Yan ee51de8d79 fastboot: Leave more space for kernel
Propagate from (CR)

Due to latest kernel text section exceeds 16MB, the oriGinal ramdisk
loading address becomes invalid. This leads to boot image flashed by
fastboot flash:raw command cannot boot up.
Move ramdisk 32MB away from kernel loading address to fix this issue.

Picked from http://gerrit.mot.com/495270

Change-Id: I50709e307aa3be08885236306fe70761ea1ed642
Reviewed-on: https://gerrit.mot.com/1013028
Reviewed-by: Qing Chang <qing@motorola.com>
Submit-Approved: Jira Key
Signed-off-by: Qing Chang <a21550@motorola.com>
Reviewed-on: https://gerrit.mot.com/1244780
Reviewed-on: https://gerrit.mot.com/1335207
Reviewed-by: Dong-Hua Yan <a18317@motorola.com>
Reviewed-on: https://gerrit.mot.com/1945700
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Vijayakumar Gn <vijaygn@motorola.com>
Reviewed-by: Ling Jin <lingjin@motorola.com>
Submit-Approved: Ling Jin <lingjin@motorola.com>
Tested-by: Ling Jin <lingjin@motorola.com>
Reviewed-on: https://gerrit.mot.com/2265601
2024-09-14 21:08:51 +05:30
luodw1 4cd77be61f fastbootd: change max response size to 64
Propagate from (CR)

Because fastboot max response size is 64 bytes, and fingerprint
info more than 64 bytes, so fastboot getvar all return FAILED(
Device sent unknown status code), the return FAIELD behavior
happened on windows OS, linux OS running "fastboot getvar all"
will be ignore these INFO message(message size more than 60).

Change-Id: I31757a6a751e0cb0e0a4bdbea990287b4a9e7b78
Signed-off-by: luodw1 <luodw1@motorola.com>
Reviewed-on: https://gerrit.mot.com/1787168
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Zhenxin Xi <xizx@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1945706
Reviewed-by: Ling Jin <lingjin@motorola.com>
Submit-Approved: Ling Jin <lingjin@motorola.com>
Tested-by: Ling Jin <lingjin@motorola.com>
Reviewed-by: Vijayakumar Gn <vijaygn@motorola.com>
Reviewed-on: https://gerrit.mot.com/2265607
Reviewed-by: Qing Chang <qing@motorola.com>
Signed-off-by: minaripenguin <minaripenguin@users.noreply.github.com>
2024-09-14 21:08:51 +05:30
Luca Weiss d3a08fcb80 fastboot: zero-initialize fastboot_buffer struct
The functions load_buf_fd()/load_buf() are not guaranteed to write all
struct members, e.g. buf->sz doesn't get an assignment in some
circumstances and as such is used uninitialized in various places, which
leads to code paths being taken that shouldn't be (e.g. in
copy_avb_footer).

See https://gitlab.archlinux.org/archlinux/packaging/packages/android-tools/-/issues/4

Change-Id: Ibdeda8fa47b95df46dd69a87e04d0e66734db2fe
2024-09-14 21:08:51 +05:30
Donghua Yan c0652a8837 fastboot: Increase usb write timeout time
Propagate from (CR)

Previous 5 seconds timeout time is not enough to cover all cases.
Sometimes phone takes longer time to respond.
So prolong this timeout time to 5 minutes.

Picked from http://gerrit.mot.com/508201

Change-Id: Id79274deb32d6926a1134407a8a00e44d59ddb02
Reviewed-on: https://gerrit.mot.com/1013029
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Qing Chang <qing@motorola.com>
Submit-Approved: Jira Key
Signed-off-by: Qing Chang <a21550@motorola.com>
Reviewed-on: https://gerrit.mot.com/1244781
Reviewed-by: Master Yoda
Signed-off-by: Qing Chang <a21550@motorola.com>
Reviewed-on: https://gerrit.mot.com/1335208
Reviewed-by: Dong-Hua Yan <a18317@motorola.com>
Reviewed-on: https://gerrit.mot.com/1945701
Reviewed-by: Vijayakumar Gn <vijaygn@motorola.com>
Reviewed-by: Ling Jin <lingjin@motorola.com>
Submit-Approved: Ling Jin <lingjin@motorola.com>
Tested-by: Ling Jin <lingjin@motorola.com>
Reviewed-on: https://gerrit.mot.com/2265602
2024-09-14 21:08:51 +05:30
Alessandro Astone 5ca9869874 fastbootd: hacks for legacy
* Use different endpoint addresses for sinks and sources
 * Consider locked only explicitely `green` devices
 * [npjohnson] Updated for 12's logic

Change-Id: If093556e8e839cadf29f9e8f995f09ed3f188ed1
2024-09-14 21:08:51 +05:30
Alessandro Astone 0a7cd5c858 fastbootd: usb: fallback to v1 descriptors
Change-Id: Ibe8ae5ca8ffd44c3871a8855b06849034c74eb2f
2024-09-14 21:08:51 +05:30
Michael Bestas 28d0e308cc fastboot: Prefer ro.boot.hardware.revision for hw-revision
ro.revision defaults to 0 if it's not set in cmdline.
Some devices might want to set it in their device specific init files,
however it's not possible to override ro properties.

Test: Set ro.boot.hardware.revision in device specific init.rc and
      observe fastboot getvar hw-revision in fastbootd

Change-Id: I6e785c3fe3a49409e815af269a9a8db732b80ada
2024-09-14 21:08:51 +05:30
Jake Weinstein 9304b87dd3 Android 14.0.0 Release 17 (UQ1A.231205.015)
-----BEGIN PGP SIGNATURE-----
 
 iF0EABECAB0WIQRDQNE1cO+UXoOBCWTorT+BmrEOeAUCZXDPNwAKCRDorT+BmrEO
 eFPEAJ90wL0gUa7uT4np0iENNXoQn3QhyQCfXM5wouynx/QjrAwNWCwBBHHnYBE=
 =ulx5
 -----END PGP SIGNATURE-----

Merge tag 'android-14.0.0_r17' of https://android.googlesource.com/platform/system/core into HEAD

Android 14.0.0 Release 17 (UQ1A.231205.015)

Change-Id: I9294b017dbb3f3b632e13309fd9b9ed591c31e73
2023-12-09 02:43:25 +09:00
Chun-Wei Wang bcbc93f83d Disallow fastboot to modify locked DSU
This enhances the security requirement by only allowing
the owner app to change a locked DSU.

(Cherry-picked from aosp/2744993)

Bug: 277691885
Bug: 296985785
Test: 1. ensure device is OEM locked
      2. adb shell am start-activity \
         -n com.android.dynsystem/com.android.dynsystem.VerificationActivity \
         -a android.os.image.action.START_INSTALL \
         --el KEY_USERDATA_SIZE 2147483648 \
	 --es KEY_DSU_SLOT foo.lock
      3. adb reboot fastboot
      4. `fastboot gsi disable|wipe` should be blocked

Merged-In: I1a0cb8a074412468d16043ddf4101fbb76490115
Change-Id: I1a0cb8a074412468d16043ddf4101fbb76490115
2023-09-08 11:11:35 +08:00
Chun-Wei Wang e433fde7d2 Add a fastboot command to show GSI status
The command will be used by RMA tool to skip
device wiping when it is already in GSI mode.

This change also makes it easier to add more
gsi commands in the future without needing to
update the host side tool (fastboot).

(Cherry-picked from aosp/2735077)

Bug: 298533290
Bug: 298138572
Test: 1. reboot into fastboot mode
      2. fastboot gsi status
Merged-In: Ic81f89a93b854f9ec70aebe2d209bfd1f98e3645
Change-Id: Ic81f89a93b854f9ec70aebe2d209bfd1f98e3645
2023-09-06 09:04:45 +08:00
Erik Sanders 7cbba88517 Merge UP1A.230503.003
Change-Id: I5f017b091cb2e8a9512d7812796f59a98b44cce6
2023-05-05 21:54:44 +00:00
Scott Lobdell a2adb445b5 Merge UP1A.230418.002
Change-Id: I6164c7e487e5b36becafc30843827110fb2b9a4a
2023-04-28 18:19:18 +00:00
Daniel Zheng 935ee1f971 Added test for parsing bad input
Test: fastboot_test
Change-Id: I04fc24741987bc88a490b2084189dfd8f3714582
2023-04-20 14:11:06 -07:00
Daniel Zheng 13af2f46a8 Merge "Added test for version check" 2023-04-20 17:47:46 +00:00
Daniel Zheng 0e25838886 Merge "Adding Test for Parsing Flash Task" 2023-04-19 21:13:42 +00:00
Daniel Zheng 233a5a162d Merge "Added forward declaration for compilation" 2023-04-19 21:13:35 +00:00
Daniel Zheng 7d67d569f3 Merge "Pointed FlashingPlan to Interface" 2023-04-19 21:13:25 +00:00
Daniel Zheng 3ac1e55e1e Merge "Adding fastboot_driver interface + mock" 2023-04-19 21:12:59 +00:00
Daniel Zheng 39b1de953f Merge "Moving FlashallTool Definition" 2023-04-19 21:12:37 +00:00
Daniel Zheng b7d14facd2 Merge "Changing flashall to parse fastboot-info.txt" 2023-04-19 21:12:29 +00:00
Daniel Zheng 68b84df994 Added test for version check
Test: fastboot_test
Bug: 194686221
Change-Id: I886c0a91be3b4f4bf7f2b8c76704aa30a352ee5b
2023-04-19 12:30:38 -07:00
Daniel Zheng 76aa257850 Adding Test for Parsing Flash Task
Test: fastboot_test
Bug: 194686221
Change-Id: Ie15b2d0423366fb9d1debb9be52de3b6d3a891af
2023-04-19 12:30:38 -07:00
Daniel Zheng efca333730 Added forward declaration for compilation
Test: tested compilation
Change-Id: I7165e323574ef8f3f90d1540c4a2b6a991803b40
2023-04-19 12:30:38 -07:00
Daniel Zheng bf09c61d95 Pointed FlashingPlan to Interface
Using interface for testing purposes

Bug: 194686221
Test: tested compilation
Change-Id: Ia9465c1f5673c249cdbc08a1a2432e8a603bd9cc
2023-04-19 12:30:38 -07:00
Daniel Zheng c9e869bd9e Adding fastboot_driver interface + mock
Adding mock fastboot_driver to be used for testing

Test: tested fastboot_test
Bug: 194686221
Change-Id: I6948310d44b75c0f389cbfd194747649aaccb0b8
2023-04-19 12:30:38 -07:00
Daniel Zheng 65eb246aa2 Moving FlashallTool Definition
moved flashalltool definition to header file

Test: flashall on raven
Bug: 194686221
Change-Id: I5f726492ee5b3ae42755214e3de0269257b62ba8
2023-04-19 12:30:38 -07:00
Daniel Zheng 29a211c194 Changing flashall to parse fastboot-info.txt
Test: tested on Raven
Change-Id: I9f26bf6025a0a6318f84be929091f4e82bd87556
2023-04-19 12:30:37 -07:00
Daniel Zheng 37673f0bf5 Merge "Fixing circular dependency" 2023-04-19 00:16:13 +00:00
Daniel Zheng 729c159744 Merge "Moving logging include" 2023-04-18 16:26:01 +00:00
Daniel Zheng 0897526557 Fixing circular dependency
Test: tested compilation
Change-Id: Iae25cade1efb2372e5fc219fa69cbb2381b4e05c
2023-04-17 11:34:00 -07:00
Daniel Zheng 7627b54910 Moving logging include
Header file shouldn't have include of logging

Test: tested compilation
Change-Id: I02cccb66b6ee5811e5d4f2b9b72508fee640e828
2023-04-17 09:42:39 -07:00
Daniel Zheng 0a785083bb Merge "Cleaning up main code" 2023-04-13 20:44:31 +00:00
Daniel Zheng 83800601f6 Merge "Adding const to task constructors" 2023-04-10 19:44:31 +00:00
Daniel Zheng 23631b9be7 Merge "Cleaned up slot logic" 2023-04-10 18:02:05 +00:00
Daniel Zheng dddb5fa80b Merge "Correcting Reboot Task Functionality" 2023-04-10 17:46:03 +00:00
Daniel Zheng e6dbd4f194 Adding const to task constructors
Adding const decorator to class constructor to ensure Flashing Plan
isn't modified during task construction

Bug: 194686221
Test: tested Flashall on raven
Change-Id: I99b71b2b756beaf871a31a1a035545d754d128e8
2023-04-10 09:53:08 -07:00
Daniel Zheng 1e6456b011 Cleaned up slot logic
Updating old clean up slot logic change. Some devices don't know current
slot so we can't always just call get_current_slot()

Test: tested flashall on raven
Change-Id: Id655f1c1ee0b1ff09331f0d91d77412836d0af8d
2023-04-10 09:35:48 -07:00
Treehugger Robot b2fdbef489 Merge "Revert "Cleaned up some slot logic"" 2023-04-03 21:49:25 +00:00
Kelvin Zhang 2a4a45f3e4 Revert "Cleaned up some slot logic"
This reverts commit bd85a18d0b.

Reason for revert: b/276759363

Change-Id: I3ba08cf4abeeb7769569512d50e7ff135438cf20
2023-04-03 20:44:05 +00:00
Daniel Zheng b16aba889a Merge "Cleaned up some slot logic" 2023-03-30 21:49:15 +00:00
Daniel Zheng 719caca725 Merge "Added some error logs to wipe" 2023-03-30 21:30:11 +00:00
Daniel Zheng 76c9343339 Cleaning up main code
cleaning up main() code in fastboot.cpp to run off one task vector. The
eventual goal is to just have all functionality run off this vector.

Test: tested commands on raven
Bug: 194686221
Change-Id: I98d0ba33091eff31ff1bc338766c3689ffb54746
2023-03-30 18:35:14 +00:00
Daniel Zheng 1418fb8ce0 Correcting Reboot Task Functionality
Modifying fastboot-info.txt to directly call reboot fastboot instead of
reboot userspace -> so no longer need "userspace" in reboot task. Also
moving skip_reboot check to task since in old code we can have
skip_reboot be true and still reboot to bootloader, fastboot, or
recovery

Test: tested reboot commands on Raven
Change-Id: I98ba51747bf7229a88ba737540c81d20b42e5981
2023-03-30 18:35:14 +00:00
Daniel Zheng 4aa47338f2 Merge "Added check to copy AVB footer" 2023-03-30 18:24:31 +00:00
Daniel Zheng bd85a18d0b Cleaned up some slot logic
Doesn't look like we actually need current_slot, since we can always
just call function get_current_slot

Test: tested flashall on raven
Change-Id: Icba64bc9fdd08f36d44965e32558a73d0beab0e1
2023-03-30 18:21:28 +00:00
Daniel Zheng 6f213b2c79 Added some error logs to wipe
Changed so if we call wipe on a partition that doesn't exist we'll get
some helpful error messages.

Test: tested wipe test
Bug: 194686221
Change-Id: I19dc0396a7a98d0b2be7859edbffeb8acdc9850a
2023-03-30 18:19:04 +00:00
Daniel Zheng e33e8a8685 Added check to copy AVB footer
is_logical shouldn't work in bootloader for some devices, so we also need to check
using should_flash_in_userspace to see if partition is dynamic

Test: tested to flash {partition} on raven and checked to see avb
footers are not copied from dynamic partitions

Change-Id: Iabb3ea535fa80b26cf1c08040beb3d4ea5e8c2ae
2023-03-30 18:19:04 +00:00
Ayushi Khopkar 33ff88f9c3 Updated fuzz_config in Android.bp file
Added new fields in fuzz_config like - hotlists,
description, vector, service_privilege, users, fuzzed_code_usage, etc.

Bug: 271384401
Test: Build fastboot_fuzzer

Change-Id: I7799ffcb7f11202711b19cf40e8c05e050d3b519
2023-03-23 16:06:24 +05:30
David Anderson ecdbbbda82 Merge changes Ie68aed2f,Ic40696b3
* changes:
  fastboot: Handle libsparse failures better.
  libsparse: Fix allocation failures on 32-bit systems.
2023-03-22 00:02:13 +00:00
David Anderson 74c7807af1 fastboot: Handle libsparse failures better.
sparse_file_len is not actually infallible; on Windows it's pretty easy
to make it fail by embedding large files in the stream. fastboot didn't
handle this anywhere, leading to bad sparse images when libsparse
runs out of address space.

Bug: 273933042
Bug: 268872725
Test: fastboot flashall on Windows
Change-Id: Ie68aed2f1970e820350d9f97aa89a6c0242229b8
2023-03-20 15:55:57 -07:00