当前位置:   article > 正文

高通 Android 8/9/12/13 兼容U盘识别extfat模式_android8.0怎么支持exfat格式u盘识别

android8.0怎么支持exfat格式u盘识别

Android本身不支持extfat格式 需要通过nofuse 打kernel补丁方式去实现 

Android 8/9

1、kernel/msm-4.9/arch/arm64/configs/sdm670-perf_defconfig 增加代码如下(需要提交编译kernel记得git add sdm670-perf_defconfig 不需要commit哈!否则编译会还原这个文件,切记!)

  1. --- a/LINUX/android/kernel/msm-4.9/arch/arm64/configs/sdm670-perf_defconfig
  2. +++ b/LINUX/android/kernel/msm-4.9/arch/arm64/configs/sdm670-perf_defconfig
  3. @@ -314,6 +314,7 @@ CONFIG_INPUT_UINPUT=y
  4. # CONFIG_DEVMEM is not set
  5. # CONFIG_DEVKMEM is not set
  6. CONFIG_SERIAL_MSM_GENI=y
  7. +CONFIG_SERIAL_MSM_GENI_CONSOLE=y
  8. CONFIG_DIAG_CHAR=y
  9. CONFIG_HW_RANDOM=y
  10. CONFIG_HW_RANDOM_MSM_LEGACY=y
  11. @@ -602,6 +603,9 @@ CONFIG_QFMT_V2=y
  12. CONFIG_FUSE_FS=y
  13. CONFIG_MSDOS_FS=y
  14. CONFIG_VFAT_FS=y
  15. +CONFIG_EXFAT_FS=y
  16. +CONFIG_EXFAT_DEFAULT_CODEPAGE=437
  17. +CONFIG_EXFAT_DEFAULT_IOCHARSET="utf8"
  18. CONFIG_TMPFS_POSIX_ACL=y
  19. CONFIG_ECRYPT_FS=y
  20. CONFIG_ECRYPT_FS_MESSAGING=y

2、kernel/msm-4.9/arch/arm64/configs/sdm670_defconfig中增加如下代码

  1. diff --git a/kernel/msm-4.9/arch/arm64/configs/sdm670_defconfig b/kernel/msm-4.9/arch/arm64/configs/sdm670_defconfig
  2. index 934e100174..f2302ecd52 100644
  3. --- a/kernel/msm-4.9/arch/arm64/configs/sdm670_defconfig
  4. +++ b/kernel/msm-4.9/arch/arm64/configs/sdm670_defconfig
  5. @@ -603,6 +603,9 @@ CONFIG_QFMT_V2=y
  6. CONFIG_FUSE_FS=y
  7. CONFIG_MSDOS_FS=y
  8. CONFIG_VFAT_FS=y
  9. +CONFIG_EXFAT_FS=y
  10. +CONFIG_EXFAT_DEFAULT_CODEPAGE=437
  11. +CONFIG_EXFAT_DEFAULT_IOCHARSET="utf8"
  12. CONFIG_TMPFS_POSIX_ACL=y
  13. CONFIG_ECRYPT_FS=y
  14. CONFIG_ECRYPT_FS_MESSAGING=y

Android 12/13 

3、kernel/msm-4.19/arch/arm64/configs/vendor/device-perf_defconfig 增加(需要提交编译kernel记得git add device-perf_defconfig 不需要commit哈! 否则编译会还原这个文件,切记!)

  1. diff --git a/kernel/msm-4.19/arch/arm64/configs/vendor/device-perf_defconfig b/kernel/msm-4.19/arch/arm64/configs/vendor/device-perf_defconfig
  2. index a072c626fe7..b150b127880 100644
  3. --- a/kernel/msm-4.19/arch/arm64/configs/vendor/device-perf_defconfig
  4. +++ b/kernel/msm-4.19/arch/arm64/configs/vendor/device-perf_defconfig
  5. @@ -28,6 +28,9 @@ CONFIG_CGROUP_CPUACCT=y
  6. CONFIG_CGROUP_BPF=y
  7. CONFIG_SCHED_CORE_CTL=y
  8. CONFIG_NAMESPACES=y
  9. +CONFIG_EXFAT_FS=y
  10. +CONFIG_NTFS_FS=y
  11. +CONFIG_NTFS_RW=y
  12. # CONFIG_PID_NS is not set
  13. CONFIG_SCHED_AUTOGROUP=y
  14. CONFIG_SCHED_TUNE=y

