Commit graph

11783 commits

Author SHA1 Message Date
Bruno Martins
f1a98db8fe fixup! recovery: Add wipe system partition option
Change-Id: I8808bc49f1dcb5e3f6edb2a33a9eec65aa241068
2024-09-09 23:08:38 +02:00
86c4471e76 fixup! recovery: Disable downgrade and signature checks 2024-09-08 23:21:31 +02:00
Joseph Annareddy
9002606988 recovery: Bypass reboot prompt for sideload-auto-reboot
When we want to automatically reboot after a sideload, it doesn't make
much sense to try and prompt the user for a reboot into recovery.

Change-Id: Id0195965362b62bf940caba1f83ffe12191a73c6
2024-09-08 01:14:56 +02:00
LuK1337
9e3932f787 recovery: Simplify reboot recovery reason
It seems like "userrequested,recovery,ui" doesn't work properly on some
devices.

Change-Id: I75cba959d5f3d9d692f279e0f11e96b292c26e94
2024-09-08 01:14:43 +02:00
LuK1337
c1fb553b53 recovery: Clear BCB before rebooting to recovery
This should clear update_in_progress flag.

Change-Id: Idc5b99a77d6f1368fa37cf664a1fb5b6b19886db
2024-09-08 01:14:29 +02:00
LuK1337
d2eaf6e562 recovery: Ask to reboot before installing anything after A/B update
Change-Id: Id3e44ddbe11119fcc66d379216f8f5e683979a9f
2024-09-08 01:14:18 +02:00
Erfan Abdi
d735cd0f68 recovery: Allow comma separated codename assertions
* Using `|` is functional, but then breaks older recoveries.
  No point in disallowing commas.

Change-Id: I0f380f5c6207b1a09431b8d40a2a529d9de3233f
2024-09-08 01:14:04 +02:00
Alessandro Astone
d1d96d7d72 recovery: Allow separating device asserts with a colon too
* android::base::Split already supports multiple separators

* Make FINGERPRING_SEPARATOR a #define so that we can easily
  append the other separator. Why even was it ever a char* ?

  Note that we cannot directly make FINGERPRINT_SEPARATOR use ':'
  as a separator because, as the name suggests, it's also used to
  split build fingerprints which include ':' as a valid character.

Change-Id: I101e394d8e9fd7f2cbfcf01314e9bda38146c7d5
2024-09-08 01:13:51 +02:00
Tim Zimmermann
88a154d769 recovery: make wiping dynamic partitions work
Dynamic partitions need special handling:
 * Block device path read from fstab is actually
   the partition's name
 * We need to use BLKROSET ioctl for allowing
   write operations

Change-Id: Ib0a018f789716c9fc43db9316d15dbda13991c1e
2024-09-08 01:13:39 +02:00
aleasto
128d724d3b recovery: Support writing to Virtual A/B partitions
Change-Id: Ice74e460242a58140fe31240b9fc464848b3aeea
2024-09-08 01:13:27 +02:00
Erfan Abdi
2034cc3d05 recovery: Map logical partitions before installation
Change-Id: I785b49086a2baf462e97be831b495d7db72f7a42
2024-09-08 01:12:35 +02:00
jhenrique09
426398f75b recovery: Disable SPL downgrade check
Change-Id: I06888fd8ec698c86664ace13dd36a6a42ed46848
2024-09-08 01:12:07 +02:00
jhenrique09
b52803f855 recovery: Disable downgrade and signature checks
Change-Id: I734fad12a54a232a00240ba105a79828135896a9
2024-09-08 01:11:38 +02:00
Richard Hansen
dfdf5ad555 recovery: Print the active slot
Change-Id: I9fd731c3427c3a52641aa2e9c89eb9a20bafdd57
2024-09-08 01:10:16 +02:00
Nolen Johnson
1601bcd61b recovery: Mark as tequilaOS Recovery
* So many users think they accidetally restored the stock
  Recovery right now, as we haven't brough our custom UI
  up yet. Make it easier to discern.

