On Fri, 2013-11-15 at 11:17 +0000, Jon Medhurst (Tixy) wrote:
Can anyone provide clues to help me get 'sdcard' partition working on Linaro Android KitKat images? Here's where I've got to so far...
After updating the vexpress storage config for KitKat [1] the sdcard partition on Linaro Android images is getting mounted by vold, but apps can't access this because android.process.media keeps crashing in attachVolume because FileUtils.getFatVolumeId is returning -1.
With MediaProvider hacked to provide verbose logging I get:
V/MediaProvider( 2825): /storage/sdcard0 volume ID: -1 E/MediaProvider( 2825): Can't obtain external volume ID even though it's mounted.
and I've verified the -1 comes from the call ioctl(fd, VFAT_IOCTL_GET_VOLUME_ID) in android_os_FileUtils_getFatVolumeId in frameworks/base/core/jni/android_os_FileUtils.cpp.
Running 'mount' gives...
rootfs / rootfs rw,relatime 0 0 tmpfs /dev tmpfs rw,nosuid,relatime,mode=755 0 0 devpts /dev/pts devpts rw,relatime,mode=600 0 0 proc /proc proc rw,relatime 0 0 sysfs /sys sysfs rw,relatime 0 0 tmpfs /mnt/secure tmpfs rw,relatime,mode=700 0 0 tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0 tmpfs /mnt/obb tmpfs rw,relatime,mode=755,gid=1000 0 0 /sys/kernel/debug /sys/kernel/debug debugfs rw,relatime 0 0 /dev/block/sda2 /system ext4 ro,relatime,data=ordered 0 0 /dev/block/sda3 /cache ext4 rw,nosuid,nodev,noatime,errors=panic,data=ordered 0 0 /dev/block/sda5 /data ext4 rw,nosuid,nodev,noatime,errors=panic,data=ordered 0 0 nodev /dev/gator gatorfs rw,relatime 0 0 /dev/block/vold/8:6 /mnt/media_rw/sdcard0 vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1023,gid=1023,fmask=0007,dmask=0007,allow_utime=0020,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0 /dev/block/vold/8:6 /mnt/secure/asec vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1023,gid=1023,fmask=0007,dmask=0007,allow_utime=0020,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0 /dev/fuse /storage/sdcard0 fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
So first guess would be that fuse doesn't support this function, however as this seems to be the standard Android way of doing things, you would assume that it should work...?
So, hacking getFatVolumeId to return a value other than -1 means the system works and files on 'external' sdcard are seen and usable by apps.
I guess the issue is that the file system is 'fuse' not 'vfat' and the fuse filesystem doesn't implement VFAT_IOCTL_GET_VOLUME_ID.
So it would seem logical that the config is wrong somehow the the non-emulated external media shouldn't be using fuse. However, the description at http://source.android.com/devices/tech/storage/index.html says:
Starting in Android 4.4, the owner, group and modes of files on external storage devices are now synthesized based on directory structure. [...] These synthesized permissions are accomplished by wrapping raw storage devices in a FUSE daemon.
???