External Sd card support in Kitkat 4.4.2

5,502 views
Skip to first unread message

Anand R

unread,
Mar 11, 2014, 8:16:53 PM3/11/14
to android...@googlegroups.com
Hi All,

I am facing a issue when i try to mount a external sdcard in a custom device which is running on Kitkat 4.4.2.
Below is the error which i am getting whenever sdcard mount happens.

03-11 23:25:32.229: E/cutils(553): Failed to mkdir(/mnt/shell/emulated/0): Read-only file system
03-11 23:25:32.229: E/dalvikvm(553): cannot mountExternalStorage(): Read-only file system

My init.device.rc is as follows:

# no emmc file systems mounted at this point (system, data, pds, etc.)
# runs after "on early-init" and before "on early-fs"
# runs in charge-only-mode
on init
    export PATH /system/sbin:/system/bin:/system/xbin:/sbin:/vendor/bin

    write /sys/class/graphics/fbcon/cursor_blink 0

    mkdir /mnt/shell 0777 shell shell
    mkdir /mnt/shell/emulated 0700 shell shell

    #mkdir /storage 0550 system sdcard_r
    mkdir /storage/emulated 0555 root root

    mkdir /mnt/media_rw 0777 media_rw media_rw
    mkdir /mnt/media_rw/sdcard1 0700 media_rw media_rw
    mkdir /storage/sdcard1 0775 root root

    export EXTERNAL_STORAGE /storage/emulated/legacy
    export SECONDARY_STORAGE /storage/sdcard1
    export EMULATED_STORAGE_SOURCE /mnt/shell/emulated
    export EMULATED_STORAGE_TARGET /storage/emulated

    #symlink /storage/emulated/legacy /sdcard
    #symlink /storage/emulated/legacy /mnt/sdcard
    #symlink /storage/emulated/legacy /storage/sdcard0
    #symlink /mnt/shell/emulated/0 /storage/emulated/legacy
    #symlink /storage/sdcard1 /extSdCard
    #symlink /storage/sdcard1 /mnt/extSdCard

fstab.device is as follows

# Android fstab file.
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
/dev/block/system /system ext4 ro,noatime wait
/dev/block/cache /cache ext4 nosuid,nodev,noatime,nodelalloc,barrier=1,data=ordered wait,check
#/dev/block/panic /panic raw defaults wait
/dev/block/userdata /data ext4 nosuid,nodev,noatime,nodelalloc,barrier=1,data=ordered wait,check,encryptable=footer
/dev/block/pds /pds ext4 nosuid,nodev,noatime,nodelalloc,barrier=1,data=ordered wait,check
/devices/pci0000:00/0000:00:04.0/mmc_host/mmc1 auto vfat defaults voldmanaged=sdcard1:auto

Whether i comment or uncomment the creation of symlinks to "/sdcard", "/mnt/sdcard/", the behavior is the same.

When i explicitly mount sdcard from shell prompt using "mount" commnd, it is able to mount.
Please help me to resolve this issue.


Thanks in Advance,
Anand.

Jeff Sharkey

unread,
Mar 12, 2014, 1:07:18 PM3/12/14
to ranan...@gmail.com, android-porting
That error is happening when Zygote is trying to prepare the multiuser mount namespace.

It looks like primary external storage is emulated on your device; is that FUSE daemon started and running?  (The mkdir might be failing against the read-only rootfs if the daemon isn't present.)

It might also be helpful to compare your configuration against a known working example:


It sounds like you're building a "Emulated primary, physical secondary" device.  Hope this helps.

j


-- 
-- 
unsubscribe: android-porti...@googlegroups.com
website: http://groups.google.com/group/android-porting

--- 
You received this message because you are subscribed to the Google Groups "android-porting" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-porti...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



-- 
Jeff Sharkey
jsha...@android.com



j


--
--
unsubscribe: android-porti...@googlegroups.com
website: http://groups.google.com/group/android-porting

---
You received this message because you are subscribed to the Google Groups "android-porting" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-porti...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Jeff Sharkey
jsha...@android.com

Anand R

unread,
Mar 17, 2014, 10:36:25 AM3/17/14
to android...@googlegroups.com, ranan...@gmail.com
Hi Jeff,

Thanks for your valuable information.

My configuration is similar to the one that is there in the link.
"It sounds like you're building a "Emulated primary, physical secondary" device" => Yes I am building Emualated primary and physical secondary.

Can you please let me know how to check whether FUSE daemon is started and running.
I used "ps" command. I am not able to see any FUSE daemon process running.

Regards,
Anand.

j



website: http://groups.google.com/group/android-porting

--- 
You received this message because you are subscribed to the Google Groups "android-porting" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-porting+unsub...@googlegroups.com.



-- 
Jeff Sharkey
jsha...@android.com

Manivannan Palanisamy

unread,
Apr 26, 2014, 4:48:17 AM4/26/14
to android...@googlegroups.com
Hi Anand,

I am also facing the simillar issue. is that your issue got resolved. Please let me know.

Steve Jones

unread,
Apr 27, 2014, 12:56:33 AM4/27/14
to android...@googlegroups.com
Hi Folks 

Here's is the init rc, fstab and storage_list that I am successfully using with an external sd card 

Although my configuration files currently mount the root as r/w , I'm fairly certain it works when mount r/o , although I will have to double check that :)

trevd

Manivannan Palanisamy

unread,
May 2, 2014, 2:09:52 AM5/2/14
to android...@googlegroups.com
Hi Steve,

Any specific changes required for emmc card setup. Please confirm since my board memory is using eMMC .

Rohit Kumar

unread,
May 13, 2014, 4:03:34 PM5/13/14
to android...@googlegroups.com
Check the following configuration:
export SECONDARY_STORAGE /storage/sdcard1
mkdir
/storage/sdcard1 0000 system system (you are using root which is causing permission issue)

Thanks

Mica Cruz

unread,
Sep 25, 2015, 11:37:21 AM9/25/15
to android-porting
done ?? is this works?
i want to use my sd card as my phone storage
Reply all
Reply to author
Forward
0 new messages