Fullsize SD card slot under android [HOWTO]

Started by deskwizard, June 14, 2014, 03:31:15 PM

Previous topic - Next topic

deskwizard

Good morning,

I've had some time to play around trying to get the fullsize SD card slot working under Android, and to my surprise, it was way easier than I expected. Here is how I've done it


Step 1:
Modifications required to /android4.2/device/softwinner/olinuxino-a20/init.sun7i.rc :
** Creates required mount points on system start **

After:
        mkdir /mnt/usbhost2 0000 system system

Add:
   mkdir /mnt/fullsd 0000 system system


Step 2:
Modifications required to android4.2/frameworks/base/core/res/res/values/strings.xml:
** Adds mount points definitions for Full size SD card to be displayed in Settings/Storage **

After:
    <!-- Storage description for USB storage. [CHAR LIMIT=NONE] -->
    <string name="storage_usb">USB storage</string>

Add:
    <!-- Storage description for full size SD card storage. [CHAR LIMIT=NONE] -->
    <string name="storage_fullsd">Fullsize SD card</string>


Step 3:
Modifications required to /android4.2/device/softwinner/olinuxino-a20/vold.fstab :
** Adds mount point definition for vold **

At the end of the file, add the following line:

dev_mount   fullsd  /mnt/fullsd   auto   /devices/platform/sunxi-mmc.3/mmc_host

Step 4:
Modifications required to /device/softwinner/olinuxino-a20/overlay/frameworks/base/core/res/res/xml/storage_list.xml

At the end of the array, add the following:

<storage android:mountPoint="/mnt/fullsd"
             android:storageDescription="@string/storage_fullsd"
             android:primary="false"
             android:removable="true"
             android:emulated="false" 
             android:mtpReserve="0"
             android:maxFileSize="0"/>

Step 5: Recompile android and enjoy your second SD card slot :)

Let me know how it works for you !

PS: A similar procedure should work for adding SATA support, though kernel recompilation will also be required for SATA. I haven't included the SATA information as I am currently having issues having it mounting properly.

