Android6.0支持exfat格式内存卡.
1、kenel;
2、external\e2fsprogs\lib\blkid
3、system\vold
1、kernel部分移植的是github上的。链接:https://github.com/dorimanx/exfat-nofuse
2、
external\e2fsprogs\lib\blkid修改内容如下:
diff --git a/lib/blkid/Android.mk b/lib/blkid/Android.mk
index 2fe8f42..9710cf6 100755
--- a/lib/blkid/Android.mk
+++ b/lib/blkid/Android.mk
@@ -8,6 +8,7 @@ libext2_blkid_src_files := \
getsize.c \
llseek.c \
probe.c \
+ probe_exfat.c \
read.c \
resolve.c \
save.c \
@@ -18,7 +19,8 @@ libext2_blkid_src_files := \
libext2_blkid_shared_libraries := libext2_uuid
libext2_blkid_system_shared_libraries := libc
-
+libext2_blkid_static_libraries := libext2_uuid_static
+libext2_blkid_system_static_libraries := libc
libext2_blkid_c_includes := external/e2fsprogs/lib
libext2_blkid_cflags := -O2 -g -W -Wall -fno-strict-aliasing \
@@ -63,14 +65,12 @@ include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
-LOCAL_STATIC_LIBRARIES := \
- $(libext2_blkid_system_shared_libraries) \
- $(libext2_blkid_shared_libraries)
+
LOCAL_SRC_FILES := $(libext2_blkid_src_files)
+LOCAL_STATIC_LIBRARIES := $(libext2_blkid_static_libraries) $(libext2_blkid_system_static_libraries)
LOCAL_C_INCLUDES := $(libext2_blkid_c_includes)
LOCAL_CFLAGS := $(libext2_blkid_cflags) $(libext2_blkid_cflags_linux) -fno-strict-aliasing
-LOCAL_PRELINK_MODULE := true
LOCAL_MODULE := libext2_blkid
LOCAL_MODULE_TAGS := optional
diff --git a/lib/blkid/probe.c b/lib/blkid/probe.c
old mode 100644
new mode 100755
index 8215768..0617cf1
--- a/lib/blkid/probe.c
+++ b/lib/blkid/probe.c
@@ -36,6 +36,11 @@
#include "uuid/uuid.h"
#include "probe.h"
+extern int probe_exfat(struct blkid_probe *probe,
+ struct blkid_magic *id __BLKID_ATTR((unused)),
+ unsigned char *buf);
+
+
static int figure_label_len(const unsigned char *label, int len)
{
const unsigned char *end = label + len - 1;
@@ -84,7 +89,11 @@ static unsigned char *get_buffer(struct blkid_probe *pr,
return pr->buf;
}
}
-
+unsigned char *blkid_probe_get_buffer(struct blkid_probe *pr,
+ blkid_loff_t off, size_t len)
+{
+ return get_buffer(pr, off, len);
+}
/*
* This is a special case code to check for an MDRAID device. We do
@@ -766,14 +775,41 @@ static int probe_ntfs(struct blkid_probe *probe,
if (attr_type == MFT_RECORD_ATTR_VOLUME_NAME) {
if (val_len > sizeof(label_str))
val_len = sizeof(label_str)-1;
-
+/* $_rbox_$_modify_$_huangyonglin: added for mass storage mounting 2012-03-31 */
+#if 0
for (i=0, cp=label_str; i < val_len; i+=2,cp++) {
val = ((__u8 *) attr) + val_off + i;
*cp = val[0];
if (val[1])
*cp = '?';
}
- *cp = 0;
+#else
+ for (i=0, cp=label_str; i < val_len;i+=2,cp++) {
+ __u16 *pval = ((__u8 *) attr) + val_off + i;
+ __u16 val_temp= *pval;
+ if (val_temp >= 0x00 && val_temp <= 0x7f)
+ {
+ val = ((__u8 *) attr) + val_off + i;
+ *cp =val[0];
+ }
+ else if (val_temp >= 0x0080 && val_temp <= 0x07ff)
+ {
+ *cp =((val_temp >> 6) & 0x1F) | 0xC0;
+ cp++;
+ *cp =(val_temp & 0x3F) | 0x80; ;
+ }
+ else if (val_temp >= 0x0800 && val_temp <= 0xffff)
+ {
+ *cp = ((val_temp >> 12) & 0x0F) | 0xE0; //0xe0 | (val_temp >> 12);
+ cp++;
+ *cp = ((val_temp >> 6) & 0x3F) | 0x80; //0x80 | (val_temp >> 6 & 0x00ff);
+ cp++;
+ *cp = (val_temp & 0x3F) | 0x80;//0x80 | (val_temp & (0xff >> 2));
+ }
+ }
+ *cp =0;
+#endif
+/*$_rbox_$_modify_$_end*/
}
}
@@ -1428,6 +1464,7 @@ static struct blkid_magic type_array[] = {
{ "vfat", 0, 0, 1, "\353", probe_fat_nomagic },
{ "vfat", 0, 0, 1, "\351", probe_fat_nomagic },
{ "vfat", 0, 0x1fe, 2, "\125\252", probe_fat_nomagic },
+ { "exfat", 0, 3, 8, "EXFAT ", probe_exfat },
{ "minix", 1, 0x10, 2, "\177\023", 0 },
{ "minix", 1, 0x10, 2, "\217\023", 0 },
{ "minix", 1, 0x10, 2, "\150\044", 0 },
3、vold修改如下:
添加Exfat.cpp和Exfat.h,这个应该系统里面默认有的。
修改完三个部分,烧录kernel,放入libext2_blkid.so和vold就可以了。
附录整个补丁文件:https://download.csdn.net/download/arunboy/12354240
参考文档:https://blog.csdn.net/huolinliang/article/details/86589976