From 3ae73447476f293d7cfc85da79fc5006e55c72c0 Mon Sep 17 00:00:00 2001 From: LoveSy Date: Wed, 22 Jun 2022 19:05:50 +0800 Subject: [PATCH] Create `/dev` on stub cpio --- native/jni/init/mount.cpp | 5 ++++- native/jni/init/twostage.cpp | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/native/jni/init/mount.cpp b/native/jni/init/mount.cpp index 953b0f28e..cd86b930d 100644 --- a/native/jni/init/mount.cpp +++ b/native/jni/init/mount.cpp @@ -209,6 +209,10 @@ bool LegacySARInit::mount_system_root() { backup_files(); LOGD("Mounting system_root\n"); + + // there's no /dev in stub cpio + xmkdir("/dev", 0777); + strcpy(blk_info.block_dev, "/dev/root"); do { @@ -250,7 +254,6 @@ mount_root: switch_root("/system_root"); // Make dev writable - xmkdir("/dev", 0755); xmount("tmpfs", "/dev", "tmpfs", 0, "mode=755"); mount_list.emplace_back("/dev"); diff --git a/native/jni/init/twostage.cpp b/native/jni/init/twostage.cpp index b91f97259..5f7de268b 100644 --- a/native/jni/init/twostage.cpp +++ b/native/jni/init/twostage.cpp @@ -39,6 +39,7 @@ void FirstStageInit::prepare() { } void LegacySARInit::first_stage_prep() { + xmkdir("/data", 0755); xmount("tmpfs", "/data", "tmpfs", 0, "mode=755"); // Patch init binary