当前位置: 代码迷 >> 综合 >> Android9.0(MT8168)1.修改sdcard写权限 2.init.rc中创建软链接
  详细解决方案

Android9.0(MT8168)1.修改sdcard写权限 2.init.rc中创建软链接

热度:26   发布时间:2024-01-29 07:54:28

1.修改sdcard写权限

2.init.rc中创建软链接

diff --git a/system/core/rootdir/init.rc b/system/core/rootdir/init.rc
index 6c2e301..251a68b 100755
--- a/system/core/rootdir/init.rc
+++ b/system/core/rootdir/init.rc
@@ -61,6 +61,11 @@ on initmkdir /dev/stune/backgroundmkdir /dev/stune/top-appmkdir /dev/stune/rt
+    mkdir /dev/block/platform 0777 root root
+    mkdir /dev/block/platform/mtk-msdc.0 0777 root root
+    mkdir /dev/block/platform/mtk-msdc.0/11230000.MSDC0 0777 root root 
+    symlink /dev/block/by-name /dev/block/platform/mtk-msdc.0/11230000.MSDC0/by-name
+chown system system /dev/stunechown system system /dev/stune/foregroundchown system system /dev/stune/background
@@ -87,7 +92,7 @@ on initmkdir /mnt/secure/asec 0700 root rootmkdir /mnt/asec 0755 root systemmkdir /mnt/obb 0755 root system
-    mkdir /mnt/media_rw 0750 root media_rw
+    mkdir /mnt/media_rw 0777 root media_rwmkdir /mnt/user 0755 root rootmkdir /mnt/user/0 0755 root rootmkdir /mnt/expand 0771 system system
diff --git a/system/vold/model/PublicVolume.cpp b/system/vold/model/PublicVolume.cpp
index fc7e96f..8551ed1 100644
--- a/system/vold/model/PublicVolume.cpp
+++ b/system/vold/model/PublicVolume.cpp
@@ -136,13 +136,13 @@ status_t PublicVolume::doMount() {}if (mFsType == "vfat") {
-        if (vfat::Mount(mDevPath, mRawPath, false, false, false, AID_MEDIA_RW, AID_MEDIA_RW, 0007,
+        if (vfat::Mount(mDevPath, mRawPath, false, false, false, AID_MEDIA_RW, AID_MEDIA_RW, 0000,true)) {PLOG(ERROR) << getId() << " failed to mount " << mDevPath;return -EIO;}} else if (mFsType == "exfat") {
-        if (exfat::Mount(mDevPath, mRawPath, AID_MEDIA_RW, AID_MEDIA_RW, 0007)) {
+        if (exfat::Mount(mDevPath, mRawPath, AID_MEDIA_RW, AID_MEDIA_RW, 0000)) {PLOG(ERROR) << getId() << " failed to mount " << mDevPath;return -EIO;}
@@ -183,6 +183,7 @@ status_t PublicVolume::doMount() {"-u", "1023", // AID_MEDIA_RW"-g", "1023", // AID_MEDIA_RW"-U", std::to_string(getMountUserId()).c_str(),
+                    "-w",mRawPath.c_str(),stableName.c_str(),NULL)) {

 

  相关解决方案