Change-Id: Ic803be129e30810c9832a31d0067d981cd9795b3
Signed-off-by: zlewchan <zlewchan@icloud.com>
2024-09-08 01:09:34 +02:00
Alessandro Astone
c6947be5f1 recovery: allow opting-in to fastbootd
Change-Id: Id8228c0782f4520779d3a2116ea11015b64c13c3
2024-09-08 01:08:37 +02:00
Alessandro Astone
8d10568ac6 recovery: symlink /sbin for script compatibility
Change-Id: I6548d65c1e6f775d2d1931864ebf7830d701fbaf
2024-09-08 01:07:55 +02:00
Vojtech Bocek
000dfae7c5 recovery: init: mount pstore fs
Change-Id: Id3bf8763ccde54f87fde5cdf2db511649c376aa4
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2024-09-08 01:06:35 +02:00
Alessandro Astone
b6c2273ed4 recovery: make /etc/fstab only include entries that match the detected fs type
* toybox's `mount` does not support multiple entries like we do,
   so if we can detect the filesystem of an fstab enrtry print that
   and only that one to /etc/fstab, so that mounting via toybox has
   a better chance of succeding.

 * as a bonus, this patch also gets rid of duplicates in /etc/fstab
   caused by the fact that ReadDefaultFstab() combines entries from
   DT and from recovery.fstab

Change-Id: Iec4ab38044054555d2a33da6f5d53de7716e7bee
2024-09-08 01:06:24 +02:00
Steve Kondik
64106f94e4 recovery: Get a proper shell environment in recovery
* Root ADB shell by default
 * Try and get adb_keys from /data
 * Nicer mkshrc
 * Build a reboot command

Change-Id: I80b0e2aa5eb7142eaa9f157709f4e029077d8dfa
2024-09-08 01:05:46 +02:00
Steve Kondik
9e4271094a recovery: Puke out an /etc/fstab so stuff like busybox/toybox is happy
* And disregard special mount flags on purpose because of certain
   dubious packages which "exec busybox mount".

Squashed:
Author: Alessandro Astone <ales.astone@gmail.com>
Date:   2021-03-26 18:02:34 +0100

    roots: Correct mount flags in /etc/fstab

    The logic here got inverted.

    Change-Id: I63c0d77fa17442ae8630015a52c7bf1be66f69f4

Change-Id: I163702c9bd7fca3d40676fd6d8476e8deb13acc0
2024-09-08 01:05:29 +02:00
Tom Marshall
cff2229a28 recovery: Provide caching for sideload files
Create a cache of block data received via adb.  The cache size is set
to ensure that there is at least 400mb available for the installer.

When the cache is large enough to hold the entire file, each block is
read via adb at most once.

When the cache is not large enough to hold the entire file, the cache
will need to be pruned.  Because files tend to be read sequentially
during install, the pruning algorithm attempts to discard blocks that
are behind the current file position.

Change-Id: Id8fc7fa5b38f1d80461eb576b1a1b5d53453cfc1
2024-09-08 01:05:13 +02:00
Michael Bestas
096e85eb89 recovery: Add wipe system partition option
Change-Id: Id606cef249a7464037443de6265055803c290d82
Signed-off-by: zlewchan <zlewchan@icloud.com>
2024-09-08 01:04:52 +02:00
Simon Shields
e8ccb88add recovery_utils: add support for unmounting entire volumes
When wiping /system, the partition isn't actually mounted at /system
or / - it's mounted at /mnt/system. This breaks 'format system' from
recovery if the partition has been mounted.

This patch adds an ensure_volume_unmounted function that finds all
mounts of a given device and unmounts them, meaning the device
can be safely formatted.

Change-Id: Id4f727f845308a89e865f1ba60dc284f5ebc66e1
2024-09-08 01:03:51 +02:00
Matt Mower
cc8755d97b recovery: Allow device-specific recovery modules
Provide a means to include device-specific recovery modules that need to
be built (i.e. not pre-built). A list of recovery modules can be
specified by a device with:

TARGET_RECOVERY_DEVICE_MODULES := rec_mod_one rec_mod_two

Change-Id: Ibd19a71318863461d472471a4f7cfddfb1b9ae0d
2024-09-08 01:03:37 +02:00
ExactExampl
90e3541d88 fixup! recovery: Add runtime checks for A/B vs traditional updates
* A/B package HAS metadata

Change-Id: I06fd64fa688d1602a629f70b772628c1e8221b8a
2024-09-08 01:03:25 +02:00
Christopher N. Hesse
2433eb0334 recovery: Add runtime checks for A/B vs traditional updates
This allows A/B devices to install legacy (non-payload) style update.zip
packages like our addonsu or gapps.

Do not abort an update if META-INF/com/android/metadata is missing,
instead use it to determine whether the update is an A/B ota or not.

Change-Id: I907a92732470b947de007dde11fb71db64d94c9b
2024-09-08 01:03:18 +02:00
Richard Hansen
e741c95667 recovery: Clarify help text
Currently this help text is not rendered, but that will change in a
future commit.