(I can have it mount manually using dev/sda1 (example) but not using the vold.fstab entry, and having it mounting like that at boot could become a mess if USB flash drives are connected. I need to find a way to check what block device (sda etc... ) is on the sata port for correct mount or something along those line... I am not an expert in linux nor android so I'm stuck there.)

DW

deskwizard

FYI step 2 can be ommited if static description is used instead of @string descriptor.
(My wording is likely wrong, just look at the other mount points in the file, most don't use the @string format.)

adinu

Cool, thanks a lot! I'll test it tomorrow and let you know!
Adrian

deskwizard

I have forgotten to mention that MMC3 needs to be enabled in the system.fex file, just have a look, IIRC it is by default

I am currently at work so I cannot post the required section, but I will post it once I get home tonight in case it is not currently enabled in yours/anyone elses.

deskwizard

[mmc3_para]
sdc_used            = 1
sdc_detmode         = 1
sdc_buswidth        = 4
sdc_cmd             = port:PI04<2><1><2><default>
sdc_clk             = port:PI05<2><1><2><default>
sdc_d0              = port:PI06<2><1><2><default>
sdc_d1              = port:PI07<2><1><2><default>
sdc_d2              = port:PI08<2><1><2><default>
sdc_d3              = port:PI09<2><1><2><default>
sdc_det             = port:PH11<0><1><default><default>
sdc_use_wp          = 0
sdc_wp              =
sdc_isio            = 1
sdc_regulator       = "none"

adinu

Hi deskwizard,

I followed your steps but I can't test if it works or not. When I go to Settings -> Storage it sais: Unfortunately, Settings has stopped. When I open File Manager it sais the same thing: Unfortunately, File Manager has stopped. Also, when I plug in a USB cable to the USB_OTG and to my computer, I try to mount it as media device (MTP) and it gives me the message: 'Unfortunately, the process android.process.media has stopped' and doesn't mount it.

I have an own android build, do you know how I can solve this problem? Thanks a lot.
Adrian

deskwizard

Hi adinu,

I am pretty new to that whole thing, and I do have a custom android build also, with a lot of modifications.

The "unfortunately settings has stopped" error I did get myself when I made mistakes in my vold.fstab file if I recall correctly.

I don't remember having the other issue you are having with MTD mode, but then again I spend most of my time in debug mode.

I know I had to mess around with vold.fstab to have my mounts working, so I am very inclined to think that might be it.

I will post my files tonight so you can have a look.

Thanks for the update, I was worried my instructions might have issues.
Sorry about that.

PS: Are you running android from NAND or SD card?

DW

adinu

#7
Hey,

I'm running it form SD card.

Unfortunately, I'm more of a newbie than you are so I have no idea how vold.fstab works. It's a short file, so I can pase it here, in case it's missing something:

--------------------------------------------------------------------------------------------------------------
## Vold 2.0 fstab for HTC Passion
#
## - San Mehat (san@android.com)
##
#######################
## Regular device mount
##
## Format: dev_mount <label> <mount_point> <part> <sysfs_path1...>
## label        - Label for the volume
## mount_point  - Where the volume will be mounted
## part         - Partition # (1 based), or 'auto' for first usable partition.
## <sysfs_path> - List of sysfs paths to source devices
######################

# Mounts the first usable partition of the specified device
#/devices/platform/awsmc.3/mmc_host for sdio
#dev_mount   sdcard   /mnt/sdcard   1   /devices/virtual/block/nandk   /devices/platform/sunxi-mmc.0/mmc_host
dev_mount       sata    /mnt/sata       auto    /devices/platform/sw_ahci.0
dev_mount   sdcard   /mnt/sdcard   auto   /devices/virtual/block/nandk
dev_mount   extsd   /mnt/extsd   auto   /devices/platform/sunxi-mmc.1/mmc_host   /devices/platform/sunxi-mmc.0/mmc_host
dev_mount   usbhost1   /mnt/usbhost1   auto   /devices/platform/sw-ehci.1   /devices/platform/sw_hcd_host0   /devices/platform/sw-ohci.1 /devices/platform/sw-ehci.2

dev_mount fullsd /mnt/fullsd auto /devices/platform/sunxi-mmc.3/mmc_host
-------------------------------------------------------------------------------------------------------------

Also, I didn't touch anything in the kernel configuration. Maybe I have to activate some settings in the menuconfig? Maybe my problem is not related to the SD card at all. Nothing related to accessing the file system seems to work.

Thanks for sharing your progress!

PS:

Output from the 'df' command:

/dev                   412M    32K   412M   4096
/mnt/secure            412M     0K   412M   4096
/mnt/asec              412M     0K   412M   4096
/mnt/obb               412M     0K   412M   4096
/system                503M   486M    17M   4096
/data                  503M   332M   171M   4096
/cache                 503M     8M   495M   4096
Adrian

deskwizard

#8
Hi adinu,

I am also running from SD card at the moment.

I didn't change anything in the kernel config relating to SD cards (that I recall), thought I had changed the system.fex file as previously mentionned.

Here is my vold.fstab for reference:


dev_mount sdcard /mnt/sdcard 1 /devices/virtual/block/nandk /devices/platform/sunxi-mmc.0/mmc_host

#dev_mount sdcard /mnt/sdcard auto /devices/virtual/block/nandk
dev_mount extsd /mnt/extsd auto /devices/platform/sunxi-mmc.1/mmc_host /devices/platform/sunxi-mmc.0/mmc_host

#working
dev_mount fullsd /mnt/fullsd auto /devices/platform/sunxi-mmc.3/mmc_host
dev_mount usbhost1 /mnt/usbhost1 auto /devices/platform/sw-ehci.1 /devices/platform/sw_hcd_host0 /devices/platform/sw-ohci.1 /devices/platform/sw-ehci.2


#not working
dev_mount       sata    /mnt/sata       auto    /devices/platform/sw_ahci.0


I tried using USB storage and it is working on my side.

I think your issue might be with the "sdcard" mount point. Let me know how that goes.

If you want, I can upload somewhere all the modifications I did and my .config file in case it can help, perhaps "diff"-ing files could help finding the source of your issue but I have to warn you, some are pretty extensive. (well, for myself anyway)

PS: Thanks for teaching me about "df"; here is my output:

df result:
Filesystem             Size   Used   Free   Blksize
/dev                   412M    32K   412M   4096
/mnt/secure            412M     0K   412M   4096
/mnt/asec              412M     0K   412M   4096
/mnt/obb               412M     0K   412M   4096
/system                503M   410M    93M   4096
/data                  503M   245M   258M   4096
/cache                 503M     8M   495M   4096
/mnt/fullsd             14G   184M    14G   4096


Hope any of this can help.

DW

I should be around tonight (GMT -5) and maybe all day tomorrow, june 24th is a holiday over here, and I am not sure of what I will be doing yet (as I received a bunch of "presents" from china in the mail today hehehe) If you are so inclined, come in the #olimex channel on IRC (freenote server) and hit me up.

adinu

Hi DW,

I tried your vold.fstab with no luck. Comparing the .config files seems like a good idea, but I think I'm better off getting dave-at-axon's source from this thread: https://www.olimex.com/forum/index.php?topic=3235.msg13565#msg13565 and build it myself, since he seems to have a lot of things figured out already. Once I do that, I will try againg with your instructions and get back to you :). I was avoiding doing that because of the long time it takes to build for the first time, and because I'm sure there will be new problems, as allways xD.

Thanks againg for the help, I'll post again after I try dave's source. Bye!
Adrian

deskwizard

Alright! No worries
Hope you have better luck with his sources that I did, I couldn't get them to extract correctly/build.
I added the RTC mod he did in my sources and its working wonderfully.

Hit me up if you need anything
Sorry I missed you this morning

DW

dave-at-axon

Hi DW. I found an issue with the sources and I then recreated them from a clean build and another forum member was able to download and build from those.

Sorry for any issues to all but if you let me know via PM I am willing to offer any help I can.

adinu

Hey all,

I have succefully built dave-at-axon's sources and everything works perfectly, including the full size SD!

Many thanks to both of you!

DW, unfortunately this means I can't test your instructions for making the SD slot work, sorry about that. I have also discovered that the MTP error I got was because of my Linux (PC), not because of Android.

Regards, and thanks again for all the help.
Adrian

deskwizard

No worries Dave, your instructions helped me a lot as it is! I've learned a lot playing around with the sources actually :) I will still get yours as its nice to have a working set and something to diff mine with.

Adinu, don't worry about it pal, I'm glad you got everything working!

DW

dave-at-axon

@DW. Great.

I too have learned a lot and how the whole things connects to the underlying hardware. I am working on a Linux driver for the CAN bus on the A20 and hope to finally have an Android interface to this. It will be some time though as I can only do this a few hours a week because of work commitments.

I have to say though that the A20 is very stable running Android and I have been switching this unit I designed for it on and off every day for the past few months and it just works.

I took the prototype unit along to my meeting with the client this week and it was well received. They were stunned to see that it was Android and I explained that it was a custom build with modifications to support the interfacing they needed for the project. Now all I need to do is final testing and small bug fixes and I should be ready to install the first systems around the end of Sept this year so it's looking good.