Commit graph

256 commits

Author SHA1 Message Date
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
Kelvin Zhang
c7ebad5fd6 rm -rf non-AB code
Bug: 324360816
Test: th
Change-Id: I3d82d9031446be355d8a1d077ab83283c7cc769c
2024-04-05 09:49:38 -07:00
Daeho Jeong
88cf074405 Add erofs tools in recovery mode
Bug: 201685920
Test: mm fsck.erofs
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Change-Id: Ie9a4dcd28c4b6348f34859a9b4989ef1f29f787f
2021-12-03 19:37:56 +00:00
Randall Huang
6a6a412686 Add fsck.f2fs to recovery mode
Bug: 202789846
Test: run factory data reset
Change-Id: Ief1fd480ac4c1aaaa3db85d153832e5311bf07e6
Signed-off-by: Randall Huang <huangrandall@google.com>
2021-10-13 03:12:22 +00:00
Inseob Kim
5d4dea1618 Use recovery variant for librecovery_ui_ext
It's installed to recovery, so it should use recovery variants.

Bug: 192312249
Test: boot and enter recovery mode
Change-Id: I99eafa756ba071e37c7ee60a8da210385378710b
2021-06-30 15:08:16 +09:00
Bob Badour
29be3f6ef1 [LSC] Add LOCAL_LICENSE_KINDS to bootable/recovery
Added SPDX-license-identifier-Apache-2.0 to:
  applypatch/Android.bp
  bootloader_message/Android.bp
  edify/Android.bp
  fuse_sideload/Android.bp
  install/Android.bp
  minadbd/Android.bp
  minui/Android.bp
  otautil/Android.bp
  recovery_ui/Android.bp
  recovery_utils/Android.bp
  tests/Android.bp
  tools/image_generator/Android.bp
  tools/recovery_l10n/Android.bp
  uncrypt/Android.bp
  update_verifier/Android.bp
  updater/Android.bp
  updater/Android.mk
  updater_sample/Android.bp
  updater_sample/tests/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-MIT
    SPDX-license-identifier-OFL
to:
  Android.bp
  Android.mk

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: I3da761b525452838977297f773974000d4de7bd6
2021-02-14 10:37:20 -08:00
Hongguang Chen
042672729c Add EthernetDevice to manage ethernet connection.
The current fastbootd only supports USB protocol. But some Android TV
devices are built without USB port. The fastbootd cannot be used on
those ATV devices due to it. aosp/1295566 enables fastbootd over
ethernet.

This change adds an EthernetDevice to manage ethernet connection and set
fastbootd protcol property fastbootd.protocol to enable fastbootd over
ethernet in recovery mode. It uses IPv6 link-local address to not expose
the devices out of the network segment. The devices who want to use this
EthernetDevice should add
“TARGET_RECOVERY_UI_LIB := librecovery_ui_ethernet” into BoardConfig.mk.

BUG: 152544169
Test: Enter and exit fastboot mode and check eth0 IPv6 link-local address
on screen UI.

Change-Id: I73fe44be3790bdba5a6059fbba3f7264b21eed99
2020-05-15 15:18:41 -07:00
Tom Marshall
e632d03206 recovery: Remove HOST_OS guard for f2fs tools
These build correctly under MacOS.

Change-Id: I00bf26fdcc4ed560111e5c0b8f649feec72579d8
2019-10-29 20:05:45 +02:00
Hridya Valsaraju
6f44c11357 e2fsck_static is no longer needed for remount
Remount will instead use overlayfs. If the device is not configured
to use overlayfs or if the device does not support dynamic partitions
but has chosed to setup an ext4-dedupe filesystem, e2fsck_static must
then be included in recovery.

Bug: 122115286
Test: fastboot flashall
Change-Id: I931282dbc67ff4ef53291bcbc5a078b500e5e807
2019-01-16 23:42:55 +00:00
Tao Bao
c674dfb584 Use dynamically linked f2fs executables.
It also reduces the space cost for devices using f2fs (e.g. crosshatch).
/sbin/mkfs.f2fs   722560 => /system/bin/make_f2fs   49568
/sbin/sload.f2fs 1182456 => /system/bin/sload_f2fs 150032