Change-Id: Ic2f566b84c4f49610fe0dab5929abe19abef9275
2024-09-08 01:02:56 +02:00
Alessandro Astone
0c2f84f3c2 recovery: sdcard is data/media/0
Change-Id: Ie9978ac8b526c11199f72c4362ae3313218b48d4
2024-09-08 01:02:43 +02:00
Luca Stefani
2293566829 Don't allow mounting system on user builds
Change-Id: I7138c307ae6d7996d9fcf1cf280730ff6fb5ccf9
2024-09-08 01:02:22 +02:00
Michael Bestas
2384f9a92e recovery: Also hide rescue mode from non eng builds
Change-Id: I071f3baa6f6ee672a6d76fc7cb8b6a65b4988027
2024-09-08 01:02:10 +02:00
Michael Bestas
e211e4dc3d recovery: Only show tests in eng builds
[DD3Boh]: Adapt for Android 11

Change-Id: If783711ecd0d20728ec27ebc572b57e6d9bee760
2024-09-08 01:01:14 +02:00
Michael Bestas
08817c0e89 recovery: Expose reboot to recovery option
Change-Id: I8684e188577fa16073723e0093e221b767a3826d
2024-09-08 01:00:51 +02:00
Pat Erley
08fbf88ab6 recovery: Enable the menu for User builds
Upstream recovery doesn't provide a menu for non ENG/UserDebug
builds.

OPO-321

Change-Id: I01b285a40287be4147d15a70b91ad17a3c93da68
2024-09-08 01:00:41 +02:00
Alessandro Astone
8d038450d7 recovery: Don't consider manual install aborts as errors
* From android-11, recovery warns the user about the danger of
   rebooting after a failed update, but if we didn't even start
   the install procedure it doesn't really make much sense.

Change-Id: Ifaf5eae9fe6e1d915a035e2570c22260de59f99b
2024-09-08 01:00:30 +02:00
Michael Bestas
36c90b36d3 recovery: Blank screen on init
* Fixes touch on some devices like chiron/sagit

* Some other devices (e.g. most MTK) need this because their kernel driver
  implementations do not perform as expected (initial unblank is only
  happening when altering the panel brightness x -> 0 -> y). In regular
  Android, that "unblanking" is done on boot when the lights HAL loads and
  sets the initial brightness.

Change-Id: I2fffac508d09d07355a7a7f087805b0dceb5f97e
2024-09-08 01:00:17 +02:00
Michael Bestas
0e844b0289 Bring back file-based OTA edify functions [1/2]
Author: Tom Marshall <tdm.code@gmail.com>
Date:   Wed Oct 25 20:27:08 2017 +0200

    Revert "kill package_extract_dir"

    changes for P:
     - bring back the mkdir_recursively variant which takes a timestamp.
     - add libziparchive dependency
     - fix otautil header paths

    changes for Q:
     - change ziputil naming convention to lowercase

    This reverts commit 53c38b1538.

    Change-Id: I71c488e96a1f23aace3c38fc283aae0165129a12

Author: Tom Marshall <tdm.code@gmail.com>
Date:   Thu Dec 14 22:37:17 2017 +0100

    Revert "Remove the obsolete package_extract_dir() test"

    This reverts commit bb7e005a79.

    Change-Id: I643235d6605d7da2a189eca10ec999b25c23e1f9

Author: Tom Marshall <tdm.code@gmail.com>
Date:   Wed Aug 23 18:14:00 2017 +0000

    Revert "updater: Remove some obsoleted functions for file-based OTA."

    This reverts commit 63d786cf22.

    These functions will be used for third party OTA zips, so keep them.

    Change-Id: I24b67ba4c86f8f86d0a41429a395fece1a383efd

Author: Stricted <info@stricted.net>
Date:   Mon Mar 12 18:11:56 2018 +0100

    recovery: updater: Fix SymlinkFn args

    Change-Id: If2ba1b7a8b5ac471a2db84f352273fd0ea7c81a2

Author: Simon Shields <simon@lineageos.org>
Date:   Thu Aug 9 01:17:21 2018 +1000

    Revert "updater: Remove dead make_parents()."

    This reverts commit 5902691764.

    Change-Id: I69eadf1a091f6ecd45531789dedf72a178a055ba

Author: Simon Shields <simon@lineageos.org>
Date:   Thu Aug 9 01:20:40 2018 +1000

    Revert "otautil: Delete dirUnlinkHierarchy()."

    changes for P:
     - Fix missing PATH_MAX macro from limits.h

    This reverts commit 7934985e0c.

    Change-Id: I67ce71a1644b58a393dce45a6c3dee97830b9ee4

