Android(安卓)emulated sdcard
16lz
2021-01-24
如果要添加 emulated sdcard ,需要一下几个内容修改:
1. patch:
- diff--gita/init.rcb/init.rc
- indexbd6c22e..3a55e6a100755
- ---a/init.rc
- +++b/init.rc
- @@-184,11+184,15@@onpost-fs-data
- #createdirectoryforDRMplug-ins
- mkdir/data/drm0774drmdrm
- +#wewillremapthisas/mnt/sdcardwiththesdcardfusetool
- +mkdir/data/media0775media_rwmedia_rw
- +chownmedia_rwmedia_rw/data/media
- +
- #Ifthereisnofs-post-dataactionintheinit.<device>.rcfile,you
- #mustuncommentthisline,otherwiseencryptedfilesystems
- #won'twork.
- #Setindication(checkedbyvold)thatwehavefinishedthisaction
- -#setpropvold.post_fs_data_done1
- +setpropvold.post_fs_data_done1
- chownsystemsystem/sys/class/android_usb/android0/f_mass_storage/lun/file
- chmod0660/sys/class/android_usb/android0/f_mass_storage/lun/file
- @@-509,3+513,9@@serviceiprenew_eth0/system/bin/dhcpcd-n
- disabled
- oneshot
- +#createvirtualSDcardat/mnt/sdcard,basedonthe/data/mediadirectory
- +#daemonwilldroptouser/groupsystem/media_rwafterinitializing
- +#underlyingfilesin/data/mediawillbecreatedwithuserandgroupmedia_rw(1023)
- +#servicesdcard/system/bin/sdcard/data/media10231023
- +service sdcard /system/bin/sdcard /data/media /mnt/shell/emulated 1023 1023
- +classlate_start
- +
- diff--gita/device.mkb/device.mk
- indexbd72276..c836943100755
- ---a/device.mk
- +++b/device.mk
- @@-6,6+6,8@@PRODUCT_PACKAGES:=\
- VisualizationWallpapers\
- librs_jni
- +PRODUCT_CHARACTERISTICS += nosdcard
- +
- DEVICE_PACKAGE_OVERLAYS:=\
- device/stm/kem/overlay
- diff--gita/overlay/frameworks/base/core/res/res/xml/storage_list.xmlb/overlay/frameworks/base/core/res/res/xml/storage_list.xml
- newfilemode100644
- index0000000..043530d
- ---/dev/null
- +++b/overlay/frameworks/base/core/res/res/xml/storage_list.xml
- @@-0,0+1,41@@
- +<?xmlversion="1.0"encoding="utf-8"?>
- +<!--
- +**
- +**Copyright2011,TheAndroidOpenSourceProject
- +**
- +**LicensedundertheApacheLicense,Version2.0(the"License")
- +**youmaynotusethisfileexceptincompliancewiththeLicense.
- +**YoumayobtainacopyoftheLicenseat
- +**
- +**http://www.apache.org/licenses/LICENSE-2.0
- +**
- +**Unlessrequiredbyapplicablelaworagreedtoinwriting,software
- +**distributedundertheLicenseisdistributedonan"ASIS"BASIS,
- +**WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied.
- +**SeetheLicenseforthespecificlanguagegoverningpermissionsand
- +**limitationsundertheLicense.
- +*/
- +-->
- +
- +<!--The<device>elementshouldcontainoneormore<storage>elements.
- +Exactlyoneoftheseshouldhavetheattributeprimary="true".
- +Thisstoragewillbetheprimaryexternalstorageandshouldhavepath="/mnt/sdcard".
- +Eachstorageshouldhavebothapathanddescriptionattributeset.
- +Thefollowingbooleanattributesareoptional:
- +
- +primary:thisstorageistheprimaryexternalstorage
- +removable:thisisremovablestorage(forexample,arealSDcard)
- +emulated:thestorageisemulatedviatheFUSEsdcarddaemon
- +mtp-reserve:numberofmegabytesofstorageMTPshouldreserveforfreestorage
- +(usedforemulatedstoragethatissharedwithsystem'sdatapartition)
- +
- +Astorageshouldnothavebothemulatedandremovablesettotrue
- +-->
- +
- +<StorageListxmlns:android="http://schemas.android.com/apk/res/android">
- +<storage android:storageDescription="@string/storage_internal"
- +android:emulated="true"
- +android:mtpReserve="100"/>
- +</StorageList>
2. kernel config
需要 CONFIG_FUSE_FS=y
查看有没有 /mnt/sdcard:
开机后adb shell进去后df下即可
更多相关文章
- 如何将ADT(eclipse)开发工具锁定到LaucherPad启动器上
- 转Launcher研究之AndroidManifest.xml分析(二)
- Android(安卓)studio新建activity运行出错解决方法
- Android自定义弹窗进度条
- 解决Android(安卓)Studio 无法在线更新的问题
- 创建ListView的基本步骤
- android 显示pdf文件内容
- Android:TabWidget
- Android(安卓)新建文件夹、生成文件并向文件写入文本内容