4、kernel/msm-4.19/arch/arm64/configs/vendor/device_defconfig中增加

  1. diff --git a/kernel/msm-4.19/arch/arm64/configs/vendor/bengal_defconfig b/kernel/msm-4.19/arch/arm64/configs/vendor/bengal_defconfig
  2. index 4bb8f0343e6..5e66d553d36 100644
  3. --- a/kernel/msm-4.19/arch/arm64/configs/vendor/bengal_defconfig
  4. +++ b/kernel/msm-4.19/arch/arm64/configs/vendor/bengal_defconfig
  5. @@ -29,6 +29,10 @@ CONFIG_CGROUP_BPF=y
  6. CONFIG_CGROUP_DEBUG=y
  7. CONFIG_SCHED_CORE_CTL=y
  8. CONFIG_NAMESPACES=y
  9. +CONFIG_EXFAT_FS=y
  10. +CONFIG_NTFS_FS=y
  11. +CONFIG_NTFS_RW=y
  12. +
  13. # CONFIG_PID_NS is not set
  14. CONFIG_SCHED_AUTOGROUP=y
  15. CONFIG_SCHED_TUNE=y

5、kernel/msm-4.19/fs/Kconfig b/kernel/msm-4.19/fs/Kconfig 增加+source "fs/exfat/Kconfig"

  1. diff --git a/kernel/msm-4.19/fs/Kconfig b/kernel/msm-4.19/fs/Kconfig
  2. index b8d003f02b7..947e731b316 100644
  3. --- a/kernel/msm-4.19/fs/Kconfig
  4. +++ b/kernel/msm-4.19/fs/Kconfig
  5. @@ -137,6 +137,8 @@ menu "DOS/FAT/NT Filesystems"
  6. source "fs/fat/Kconfig"
  7. source "fs/ntfs/Kconfig"
  8. +source "fs/exfat/Kconfig"
  9. +

6、kernel/msm-4.19/fs/Makefile b/kernel/msm-4.19/fs/Makefile 中增加+obj-$(CONFIG_EXFAT_FS)      += exfat/

  1. diff --git a/kernel/msm-4.19/fs/Makefile b/kernel/msm-4.19/fs/Makefile
  2. index 9d1caea038f..56aca48a51d 100644
  3. --- a/kernel/msm-4.19/fs/Makefile
  4. +++ b/kernel/msm-4.19/fs/Makefile
  5. @@ -80,6 +80,7 @@ obj-$(CONFIG_HUGETLBFS)               += hugetlbfs/
  6. obj-$(CONFIG_CODA_FS)          += coda/
  7. obj-$(CONFIG_MINIX_FS)         += minix/
  8. obj-$(CONFIG_FAT_FS)           += fat/
  9. +obj-$(CONFIG_EXFAT_FS)      += exfat/
  10. obj-$(CONFIG_BFS_FS)           += bfs/
  11. obj-$(CONFIG_ISO9660_FS)       += isofs/
  12. obj-$(CONFIG_HFSPLUS_FS)       += hfsplus/ # Before hfs to find wrapped HFS+
  13. diff --git a/kernel/msm-4.19/fs/exfat/.gitignore b/kernel/msm-4.19/fs/exfat/.gitignore
  14. new file mode 100644
  15. index 00000000000..241505f47ee
  16. --- /dev/null

7、

