Android Vold和SDIO冲突问题解决方法

开发板有两个MMC接口,一个挂载SD卡,另外一个挂载SDIO接口,当同时工作,启动Android时Vold会崩溃导致无法启动。
错误代码如下:
# logcat

I/vold    ( 1930): Android Volume Daemon version 2.0

E/        ( 1941): listen at 0.0.0.0:22501

I/vold    ( 1930): New MMC card 'SA02G' (serial 2619342940) added @ /devices/platform/mxsdhci.0/mmc_host/mmc0/mmc0:1234

I/vold    ( 1930): Disk (blkdev 179:0), 3854336 secs (1882 MB) 2 partitions

I/vold    ( 1930): New blkdev 179.0 on media SA02G, media path /devices/platform/mxsdhci.0/mmc_host/mmc0/mmc0:1234, Dpp 2

I/vold    ( 1930): Partition (blkdev 179:1), 2097153 secs (1024 MB) type 0x83

I/vold    ( 1930): New blkdev 179.1 on media SA02G, media path /devices/platform/mxsdhci.0/mmc_host/mmc0/mmc0:1234, Dpp 1

I/vold    ( 1930): Partition (blkdev 179:2), 1717183 secs (838 MB) type 0x83

I/vold    ( 1930): New blkdev 179.2 on media SA02G, media path /devices/platform/mxsdhci.0/mmc_host/mmc0/mmc0:1234, Dpp 0

I/vold    ( 1930): Evaluating dev '/devices/platform/mxsdhci.0/mmc_host/mmc0/mmc0:1234/block/mmcblk0' for mountable filesystems for '/sdcard'

I/vold    ( 1930): Aborting start of /sdcard (bootstrap = 1)

I/vold    ( 1930): Volmgr not ready to handle device

I/DEBUG   ( 1931): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

I/DEBUG   ( 1931): Build fingerprint: 'freescale/imx51_BBG/imx51_BBG/:2.1/ERD79/eng.root.20100527.144938:eng/test-keys'

I/DEBUG   ( 1931): pid: 1930, tid: 1930  >>> /system/bin/vold <<<

I/DEBUG   ( 1931): signal 11 (SIGSEGV), fault addr 00000000

I/DEBUG   ( 1931):  r0 00000000  r1 00020000  r2 80808080  r3 00000000

I/DEBUG   ( 1931):  r4 000121d4  r5 be97140c  r6 be9713f8  r7 be971610

I/DEBUG   ( 1931):  r8 00000000  r9 00000000  10 00000000  fp 00000000

I/DEBUG   ( 1931):  ip 00012320  sp be9713d8  lr 0000a9a5  pc afe0e7c8  cpsr 40000010

I/DEBUG   ( 1931):          #00  pc 0000e7c8  /system/lib/libc.so

I/DEBUG   ( 1931):          #01  pc 0000a9a2  /system/bin/vold

I/DEBUG   ( 1931):          #02  pc 0000ab48  /system/bin/vold

I/DEBUG   ( 1931):          #03  pc 0000ac26  /system/bin/vold

I/DEBUG   ( 1931):          #04  pc 00009844  /system/bin/vold

I/DEBUG   ( 1931):          #05  pc 0000c2c6  /system/lib/libc.so

I/DEBUG   ( 1931):          #06  pc b00018aa  /system/bin/linker

I/DEBUG   ( 1931): 

I/DEBUG   ( 1931): code around pc:

I/DEBUG   ( 1931): afe0e7b8 e31c0003 1afffff6 e1a00002 e59f20d8 

I/DEBUG   ( 1931): afe0e7c8 e490c004 e0433000 f5d0f040 e04c13a2 

I/DEBUG   ( 1931): afe0e7d8 e0011002 e1d1100c 0490c004 1a000022 

I/DEBUG   ( 1931): 

I/DEBUG   ( 1931): code around lr:

I/DEBUG   ( 1931): 0000a994 9905edae f0009804 9003fcad edd6f7fe 

I/DEBUG   ( 1931): 0000a9a4 21009b03 4b3a181a 70113a01 18e19a03 

I/DEBUG   ( 1931): 0000a9b4 f7fe1c28 9803ed9c edf8f7fe f7fe1c28 

I/DEBUG   ( 1931): 

I/DEBUG   ( 1931): stack:

I/DEBUG   ( 1931):     be971398  00000000  

I/DEBUG   ( 1931):     be97139c  afe0bca5  /system/lib/libc.so

I/DEBUG   ( 1931):     be9713a0  00000000  

I/DEBUG   ( 1931):     be9713a4  afe0b39b  /system/lib/libc.so

I/DEBUG   ( 1931):     be9713a8  be97140c  [stack]

I/DEBUG   ( 1931):     be9713ac  00000010  

I/DEBUG   ( 1931):     be9713b0  be971610  [stack]

......

查看Vold的源码,vold 在读取 /sys%s/type  /sys%s/name 


system/core/vold/mmc.c 可能为空,就会有栈错误。

修改patch 如下:
Index: mmc.c
===================================================================
--- mmc.c (revision 1)
+++ mmc.c (revision 280)
@@ -150,6 +150,11 @@
 
     sprintf(filename, "/sys%s/type", devpath);
     p = read_file(filename, &sz);
+    if(p == NULL)
+    {
+        LOGE("Unable to read %s/n", filename);
+        return -errno;
+    }
     p[strlen(p) - 1] = '/0';
     sprintf(tmp, "MMC_TYPE=%s", p);
     free(p);
@@ -157,6 +162,11 @@
 
     sprintf(filename, "/sys%s/name", devpath);
     p = read_file(filename, &sz);
+    if(p == NULL)
+    {
+        LOGE("Unable to read %s/n", filename);
+        return -errno;
+    }
     p[strlen(p) - 1] = '/0';
     sprintf(tmp, "MMC_NAME=%s", p);
     free(p);

你可能感兴趣的:(Android Vold和SDIO冲突问题解决方法)