recovery debug

sm8150平台,在recovery enable adb

需要mount system。

参考recovery程序的prompt_and_wait()函数,添加如下代码到recovery main函数:

        // For a system image built with the root directory (i.e. system_root_image == "true"), we
        // mount it to /system_root, and symlink /system to /system_root/system to make adb shell
        // work (the symlink is created through the build system). (Bug: 22855115)
		
        if (android::base::GetBoolProperty("ro.build.system_root_image", false)) {
          if (ensure_path_mounted_at("/", "/system_root") != -1) {
            ui->Print("Mounted /system.\n");
          }
        } else {
          if (ensure_path_mounted("/system") != -1) {
            ui->Print("Mounted /system.\n");
          }
        }

build\core\Makefile文件修改如下:

  $(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)), \
    $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/system_root; \
            rm -rf $(TARGET_RECOVERY_ROOT_OUT)/system; \
            ln -sf /system_root/system $(TARGET_RECOVERY_ROOT_OUT)/system) # Mount the system_root_image to /system_root and symlink /system.
  $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk)

注意:
1:android P后,system引入了system-as-root即把system和ramdisk打包进system镜像。ro.build.system_root_image=true说明使能该feature。
2:默认访问system的路径是/system,所以需要在系统编译时候创建/system符号链接指向/system_root/system,即使system镜像还没有挂载到/system_root,也可以创建。
3:make recoveryimage

sm8150平台,在recovery enable logcat

参考文档:
kba-170702195543_2_how_to_get_the_logcat_log_in_the_recovery_mode.pdf

前提是需要mount system。
但是recovery程序log无法输出到logcat buffer。

bootable\recovery\etc\init.rc添加如下:

service logd /system/bin/logd
    socket logd stream 0666 logd logd
    socket logdr seqpacket 0666 logd logd
    socket logdw dgram+passcred 0222 logd logd
    file /proc/kmsg r
    file /dev/kmsg w
    user logd
    group logd system package_info readproc
    writepid /dev/cpuset/system-background/tasks

   start logd
posted @ 2020-12-05 21:41  bobfly1984  阅读(355)  评论(0编辑  收藏  举报