Test: Build and boot recovery on crosshatch. Factory reset.
Test: Install a non-A/B OTA package that formats a f2fs partition.
Change-Id: Ibe70c8d91a1d07e1c78ff9eac19b1f7955800161
2018-12-20 14:47:11 -08:00
Tianjie Xu
2b1a464a70 Move the parse of last_install to recovery-persist
The recovery-persist used to look for the related recovery logs in
persist storage, and copy them under /data/misc/recovery during the
normal boot process.

As we also want to find out the sideload information from last_install,
it makes more sense to move the parse & report of non-a/b metrics to
recovery-persist. Thus we can avoid the race condition of the file
system between the native code and RecoverySystem.

Bug: 114278989
Test: unit test pass, check the event buffer for metrics report
Change-Id: I32d7b2b831bc74a61a70af9a2f0b8a7e9b3e36ee
2018-09-13 13:27:55 -07:00
Tao Bao
ef5e38fef0 tests: Move to Android.bp.
Also separate libupdater_defaults out to be shareable.

It turns out the `data` property in `cc_test` doesn't follow symlinks as
LOCAL_TEST_DATA does in Android.mk. This CL creates a filegroup in
top-level Android.bp in order to pick up the testdata for ResourcesTest.

Test: `mmma -j bootable/recovery` with aosp_marlin-userdebug
Test: Run recovery_{unit,component,manual}_test on marlin.
Test: Run recovery_host_test.
Change-Id: I4532ab25aeb83c0b0baa8051d5fe34ba7b910a35
2018-08-14 21:46:45 -07:00
Tao Bao
673bb6f051 updater: Move libupdater to Soong.
Test: mmma -j bootable/recovery
Test: Run recovery_unit_test and recovery_component_test on marlin.
Change-Id: I2617b87d13c585addf0ed2fbae8c3ce443ea7200
2018-08-13 09:44:48 -07:00
Tao Bao
df264e0186 Merge "Build recovery with Soong." 2018-08-13 16:25:48 +00:00
Treehugger Robot
bbe881693a Merge "Build boot control HAL with Android.bp" 2018-08-10 22:48:19 +00:00
Tao Bao
5fc72a103b Build recovery with Soong.
Fixes: 110380063
Test: `mmma -j bootable/recovery` with aosp_taimen-userdebug
Test: Build and boot into recovery on taimen. Check the basic
      functionalities (`Apply update from ADB`, `View recovery logs`,
      `Run graphics test`).
Test: Run recovery_unit_test and recovery_component_test on marlin.
Test: Modify `recovery.cpp` locally to trigger the call to
      is_battery_ok(). Check that the battery info is reported
      correctly.
Test: `build/soong/build_test.bash --dist`
Change-Id: I391eb201d57c760e457ba2bf2410ceb72596795c
2018-08-10 14:43:27 -07:00
Tao Bao
afa16480aa Merge "updater_sample: Move to Soong." 2018-08-10 18:10:31 +00:00
Tao Bao
d2be7fc29a updater_sample: Move to Soong.
Test: Follow the steps in "Running tests" in updater_sample/README.md.
Change-Id: I70c3239e3daea0dcdadf02f68abe7d6aafa67a2e
2018-08-10 09:05:56 -07:00
Hridya Valsaraju
c53dad20d0 Build boot control HAL with Android.bp
Bug: 78793464
Test: make
Change-Id: Id5efceda0f5e93bbaf33c2dc3e203fd39ef44e28
2018-08-09 22:15:01 -07:00
Tao Bao
818f938188 recovery uses more shared libraries.
Bug: 110380063
Test: `m -j installclean && mmma -j bootable/recovery` with
      aosp_taimen-userdebug
Test: Build (`m -j bootimage`) and boot into recovery. Check that
      `adb sideload` and `Run graphics test` both work.
Test: Run recovery_unit_test and recovery_component_test on marlin.
Change-Id: Ie6ed0e7cafa352d5faff9d1b6ccef724a0415e65
2018-08-08 14:26:27 -07:00
Tao Bao
c70446ce7b Revert "Build and use minadbd as a shared library."
This reverts commit 4fd4f89591.