Author: XiNGRZ <chenxingyu92@gmail.com>
Date:   Tue Dec 3 14:31:56 2019 +0800

    updater: Fix lost capabilities of set_metadata

    This was broken since Android O. During a file-based incremental OTA,
    capability flags were cleared but not being set again properly, leading
    some critical processes (e.g. surfaceflinger and pm-service) fails.

    For more details, see: 65b8d749f7

    Change-Id: I20e616cd83ec1cd1b79717a6703919316ad77938

[mikeioannina]: Squash for Q and run through clang-format

[Chippa_a]: Adapt for Android R updater and libziparchive API

Change-Id: I91973bc9e9f8d100688c0112fda9043fd45eb86a
2024-09-08 00:58:50 +02:00
Android Build Coastguard Worker
505722d4e5 Snap for 11859356 from eda4a8c615 to 24Q3-release
Change-Id: Id4cc4d5b0e58839eb40e68f79871c8243b3b692b
2024-05-18 03:00:42 +00:00
Treehugger Robot
eda4a8c615 Merge "Update OWNERS for minadbd." into main am: 1dec443d6e am: ed71bac1b0
Original change: https://android-review.googlesource.com/c/platform/bootable/recovery/+/3092346

Change-Id: I113465de397935d532a7a4579b50d69ecb9ecc1b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-05-17 17:53:12 +00:00
Treehugger Robot
ed71bac1b0 Merge "Update OWNERS for minadbd." into main am: 1dec443d6e
Original change: https://android-review.googlesource.com/c/platform/bootable/recovery/+/3092346

Change-Id: I8db5d73343acb7f93928a04e4678a49f8170c265
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-05-17 17:36:53 +00:00
Treehugger Robot
1dec443d6e Merge "Update OWNERS for minadbd." into main 2024-05-17 17:08:10 +00:00
Elliott Hughes
fa2b495917 Update OWNERS for minadbd.
This code sometimes needs to track adbd changes.

Change-Id: Icbda00309698b210d1d79b88322f1c6e9483f11d
2024-05-17 11:16:45 +00:00
Android Build Coastguard Worker
cf5f124738 Snap for 11840485 from f212446a33 to 24Q3-release
Change-Id: If43aa1186df3bd7cd64e0bd7516a490b5428c123
2024-05-14 23:00:57 +00:00
Kelvin Zhang
f212446a33 [automerger skipped] Merge "Revert "Remove non-AB unittests"" into main am: 330bd0526f am: cd904626b4 -s ours
am skip reason: Merged-In I3d82d9031446be355d8a1d077ab83283c7cc769c with SHA-1 c7ebad5fd6 is already in history. Merged-In was found from reverted change.

Reverted change: https://android-review.googlesource.com/c/platform/bootable/recovery/+/3083670

Original change: https://android-review.googlesource.com/c/platform/bootable/recovery/+/3086245

Change-Id: I6abeef503de0a785b4bbd80810038135add5ec5b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-05-14 18:15:47 +00:00
Kelvin Zhang
cd904626b4 Merge "Revert "Remove non-AB unittests"" into main am: 330bd0526f
Original change: https://android-review.googlesource.com/c/platform/bootable/recovery/+/3086245

Change-Id: I0380098aa2ffacab2761f8c501d9b84cdcad30c6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-05-14 17:56:17 +00:00
Kelvin Zhang
330bd0526f Merge "Revert "Remove non-AB unittests"" into main 2024-05-14 17:38:37 +00:00
Kelvin Zhang
63ea13852d Revert "Remove non-AB unittests"
This reverts commit f203ee526f.

Reason for revert: b/340571274

Merged-In: I3d82d9031446be355d8a1d077ab83283c7cc769c
Change-Id: I36d6246a32a83545b1d1b708372e8d3d72b4a041
2024-05-14 17:38:24 +00:00
Treehugger Robot
e27ddc466b [automerger skipped] Merge "Remove non-AB unittests" into main am: 2611111482 am: 360806e44c -s ours
am skip reason: Merged-In I3d82d9031446be355d8a1d077ab83283c7cc769c with SHA-1 c7ebad5fd6 is already in history

Original change: https://android-review.googlesource.com/c/platform/bootable/recovery/+/3083670

Change-Id: Ib290308b2c210fdf18a6edac3ec2f1b610026906
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-05-14 17:31:24 +00:00
Treehugger Robot
360806e44c Merge "Remove non-AB unittests" into main am: 2611111482
Original change: https://android-review.googlesource.com/c/platform/bootable/recovery/+/3083670

Change-Id: I6cc4fd146db5ba40f2bdb51b7cdd088894a9eebf
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-05-14 16:25:27 +00:00
Treehugger Robot
2611111482 Merge "Remove non-AB unittests" into main 2024-05-14 16:00:48 +00:00