以芯片XXXX为例,版本为3.2release(包括3.2.1release、3.2.2release),适配方法如下步骤。

1. 移植内核

此部分跟随内核移植,系统上无需做额外适配。

2. 查询mmcblk1p1位置

此处必须插入TF卡,如下命令查询,可以看出mmcblk1在./soc/soc:ap-ahb/22210000.sdio目录下

# cd sys/devices/platform/

# find ./ | grep mmcblk1p1
./soc/soc:ap-ahb/22210000.sdio/mmc_host/mmc1/mmc1:0001/block/mmcblk1/mmcblk1p1
./soc/soc:ap-ahb/22210000.sdio/mmc_host/mmc1/mmc1:0001/block/mmcblk1/mmcblk1p1/uevent
./soc/soc:ap-ahb/22210000.sdio/mmc_host/mmc1/mmc1:0001/block/mmcblk1/mmcblk1p1/alignment_offset
./soc/soc:ap-ahb/22210000.sdio/mmc_host/mmc1/mmc1:0001/block/mmcblk1/mmcblk1p1/power
./soc/soc:ap-ahb/22210000.sdio/mmc_host/mmc1/mmc1:0001/block/mmcblk1/mmcblk1p1/power/runtime_active_time
./soc/soc:ap-ahb/22210000.sdio/mmc_host/mmc1/mmc1:0001/block/mmcblk1/mmcblk1p1/power/runtime_status
./soc/soc:ap-ahb/22210000.sdio/mmc_host/mmc1/mmc1:0001/block/mmcblk1/mmcblk1p1/power/autosuspend_delay_ms
./soc/soc:ap-ahb/22210000.sdio/mmc_host/mmc1/mmc1:0001/block/mmcblk1/mmcblk1p1/power/runtime_suspended_time
./soc/soc:ap-ahb/22210000.sdio/mmc_host/mmc1/mmc1:0001/block/mmcblk1/mmcblk1p1/power/control
./soc/soc:ap-ahb/22210000.sdio/mmc_host/mmc1/mmc1:0001/block/mmcblk1/mmcblk1p1/dev
./soc/soc:ap-ahb/22210000.sdio/mmc_host/mmc1/mmc1:0001/block/mmcblk1/mmcblk1p1/holders
./soc/soc:ap-ahb/22210000.sdio/mmc_host/mmc1/mmc1:0001/block/mmcblk1/mmcblk1p1/ro
./soc/soc:ap-ahb/22210000.sdio/mmc_host/mmc1/mmc1:0001/block/mmcblk1/mmcblk1p1/stat
./soc/soc:ap-ahb/22210000.sdio/mmc_host/mmc1/mmc1:0001/block/mmcblk1/mmcblk1p1/size
./soc/soc:ap-ahb/22210000.sdio/mmc_host/mmc1/mmc1:0001/block/mmcblk1/mmcblk1p1/discard_alignment
./soc/soc:ap-ahb/22210000.sdio/mmc_host/mmc1/mmc1:0001/block/mmcblk1/mmcblk1p1/subsystem
./soc/soc:ap-ahb/22210000.sdio/mmc_host/mmc1/mmc1:0001/block/mmcblk1/mmcblk1p1/partition
./soc/soc:ap-ahb/22210000.sdio/mmc_host/mmc1/mmc1:0001/block/mmcblk1/mmcblk1p1/inflight
./soc/soc:ap-ahb/22210000.sdio/mmc_host/mmc1/mmc1:0001/block/mmcblk1/mmcblk1p1/start

关于SD卡和TF卡挂载在Linux中挂载在mmcblk1的知识可以参考:https://blog.csdn.net/jackone12347/article/details/117122506

3. 添加config文件

在foundation\filemanagement\storage_service\services\storage_daemon\config.txt目录下增加

sysPattern /devices/platform/soc/soc:ap-ahb/22210000.sdio/* label disk flag 0

4. 查看自动挂载情况

cd mnt/external
​
# ls -l
total 32
drwxrwx--- 2 file_manager file_manager 32768 1970-01-01 08:00 0403-0201

或者可以通过df -h查看

# df -h
Filesystem                              Size  Used Avail Use% Mounted on
tmpfs                                   1.6G  224K  1.6G   1% /dev
tmpfs                                   1.6G     0  1.6G   0% /mnt
tmpfs                                   1.6G     0  1.6G   0% /storage
/dev/block/mmcblk0p46                   1.4G  972M  536M  65% /
/dev/block/mmcblk0p47                   240M  139M  100M  59% /vendor
/data/service/el2/100/hmdfs/account     110G  2.9G  107G   3% /mnt/hmdfs/100/account
/data/service/el2/100/hmdfs/non_account 110G  2.9G  107G   3% /mnt/hmdfs/100/non_account
/data/service/el2/100/share             110G  2.9G  107G   3% /mnt/share/100
/dev/block/vol-179-25                    29G   32K   29G   1% /mnt/external/0403-0201

注意:SD卡、U盘的自动挂载方法类似;

 

知识扩展:

关于openharmony自动挂载的流程可以参考Gitee上的链接:https://gitee.com/openharmony/docs/blob/OpenHarmony-3.2-Release/zh-cn/application-dev/file-management/manage-external-storage.md

Logo

社区规范:仅讨论OpenHarmony相关问题。

更多推荐