|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| applypatch/ | | 03-May-2024 | - | 3,748 | 2,571 |
| bootloader_message/ | | 03-May-2024 | - | 572 | 385 |
| edify/ | | 03-May-2024 | - | 1,179 | 797 |
| etc/ | | 03-May-2024 | - | 176 | 140 |
| fastboot/ | | 03-May-2024 | - | 108 | 55 |
| fonts/ | | 03-May-2024 | - | 101 | 79 |
| fuse_sideload/ | | 03-May-2024 | - | 854 | 562 |
| install/ | | 03-May-2024 | - | 3,450 | 2,308 |
| minadbd/ | | 03-May-2024 | - | 1,109 | 746 |
| minui/ | | 03-May-2024 | - | 2,351 | 1,630 |
| otautil/ | | 03-May-2024 | - | 1,394 | 886 |
| recovery_ui/ | | 03-May-2024 | - | 3,796 | 2,486 |
| recovery_utils/ | | 03-May-2024 | - | 1,244 | 824 |
| res-hdpi/images/ | | 03-May-2024 | - | | |
| res-mdpi/images/ | | 03-May-2024 | - | | |
| res-xhdpi/images/ | | 03-May-2024 | - | | |
| res-xxhdpi/images/ | | 03-May-2024 | - | | |
| res-xxxhdpi/images/ | | 03-May-2024 | - | | |
| tests/ | | 03-May-2024 | - | 16,898 | 13,696 |
| tools/ | | 03-May-2024 | - | 2,636 | 2,103 |
| uncrypt/ | | 03-May-2024 | - | 777 | 550 |
| update_verifier/ | | 03-May-2024 | - | 804 | 541 |
| updater/ | | 03-May-2024 | - | 6,768 | 4,726 |
| updater_sample/ | | 03-May-2024 | - | 4,041 | 2,579 |
| .clang-format | D | 03-May-2024 | 1.6 KiB | 46 | 42 |
| Android.bp | D | 03-May-2024 | 4.9 KiB | 239 | 199 |
| Android.mk | D | 03-May-2024 | 3 KiB | 83 | 39 |
| CleanSpec.mk | D | 03-May-2024 | 3.9 KiB | 75 | 18 |
| METADATA | D | 03-May-2024 | 298 | 10 | 9 |
| NOTICE | D | 03-May-2024 | 10.4 KiB | 191 | 158 |
| OWNERS | D | 03-May-2024 | 87 | 6 | 5 |
| PREUPLOAD.cfg | D | 03-May-2024 | 336 | 11 | 8 |
| README.md | D | 03-May-2024 | 6.3 KiB | 160 | 111 |
| TEST_MAPPING | D | 03-May-2024 | 114 | 11 | 10 |
| bootloader.h | D | 03-May-2024 | 775 | 19 | 1 |
| interlace-frames.py | D | 03-May-2024 | 3.5 KiB | 115 | 69 |
| recovery-persist.cpp | D | 03-May-2024 | 5.7 KiB | 183 | 106 |
| recovery-persist.rc | D | 03-May-2024 | 127 | 4 | 3 |
| recovery-refresh.cpp | D | 03-May-2024 | 2.6 KiB | 73 | 24 |
| recovery-refresh.rc | D | 03-May-2024 | 76 | 3 | 2 |
| recovery.cpp | D | 03-May-2024 | 31.5 KiB | 880 | 640 |
| recovery.h | D | 03-May-2024 | 797 | 25 | 5 |
| recovery_main.cpp | D | 03-May-2024 | 18.1 KiB | 575 | 433 |
README.md
1The Recovery Image
2==================
3
4Quick turn-around testing
5-------------------------
6
7* Devices using recovery-as-boot (e.g. Pixels, which set BOARD\_USES\_RECOVERY\_AS\_BOOT)
8
9 # After setting up environment and lunch.
10 m -j bootimage
11 adb reboot bootloader
12
13 # Pixel devices don't support booting into recovery mode with `fastboot boot`.
14 fastboot flash boot
15
16 # Manually choose `Recovery mode` from bootloader menu.
17
18* Devices with a separate recovery image (e.g. Nexus)
19
20 # After setting up environment and lunch.
21 mm -j && m ramdisk-nodeps && m recoveryimage-nodeps
22 adb reboot bootloader
23
24 # To boot into the new recovery image without flashing the recovery partition:
25 fastboot boot $ANDROID_PRODUCT_OUT/recovery.img
26
27Running the tests
28-----------------
29
30 # After setting up environment and lunch.
31 mmma -j bootable/recovery
32
33 # Running the tests on device (under normal boot).
34 adb root
35 adb sync data
36
37 # 32-bit device
38 adb shell /data/nativetest/recovery_unit_test/recovery_unit_test
39
40 # Or 64-bit device
41 adb shell /data/nativetest64/recovery_unit_test/recovery_unit_test
42
43Running the manual tests
44------------------------
45
46`recovery-refresh` and `recovery-persist` executables exist only on systems without
47/cache partition. And we need to follow special steps to run tests for them.
48
49- Execute the test on an A/B device first. The test should fail but it will log
50 some contents to pmsg.
51
52- Reboot the device immediately and run the test again. The test should save the
53 contents of pmsg buffer into /data/misc/recovery/inject.txt. Test will pass if
54 this file has expected contents.
55
56Using `adb` under recovery
57--------------------------
58
59When running recovery image from debuggable builds (i.e. `-eng` or `-userdebug` build variants, or
60`ro.debuggable=1` in `/prop.default`), `adbd` service is enabled and started by default, which
61allows `adb` communication. A device should be listed under `adb devices`, either in `recovery` or
62`sideload` state.
63
64 $ adb devices
65 List of devices attached
66 1234567890abcdef recovery
67
68Although `/system/bin/adbd` is built from the same code base as the one in the normal boot, only a
69subset of `adb` commands are meaningful under recovery, such as `adb root`, `adb shell`, `adb push`,
70`adb pull` etc. Since Android Q, `adb shell` no longer requires manually mounting `/system` from
71recovery menu.
72
73## Troubleshooting
74
75### `adb devices` doesn't show the device.
76
77 $ adb devices
78 List of devices attached
79
80 * Ensure `adbd` is built and running.
81
82By default, `adbd` is always included into recovery image, as `/system/bin/adbd`. `init` starts
83`adbd` service automatically only in debuggable builds. This behavior is controlled by the recovery
84specific `/init.rc`, whose source code is at `bootable/recovery/etc/init.rc`.
85
86The best way to confirm a running `adbd` is by checking the serial output, which shows a service
87start log as below.
88
89 [ 18.961986] c1 1 init: starting service 'adbd'...
90
91 * Ensure USB gadget has been enabled.
92
93If `adbd` service has been started but device not shown under `adb devices`, use `lsusb(8)` (on
94host) to check if the device is visible to the host.
95
96`bootable/recovery/etc/init.rc` disables Android USB gadget (via sysfs) as part of the `fs` action
97trigger, and will only re-enable it in debuggable builds (the `on property` rule will always run
98_after_ `on fs`).
99
100 on fs
101 write /sys/class/android_usb/android0/enable 0
102
103 # Always start adbd on userdebug and eng builds
104 on property:ro.debuggable=1
105 write /sys/class/android_usb/android0/enable 1
106 start adbd
107
108If device is using [configfs](https://www.kernel.org/doc/Documentation/usb/gadget_configfs.txt),
109check if configfs has been properly set up in init rc scripts. See the [example
110configuration](https://android.googlesource.com/device/google/wahoo/+/master/init.recovery.hardware.rc)
111for Pixel 2 devices. Note that the flag set via sysfs (i.e. the one above) is no-op when using
112configfs.
113
114### `adb devices` shows the device, but in `unauthorized` state.
115
116 $ adb devices
117 List of devices attached
118 1234567890abcdef unauthorized
119
120recovery image doesn't honor the USB debugging toggle and the authorizations added under normal boot
121(because such authorization data stays in /data, which recovery doesn't mount), nor does it support
122authorizing a host device under recovery. We can use one of the following options instead.
123
124 * **Option 1 (Recommended):** Authorize a host device with adb vendor keys.
125
126For debuggable builds, an RSA keypair can be used to authorize a host device that has the private
127key. The public key, defined via `PRODUCT_ADB_KEYS`, will be copied to `/adb_keys`. When starting
128the host-side `adbd`, make sure the filename (or the directory) of the matching private key has been
129added to `$ADB_VENDOR_KEYS`.
130
131 $ export ADB_VENDOR_KEYS=/path/to/adb/private/key
132 $ adb kill-server
133 $ adb devices
134
135`-user` builds filter out `PRODUCT_ADB_KEYS`, so no `/adb_keys` will be included there.
136
137Note that this mechanism applies to both of normal boot and recovery modes.
138
139 * **Option 2:** Allow `adbd` to connect without authentication.
140 * `adbd` is compiled with `ALLOW_ADBD_NO_AUTH` (only on debuggable builds).
141 * `ro.adb.secure` has a value of `0`.
142
143Both of the two conditions need to be satisfied. Although `ro.adb.secure` is a runtime property, its
144value is set at build time (written into `/prop.default`). It defaults to `1` on `-user` builds, and
145`0` for other build variants. The value is overridable via `PRODUCT_DEFAULT_PROPERTY_OVERRIDES`.
146
147Localization of the background texts
148------------------------------------
149
150The recovery image supports localization of several background texts, e.g. installing, error,
151factory reset warnings, etc. For devices using `xxhdpi` and `xxxhdpi`, the build system generates
152these localization images dynamically since android-10 when building the recovery image. While
153the static images under res-*dpi/images/ is used for other display resolutions and as a
154backup.
155
156Check the invocation of the image_generator tool in the [makefile]. And the detailed usage of the
157image_generator is documented [here](./tools/image_generator/README.md).
158
159[makefile]: https://android.googlesource.com/platform/build/+/refs/heads/master/core/Makefile#1800
160