recovery 调试

Android 启动后,会先运行 bootloader。 Bootloader 会根据某些判定条件决定是否进入 recovery
模式。 Recovery 模式会装载 recovery 分区,该分区包含 recovery.img。 Recovery.img 包含了标准
内核(和 boot.img 中的内核相同)以及 recovery 根文件系统。
 

开启recovery 模式下的 adb调试

## Troubleshooting

### `adb devices` doesn't show the device.

    $ adb devices
    List of devices attached

 * Ensure `adbd` is built and running.

By default, `adbd` is always included into recovery image, as `/system/bin/adbd`. `init` starts
`adbd` service automatically only in debuggable builds. This behavior is controlled by the recovery
specific `/init.rc`, whose source code is at `bootable/recovery/etc/init.rc`.

The best way to confirm a running `adbd` is by checking the serial output, which shows a service
start log as below.

    [   18.961986] c1      1 init: starting service 'adbd'...

 * Ensure USB gadget has been enabled.

If `adbd` service has been started but device not shown under `adb devices`, use `lsusb(8)` (on
host) to check if the device is visible to the host.

`bootable/recovery/etc/init.rc` disables Android USB gadget (via sysfs) as part of the `fs` action
trigger, and will only re-enable it in debuggable builds (the `on property` rule will always run
_after_ `on fs`).

    on fs
        write /sys/class/android_usb/android0/enable 0

    # Always start adbd on userdebug and eng builds
    on property:ro.debuggable=1
        write /sys/class/android_usb/android0/enable 1
        start adbd

开启串口调试

recovery 调试_第1张图片

 

编译单独

* Devices using recovery-as-boot (e.g. Pixels, which set BOARD\_USES\_RECOVERY\_AS\_BOOT)

      # After setting up environment and lunch.
      m -j bootimage
      adb reboot bootloader

      # Pixel devices don't support booting into recovery mode with `fastboot boot`.
      fastboot flash boot

      # Manually choose `Recovery mode` from bootloader menu.

* Devices with a separate recovery image (e.g. Nexus)

      # After setting up environment and lunch.
      mm -j && m ramdisk-nodeps && m recoveryimage-nodeps
      adb reboot bootloader

      # To boot into the new recovery image without flashing the recovery partition:
      fastboot boot $ANDROID_PRODUCT_OUT/recovery.img
 

你可能感兴趣的:(手机移动开发,android,adb)