Detect 2SI after system_root mount on legacy SAR

This commit is contained in:
topjohnwu
2020-12-04 03:06:21 -08:00
parent dead74801d
commit ff0a76606e
4 changed files with 23 additions and 35 deletions

View File

@ -338,23 +338,22 @@ mount_root:
}
void SARInit::early_mount() {
// Make dev writable
xmkdir("/dev", 0755);
xmount("tmpfs", "/dev", "tmpfs", 0, "mode=755");
mount_list.emplace_back("/dev");
backup_files();
mount_system_root();
switch_root("/system_root");
mount_with_dt();
}
void SARFirstStageInit::early_mount() {
backup_files();
mount_system_root();
switch_root("/system_root");
{
auto init = raw_data::mmap_ro("/init");
is_two_stage = init.contains("selinux_setup");
}
if (!is_two_stage) {
// Make dev writable
xmkdir("/dev", 0755);
xmount("tmpfs", "/dev", "tmpfs", 0, "mode=755");
mount_list.emplace_back("/dev");
mount_with_dt();
}
}
void SecondStageInit::early_mount() {