The reverted CL has a side effect that unintentionally installs
a copy of libminadbd_services.so to the system image. This breaks the
check with `build/soong/build_test.bash --dist` which detects and
prevents vendor modules from installing files to the system image.

Prior to fully converting `recovery` to be built with Soong, we have to
statically link recovery-specific modules into `recovery`.

Bug: 110380063
Test: `m -j bootimage` with aosp_marlin-userdebug
Test: Run minadbd_test on marlin.
Test: Boot into recovery and verify that sideloading still works.
Test: `build/soong/build_test.bash --dist`
Change-Id: I290d55c82e17aa60a5afdf2ff7f896afc4dae8b3
2018-08-07 20:44:39 -07:00
Tao Bao
ea38c4160a Merge "Build and use minadbd as a shared library." 2018-08-07 17:50:45 +00:00
Tao Bao
4fd4f89591 Build and use minadbd as a shared library.
The former `minadbd` module is now built as a shared library
(`libminadbd_services.so`) that serves sideloading under recovery, with
a dynamic dependency on `libadbd.so`.

This allows sharing and reusing libadbd code on device (both of `adbd`
and `recovery` now uses `libadbd.so`). As a result, it reduces the size
of `recovery` binary from 1407360-byte to (1272880 + 33032)-byte
(aosp_marlin-userdebug).

Bug: 78793464
Test: `m -j bootimage` with aosp_marlin-userdebug
Test: Run minadbd_test on marlin.
Test: Boot into recovery and verify that sideloading still works.
Change-Id: I6c2bc3d351d5af71220a9b9f956c8c039e52c781
2018-08-06 17:06:43 -07:00
Tao Bao
75acf24207 Merge "Dynamically load device-specific recovery UI lib."
am: 9cf9b689d9

Change-Id: I73e3fdc01ff4b51fd18272980ce1360b0bc069f7
2018-08-06 15:32:57 -07:00
Tao Bao
42c45e2b66 Dynamically load device-specific recovery UI lib.
We used to statically link the device-specific recovery UI extension
(`TARGET_RECOVERY_UI_LIB`) into `recovery`. Such a logic can't be easily
migrated to Soong, as modules specified by `TARGET_RECOVERY_UI_LIB` may
not be built with Soong.

Instead of porting all the device-specific codes over, this CL builds
and installs the UI lib as a shared library with Android.mk. `recovery`
dlopen(3)'s and dlsym(3)'s `make_device` to invoke the device-specific
UI lib on start.

Note that in order to make dlopen(3) actually working, we have to switch
`recovery` to be dynamically linked (we will make the move later
anyway).

Bug: 110380063
Test: Build and boot into marlin recovery image. Check that
      device-specific recovery UI is successfully loaded.
Change-Id: Ia9861c7559a95f3f50676534540c0cb87cae4574
2018-08-06 12:35:23 -07:00
Tao Bao
ea105889a5 Merge "minui: Move to Soong."
am: f2bc68cfe1

Change-Id: Iab9a892a3d4d691884e4709c288de1d122d67473
2018-08-06 10:58:16 -07:00
Tao Bao
7ee83f627e minui: Move to Soong.
Note that although libminui says "shared_libs" in Android.bp file,
`recovery` binary will still statically link the libs, until we drop the
`LOCAL_FORCE_STATIC_EXECUTABLE := true` flag from `recovery` module.

Bug: 110380063
Test: `mmma -j bootable/recovery` with aosp_taimen-userdebug
Test: Boot into recovery and `Run graphics test`.
Change-Id: I48785d161dfe52eb01667e938d9c3f0a497b61a2
2018-08-05 14:42:26 -07:00
Tao Bao
17bf8d0518 Merge "ui: Read custom recovery UI values via system property."
am: 2117b4bd07

Change-Id: Ia9e2d805f2e90b9be8426010581a32d0b27fe8e6
2018-08-03 16:02:17 -07:00
Tao Bao
0bc88de7aa ui: Read custom recovery UI values via system property.
The matching change to build system now writes these values as build
properties for recovery image. This allows us dropping the dependency on
Android.mk (as well as having more flexibility to do UI customization).

