添加 /mnt/sdcard

如果要添加 emulated sdcard ,需要一下几个内容修改:


1. patch:

diff --git a/init.rc b/init.rc
index bd6c22e..3a55e6a 100755
--- a/init.rc
+++ b/init.rc
@@ -184,11 +184,15 @@ on post-fs-data
     # create directory for DRM plug-ins
     mkdir /data/drm 0774 drm drm

+    # we will remap this as /mnt/sdcard with the sdcard fuse tool
+    mkdir /data/media 0775 media_rw media_rw
+    chown media_rw media_rw /data/media
+
     # If there is no fs-post-data action in the init.<device>.rc file, you
     # must uncomment this line, otherwise encrypted filesystems
     # won't work.
     # Set indication (checked by vold) that we have finished this action
-    #setprop vold.post_fs_data_done 1
+    setprop vold.post_fs_data_done 1

     chown system system /sys/class/android_usb/android0/f_mass_storage/lun/file
     chmod 0660 /sys/class/android_usb/android0/f_mass_storage/lun/file
@@ -509,3 +513,9 @@ service iprenew_eth0 /system/bin/dhcpcd -n
     disabled
     oneshot

+# create virtual SD card at /mnt/sdcard, based on the /data/media directory
+# daemon will drop to user/group system/media_rw after initializing
+# underlying files in /data/media will be created with user and group media_rw (1023)
+service sdcard /system/bin/sdcard /data/media 1023 1023
+    class late_start
+
diff --git a/kem.mk b/kem.mk
index bd72276..c836943 100755
--- a/kem.mk
+++ b/kem.mk
@@ -6,6 +6,8 @@ PRODUCT_PACKAGES := \
     VisualizationWallpapers \
     librs_jni

+PRODUCT_CHARACTERISTICS := tablet,nosdcard
+
 DEVICE_PACKAGE_OVERLAYS := \
     device/stm/kem/overlay

diff --git a/overlay/frameworks/base/core/res/res/xml/storage_list.xml b/overlay/frameworks/base/core/res/res/xml/storage_list.xml
new file mode 100644
index 0000000..043530d
--- /dev/null
+++ b/overlay/frameworks/base/core/res/res/xml/storage_list.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+**
+** Copyright 2011, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License")
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+
+<!-- The <device> element should contain one or more <storage> elements.
+     Exactly one of these should have the attribute primary="true".
+     This storage will be the primary external storage and should have path="/mnt/sdcard".
+     Each storage should have both a path and description attribute set.
+     The following boolean attributes are optional:
+
+        primary:    this storage is the primary external storage
+        removable:  this is removable storage (for example, a real SD card)
+        emulated:   the storage is emulated via the FUSE sdcard daemon
+        mtp-reserve: number of megabytes of storage MTP should reserve for free storage
+                     (used for emulated storage that is shared with system's data partition)
+
+      A storage should not have both emulated and removable set to true
+-->
+
+<StorageList xmlns:android="http://schemas.android.com/apk/res/android">
+    <storage android:mountPoint="/mnt/sdcard"
+             android:storageDescription="@string/storage_internal"
+             android:primary="true"
+             android:emulated="true"
+             android:mtpReserve="100" />
+</StorageList>

2. kernel config

需要 CONFIG_FUSE_FS=y

3. 添加 external/exfat/*

这些加了以后,就可以用 df 或 mount


查看有没有 /mnt/sdcard.

有就是成功了。








  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值