+++ b/kernel/msm-4.19/fs/exfat/.gitignore

  1. kernel/msm-4.19/fs/exfat/.gitignore                             |    7 +
  2. kernel/msm-4.19/fs/exfat/Kconfig                                |   39 +
  3. kernel/msm-4.19/fs/exfat/LICENSE                                |  339 ++++++++
  4. kernel/msm-4.19/fs/exfat/Makefile                               |   56 ++
  5. kernel/msm-4.19/fs/exfat/README.md                              |   98 +++
  6. kernel/msm-4.19/fs/exfat/dkms.conf                              |    7 +
  7. kernel/msm-4.19/fs/exfat/exfat-km.mk                            |   11 +
  8. kernel/msm-4.19/fs/exfat/exfat_api.c                            |  528 ++++++++++++
  9. kernel/msm-4.19/fs/exfat/exfat_api.h                            |  206 +++++
  10. kernel/msm-4.19/fs/exfat/exfat_bitmap.c                         |   63 ++
  11. kernel/msm-4.19/fs/exfat/exfat_bitmap.h                         |   55 ++
  12. kernel/msm-4.19/fs/exfat/exfat_blkdev.c                         |  197 +++++
  13. kernel/msm-4.19/fs/exfat/exfat_blkdev.h                         |   73 ++
  14. kernel/msm-4.19/fs/exfat/exfat_cache.c                          |  784 +++++++++++++++++
  15. kernel/msm-4.19/fs/exfat/exfat_cache.h                          |   85 ++
  16. kernel/msm-4.19/fs/exfat/exfat_config.h                         |   69 ++
  17. kernel/msm-4.19/fs/exfat/exfat_core.c                           | 5138 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  18. kernel/msm-4.19/fs/exfat/exfat_core.h                           |  671 +++++++++++++++
  19. kernel/msm-4.19/fs/exfat/exfat_data.c                           |   77 ++
  20. kernel/msm-4.19/fs/exfat/exfat_data.h                           |   58 ++
  21. kernel/msm-4.19/fs/exfat/exfat_nls.c                            |  448 ++++++++++
  22. kernel/msm-4.19/fs/exfat/exfat_nls.h                            |   91 ++
  23. kernel/msm-4.19/fs/exfat/exfat_oal.c                            |  196 +++++
  24. kernel/msm-4.19/fs/exfat/exfat_oal.h                            |   74 ++
  25. kernel/msm-4.19/fs/exfat/exfat_super.c                          | 2711 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  26. kernel/msm-4.19/fs/exfat/exfat_super.h                          |  171 ++++
  27. kernel/msm-4.19/fs/exfat/exfat_upcase.c                         |  405 +++++++++
  28. kernel/msm-4.19/fs/exfat/exfat_version.h                        |   19 +

8、添加好之后记得将device-perf_defconfig文件git add  平台(rk/全志/展锐/高通)/kernel/msm-4.19/arch/arm64/configs/vendor/device_defconfig 否则编译的时候会恢复到原来没修改状态 会导致无法在out/target/product/bengal/obj/kernel/msm-4.19/fs/exfat 生成对应.o文件 切记

9、执行编译就ok 编译成功之后在 window 下面 adb shell cat /proc/filesystems ,如果列表出现exfat格式说明当前设备已经支持exfat格式 如下图所示

10、到这里基本结束了,其他平台具体以实际平台情况为主,有问题可以评论区或者讨论哈!转载请注明出处 谢谢!有学习framework大佬们可以一起交流 加我WeChat   一起学习 一起进步 kdanmobile 

感谢:Android 9.0 支持NTFS和Exfat 格式U盘开发_android ntfs_Mrsongs的心情杂货铺的博客-CSDN博客

转载请注明出处 谢谢 高通 Android 13 兼容extfat模式_KdanMin的博客-CSDN博客

其他源码补丁源码下载 mirrors / dorimanx / exfat-nofuse · GitCode

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/334478
推荐阅读
相关标签
  

闽ICP备14008679号