Skip to content

Commit

Permalink
Force remove AVB for 2SI since it may bootloop some devices
Browse files Browse the repository at this point in the history
  • Loading branch information
topjohnwu committed May 5, 2020
1 parent 85755e3 commit 87de0e7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion native/jni/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ LOCAL_SRC_FILES := \
magiskpolicy/rules.cpp \
magiskpolicy/policydb.cpp \
magiskpolicy/statement.cpp \
magiskpolicy/sepolicy.c
magiskpolicy/sepolicy.c \
magiskboot/pattern.cpp

LOCAL_LDFLAGS := -static
include $(BUILD_EXECUTABLE)
Expand Down
7 changes: 7 additions & 0 deletions native/jni/init/twostage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ entry.val = &line[val##0];

#define FSR "/first_stage_ramdisk"

extern uint32_t patch_verity(void *buf, uint32_t size);

void FirstStageInit::prepare() {
if (cmd->force_normal_boot) {
xmkdirs(FSR "/system/bin", 0755);
Expand Down Expand Up @@ -124,6 +126,11 @@ void FirstStageInit::prepare() {
// Redirect system mnt_point so init won't switch root in first stage init
if (entry.mnt_point == "/system")
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());
}
}
Expand Down

0 comments on commit 87de0e7

Please sign in to comment.