Also rename a few constant names, as the naming doesn't fully follow the
style guide (which reads "whose value is fixed for the duration of the
program").

Bug: 110380063
Test: Build and flash recovery image on taimen, which uses custom margin
      height. Check the UI and choose `Run graphics test`.
Change-Id: I2c50326123639cb36022f51b62cdeed925d77ba7
2018-07-31 15:14:40 -07:00
Hridya Valsaraju
ed2480be9b Merge "Move recovery from /sbin to /system/bin"
am: 4c80768796

Change-Id: I543608d884f1cfe1fea59e78a4a47c6d6c3be4a1
2018-07-27 13:34:20 -07:00
Hridya Valsaraju
cfb3c92302 Move recovery from /sbin to /system/bin
Executables should be in /system/bin
rather than sbin.

Bug: 78793464
Test: boot into recovery, try adb sideload
Change-Id: I194589119a099d29e56b0648f0906a5ae2aa6770
2018-07-26 17:12:40 -07:00
Hridya Valsaraju
b6b129b258 Revert "Make recovery libraries shared / recovery_available"
This reverts commit c936a69619.

Reason for revert: b/111734137

Change-Id: Ie9c1fdc75d6e87dba7019c4e6d1799af25c2f94a
2018-07-23 17:49:14 +00:00
Jerry Zhang
c936a69619 Make recovery libraries shared / recovery_available
Test: compiles
Bug: 78793464
Change-Id: Iff64bc1a597e70f749a9d825f7d386baa427be3d
Merged-In: Iff64bc1a597e70f749a9d825f7d386baa427be3d
(cherry picked from commit 92969c49dc)
2018-07-20 17:54:03 +00:00
Jiyong Park
681ae40d41 Merge "e2fsdroid and mke2fs are dynamic executable in recovery partition"
am: 9b5d4ea20f

Change-Id: I017a76c320f29baff3183b0156c1fdf2deed66bf
2018-06-20 15:24:29 -07:00
Jiyong Park
69364fe553 e2fsdroid and mke2fs are dynamic executable in recovery partition
The two utilities are now converted to dynamic executables as shared
libraries are supported in recovery mode.

As part of the conversion, their location has moved from /sbin to
/system/bin. Reflect the change in the program 'recovery'

Bug: 79146551
Test: adb reboot recovery, and select 'Wipe data/factory reset'. The
data partition is formatted and there is no selinux denial.

Change-Id: Ie7cfc4c50ab1e6767e4a5170533ccf826ec7d7f3
2018-06-20 14:24:05 +09:00
Tao Bao
a855c33880 Merge "Drop the dependency on AB_OTA_UPDATER flag."
am: 9fb0d89583

Change-Id: Id57bbf9ba9d8e4fe905dc183f0655f1b24db89fd
2018-06-19 13:05:24 -07:00
Tao Bao
cf60a44bd4 Drop the dependency on AB_OTA_UPDATER flag.
This shortens the gap between A/B and non-A/B builds, by replacing the
dependency on build-time flag with runtime detection instead. It also
allows building and testing both paths regardless of the target OTA
type.

The size increase to /sbin/recovery looks negligible (< 0.01%).
 - marlin: increased from 2084928 to 2085024;
 - angler: increased from 2084776 to 2084896.

Test: Run recovery_component_test on angler and marlin.
Test: Sideload an A/B OTA package on marlin.
Test: Sideload a non-A/B OTA package on angler.
Change-Id: I1d927d1ede9713fb42f73b4fe324aa5705ee6f99
2018-06-19 10:50:43 -07:00
David Anderson
5a78f3984f Merge "recovery: add --fsck_unshare_blocks option for adb remount" am: bda4495176
am: b0d9b3594b

Change-Id: I86d3af476e87184e653de38cdb4faa1c9975ccba
2018-05-31 18:11:40 -07:00
David Anderson
edee8361d7 recovery: add --fsck_unshare_blocks option for adb remount
Allow "adb remount" on deduplicated filesystems to reboot into recovery
and run e2fsck to undo deduplication. The e2fsck binary is copied from
the system partition into tmpfs, and the system partition is unmounted
so e2fsck can run safely.

Bug: 64109868
Test: recovery with --fsck_unshare_blocks; adb remount
Change-Id: I7558749b018b58f3c4339e51a95831dbd5be1ae3
2018-05-30 13:24:30 -07:00
Tao Bao
f91fdfb3fc Merge "tools: Move to Soong." am: 6b16093b29
am: 9016deefe4

Change-Id: I1c8b1dd470279e3e5b8ca15c76dfe09691257bd6
2018-05-29 11:09:10 -07:00
Tao Bao
6b16093b29 Merge "tools: Move to Soong." 2018-05-29 17:55:39 +00:00
Tao Bao
e462cdffe9 tools: Move to Soong.
Test: `mmma -j bootable/recovery/`
Test: Build and run RecoveryLocalizer on device.
Change-Id: I3359223c82bd670c94ad51296cb8b357b04f5349
2018-05-17 13:10:08 -07:00
Tao Bao
371fe6e8bc Move stuff from recovery into librecovery.
Move most source files into librecovery so they become testable. Only
recovery_main.cpp and logging.cpp are built into recovery module, as
they perform one-time setup (e.g. setting up logger).

Test: `mmma -j bootable/recovery` with
      aosp_{angler,bullhead,fugu,dragon,marlin}-userdebug
Test: recovery_host_test; recovery_unit_test; recovery_component_test;
      recovery_manual_test
Test: Build and boot into recovery image on angler.
Change-Id: Ic4444f87a2f123557c71085f81dc2b2764c05ed8
Merged-In: Ic4444f87a2f123557c71085f81dc2b2764c05ed8
2018-05-17 09:59:26 -07:00
Tao Bao
fd0ace8f6e Move stuff from recovery into librecovery.
Move most source files into librecovery so they become testable. Only
recovery_main.cpp and logging.cpp are built into recovery module, as
they perform one-time setup (e.g. setting up logger).

Test: `mmma -j bootable/recovery` with
      aosp_{angler,bullhead,fugu,dragon,marlin}-userdebug
Test: recovery_host_test; recovery_unit_test; recovery_component_test;
      recovery_manual_test
Test: Build and boot into recovery image on angler.
Change-Id: Ic4444f87a2f123557c71085f81dc2b2764c05ed8
(cherry picked from commit bf4c006d7bc8a4517c82399bbffd9cb09971c0b4)
2018-05-16 22:31:41 -07:00
Tao Bao
554a876cc1 Merge "Clean up the Makefile for recovery and tests." am: 1f0b9962b0
am: 0c2998ffe3

Change-Id: I5d4765279fa10317e7f8d61cc4f0972baf10040e
2018-05-11 18:06:19 -07:00
Tao Bao
9e30997676 Clean up the Makefile for recovery and tests.
Reorder librecovery and librecovery_ui, so that librecovery stays closer
to recovery (in preparation for later changes that move more files
between the two). For the libraries in LOCAL_STATIC_LIBRARIES, reorder
them based on the dependency - local modules coming first, with external
libraries near the end. Sort the local / external modules, unless a
specific order is needed.

In tests/Android.mk, split the monolithic list of LOCAL_STATIC_LIBRARIES
based on modules. This makes adding / finding libraries easier.

There's no functionality in this CL.

Test: mmma -j bootable/recovery
Change-Id: I6836be574df565001ae9cd3d466a2b6460d90d08
2018-05-11 15:53:58 -07:00
Tao Bao
81726e4430 Merge "Move device.cpp into librecovery_ui." am: db6dc14bff
am: fb8636f48f

Change-Id: I18cad42da6f9f560c3ed1568a20889419520cd21
2018-05-11 14:50:21 -07:00
Tao Bao
db6dc14bff Merge "Move device.cpp into librecovery_ui." 2018-05-11 21:38:01 +00:00
Tao Bao
e0871294aa Merge "tests: Add tests for ScreenRecoveryUI." am: 8c6f699b36
am: ca88c67135

Change-Id: I238b8b412046c883863828d2b7578d51dadef9e0
2018-05-11 13:22:26 -07:00
Tao Bao
8c6f699b36 Merge "tests: Add tests for ScreenRecoveryUI." 2018-05-11 20:06:22 +00:00