From 8f73f02e43559f353436a499a6401195265b56e9 Mon Sep 17 00:00:00 2001 From: Yi-Yo Chiang Date: Wed, 23 Feb 2022 16:20:09 +0800 Subject: [PATCH] fs_mgr: Fix misleading comment text regarding __ANDROID_RECOVERY__ This piece of comment was misleading because it only applies to BOARD_USES_RECOVERY_AS_BOOT devices. Update the text to give a more accurate description. If BOARD_USES_RECOVERY_AS_BOOT is true, * Recovery ramdisk IS boot ramdisk. * init_first_stage is actually a symbolic link to init_second_stage.recovery, which links libfs_mgr.recovery. If BOARD_USES_RECOVERY_AS_BOOT is not true, * init_first_stage is a real binary in the generic ramdisk. * init_first_stage links libfs_mgr.ramdisk. * During recovery boot, the '/init' binary could be the init_first_stage from the generic ramdisk (A/B), or init_second_stage.recovery from the recovery ramdisk (non-A/B; standalone recovery partition). Bug: 219811240 Test: None Change-Id: Ib395a796f61869c13f1a5f1735ef17c224c26c8c --- fs_mgr/fs_mgr_overlayfs.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs_mgr/fs_mgr_overlayfs.cpp b/fs_mgr/fs_mgr_overlayfs.cpp index 996fa5e3a..82b5275a3 100644 --- a/fs_mgr/fs_mgr_overlayfs.cpp +++ b/fs_mgr/fs_mgr_overlayfs.cpp @@ -126,8 +126,12 @@ namespace { bool fs_mgr_in_recovery() { // Check the existence of recovery binary instead of using the compile time - // macro, because first-stage-init is compiled with __ANDROID_RECOVERY__ - // defined, albeit not in recovery. More details: system/core/init/README.md + // __ANDROID_RECOVERY__ macro. + // If BOARD_USES_RECOVERY_AS_BOOT is true, both normal and recovery boot + // mode would use the same init binary, which would mean during normal boot + // the '/init' binary is actually a symlink pointing to + // init_second_stage.recovery, which would be compiled with + // __ANDROID_RECOVERY__ defined. return fs_mgr_access("/system/bin/recovery"); }