Force remove AVB for 2SI since it may bootloop some devices

This commit is contained in:
topjohnwu 2020-05-05 01:39:19 -07:00
parent 85755e3022
commit 87de0e7a0e
2 changed files with 9 additions and 1 deletions

View File

@ -68,7 +68,8 @@ LOCAL_SRC_FILES := \
magiskpolicy/rules.cpp \ magiskpolicy/rules.cpp \
magiskpolicy/policydb.cpp \ magiskpolicy/policydb.cpp \
magiskpolicy/statement.cpp \ magiskpolicy/statement.cpp \
magiskpolicy/sepolicy.c magiskpolicy/sepolicy.c \
magiskboot/pattern.cpp
LOCAL_LDFLAGS := -static LOCAL_LDFLAGS := -static
include $(BUILD_EXECUTABLE) include $(BUILD_EXECUTABLE)

View File

@ -18,6 +18,8 @@ entry.val = &line[val##0];
#define FSR "/first_stage_ramdisk" #define FSR "/first_stage_ramdisk"
extern uint32_t patch_verity(void *buf, uint32_t size);
void FirstStageInit::prepare() { void FirstStageInit::prepare() {
if (cmd->force_normal_boot) { if (cmd->force_normal_boot) {
xmkdirs(FSR "/system/bin", 0755); xmkdirs(FSR "/system/bin", 0755);
@ -124,6 +126,11 @@ void FirstStageInit::prepare() {
// Redirect system mnt_point so init won't switch root in first stage init // Redirect system mnt_point so init won't switch root in first stage init
if (entry.mnt_point == "/system") if (entry.mnt_point == "/system")
entry.mnt_point = "/system_root"; entry.mnt_point = "/system_root";
// Force remove AVB for 2SI since it may bootloop some devices
auto len = patch_verity(entry.fsmgr_flags.data(), entry.fsmgr_flags.length());
entry.fsmgr_flags.resize(len);
entry.to_file(fp.get()); entry.to_file(fp.get());
} }
} }