From de00f1d5a94b83ad7bf49b0bdffab310e58db471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=8B=E9=A1=B5?= Date: Wed, 30 Aug 2023 10:54:42 +0800 Subject: [PATCH] Always check mounts to detect legacy SAR on bootmode --- scripts/util_functions.sh | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/scripts/util_functions.sh b/scripts/util_functions.sh index 8ace83b75..cfb79b8b2 100644 --- a/scripts/util_functions.sh +++ b/scripts/util_functions.sh @@ -335,17 +335,21 @@ get_flags() { PATCHVBMETAFLAG=true ui_print "- No vbmeta partition, patch vbmeta in boot image" fi - local IS_DYNAMIC=false - if grep -q 'androidboot.super_partition' /proc/cmdline; then - IS_DYNAMIC=true - elif [ -n "$(find_block super)" ]; then - IS_DYNAMIC=true - fi - if $SYSTEM_AS_ROOT && ! $IS_DYNAMIC; then - LEGACYSAR=true - ui_print "- Legacy SAR, force kernel to load rootfs" + LEGACYSAR=false + if $BOOTMODE; then + grep ' / ' /proc/mounts | grep -q '/dev/root' && LEGACYSAR=true else - LEGACYSAR=false + # Recovery mode, assume devices that don't use dynamic partitions are legacy SAR + local IS_DYNAMIC=false + if grep -q 'androidboot.super_partition' /proc/cmdline; then + IS_DYNAMIC=true + elif [ -n "$(find_block super)" ]; then + IS_DYNAMIC=true + fi + if $SYSTEM_AS_ROOT && ! $IS_DYNAMIC; then + LEGACYSAR=true + ui_print "- Legacy SAR, force kernel to load rootfs" + fi fi # Overridable config flags with safe defaults