Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d7e6353a authored by Yi-Yo Chiang's avatar Yi-Yo Chiang
Browse files

first_stage_mount: Bind mount /system after switch root

This ensures /system to be a mountpoint, which allows adb-remount to
change the subtree propagation type of /system and MS_MOVE submounts
under /system.

Test: Add submount under /system and adb remount
Change-Id: Ib281be41eaf86bc3e6b7dfac893e5e27b8374da8
parent 827389c9
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -518,6 +518,12 @@ bool FirstStageMount::TrySwitchSystemAsRoot() {
        return false;
    }

    // Make /system a mountpoint so that adb-remount can move submounts under /system.
    if (access("/system", F_OK) == 0 &&
        mount("/system", "/system", nullptr, MS_BIND, nullptr) != 0) {
        PLOG(WARNING) << "Failed to bind mount /system for overlayfs";
    }

    return true;
}