Enable SATA and SD cards on A20-OLinuXino-MICRO-4GB with Android on NAND
Please read Liability Disclaimer and License Agreement CAREFULLY
After reading a lot of post on how to enable the SD cards on Android i have decided to write a small tutorial on how to enable the use of both SD (micro and full) cards and also of SATA on Android 4.2 for A20-OLinuXino-MICRO-4GB.
This is valid only if Android will be installed on nand - storage_type = 0 in sys_config.fex
All paths are copied from my setup, so you need to look in the folders according to your setup.
The steps are the following:
1. By default the microSD detection is set to pooling in /home/gvi/android/olimex-a20/lichee/tools/pack/chips/sun7i/configs/android/olinuxino-a20/sys_config.fex
[mmc0_para]
sdc_used = 1
sdc_detmode = 3
sdc_buswidth = 4
sdc_clk = port:PF02<2><1><2><default>
sdc_cmd = port:PF03<2><1><2><default>
sdc_d0 = port:PF01<2><1><2><default>
sdc_d1 = port:PF00<2><1><2><default>
sdc_d2 = port:PF05<2><1><2><default>
sdc_d3 = port:PF04<2><1><2><default>
sdc_det = port:PH01<0><1><default><default>
sdc_use_wp = 0
sdc_wp =
sdc_isio = 0
sdc_regulator = "none"
so if you want the microSD to be auto detected change sdc_detmode = 1
2. The full SD card is disable by default, so we need to enable it
[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"
3. Enable SATA - since we are in the fex file check also if the SATA is enable
[sata_para]
sata_used = 1
sata_power_en = port:PB08<1><default><default><0>
4. Add SATA drivers
Go in folder /home/gvi/android/olimex-a20/lichee/linux-3.4 and press CTRL+H and you will see .config file.
We need to add SATA drivers to kernel and below is my configuration
# SCSI Transports
#
# CONFIG_SCSI_SPI_ATTRS is not set
# CONFIG_SCSI_FC_ATTRS is not set
# CONFIG_SCSI_ISCSI_ATTRS is not set
# CONFIG_SCSI_SAS_ATTRS is not set
# CONFIG_SCSI_SAS_LIBSAS is not set
# CONFIG_SCSI_SRP_ATTRS is not set
CONFIG_SCSI_LOWLEVEL=y
# CONFIG_ISCSI_TCP is not set
# CONFIG_ISCSI_BOOT_SYSFS is not set
# CONFIG_LIBFC is not set
# CONFIG_LIBFCOE is not set
# CONFIG_SCSI_DEBUG is not set
# CONFIG_SCSI_DH is not set
# CONFIG_SCSI_OSD_INITIATOR is not set
CONFIG_ATA=y
# CONFIG_ATA_NONSTANDARD is not set
CONFIG_ATA_VERBOSE_ERROR=y
CONFIG_SATA_PMP=y
#
# Controllers with non-SFF native interface
#
CONFIG_SATA_AHCI_PLATFORM=y
CONFIG_SW_SATA_AHCI_PLATFORM=y
CONFIG_ATA_SFF=y
#
# SFF controllers with custom DMA interface
#
CONFIG_ATA_BMDMA=y
#
# SATA SFF controllers with BMDMA
#
# CONFIG_SATA_MV is not set
#
# PATA SFF controllers with BMDMA
#
#
# PIO-only SFF controllers
#
#
# Generic fallback / legacy drivers
#
CONFIG_MD=y
You can also get the same result by using make ARCH=arm menuconfig in a terminal window when you are in the folder.
cd /home/gvi/android/olimex-a20/lichee/linux-3.4
make ARCH=arm menuconfig
5. After you have added the drivers you need to build the kernel
In the terminal window type cd ../ and you end up in /home/gvi/android/olimex-a20/lichee
Now type ./build.sh -psun7i_android and wait for the build to finish
6. Edit strings.xml - this is how my strings are now
file location - /home/gvi/android/olimex-a20/android4.2/frameworks/base/core/res/res/values/strings.xml
<!-- Storage description for internal storage. [CHAR LIMIT=NONE] -->
<string name="storage_internal">Internal storage</string>
<!-- Storage description for the SD card. [CHAR LIMIT=NONE] -->
<string name="storage_sd_card">uSD card</string>
<!-- Storage description for the ful SD card. [CHAR LIMIT=NONE] -->
<string name="storage_normalcard">SD card</string>
<!-- Storage description for USB storage. [CHAR LIMIT=NONE] -->
<string name="storage_usb">USB storage</string>
<!-- Storage description for the SATA HDD. [CHAR LIMIT=NONE] -->
<string name="storage_sata">SATA HDD</string>
7. Change storage_list.xml file
file location - /home/gvi/android/olimex-a20/android4.2/device/softwinner/olinuxino-a20/overlay/frameworks/base/core/res/res/xml
<StorageList xmlns:android="http://schemas.android.com/apk/res/android">
<storage android:mountPoint="/mnt/sdcard"
android:storageDescription="@string/storage_internal"
android:primary="true"
android:removable="false"
android:emulated="false"
android:mtpReserve="100"
android:allowMassStorage="true"
android:maxFileSize="0"/>
<storage android:mountPoint="/mnt/microsd"
android:storageDescription="@string/storage_sd_card"
android:primary="false"
android:removable="true"
android:emulated="false"
android:mtpReserve="0"
android:allowMassStorage="true"
android:maxFileSize="0"/>
<storage android:mountPoint="/mnt/fullsd"
android:storageDescription="@string/storage_normalcard"
android:primary="false"
android:removable="true"
android:emulated="false"
android:mtpReserve="0"
android:allowMassStorage="true"
android:maxFileSize="0"/>
<storage android:mountPoint="/mnt/sata"
android:storageDescription="@string/storage_sata"
android:primary="false"
android:removable="true"
android:emulated="false"
android:mtpReserve="0"
android:maxFileSize="0" />
<storage android:mountPoint="/mnt/usbhost1"
android:storageDescription="@string/storage_usb"
android:primary="false"
android:removable="true"
android:emulated="false"
android:mtpReserve="0"
android:maxFileSize="0"/>
</StorageList>
8. Change init.sun7i.rc
file location - /home/gvi/android/olimex-a20/android4.2/device/softwinner/olinuxino-a20
on early-init
export EXTERNAL_STORAGE /mnt/sdcard
mkdir /mnt/sdcard 0000 system system
# for backwards compatibility
symlink /mnt/sdcard /sdcard
mkdir /mnt/microsd 0000 system system
mkdir /mnt/fullsd 0000 system system
mkdir /mnt/sata 0000 system system
mkdir /mnt/usbhost1 0000 system system
# mkdir /mnt/usbhost2 0000 system system
# mkdir /mnt/extsd1 0000 system system
mount debugfs debugfs /sys/kernel/debug
mkdir /databk 0700 root system
9. Change vold.fstab
file location - /home/gvi/android/olimex-a20/android4.2/device/softwinner/olinuxino-a20
dev_mount sdcard /mnt/sdcard auto /devices/virtual/block/nandk
dev_mount microsd /mnt/microsd auto /devices/platform/sunxi-mmc.0/mmc_host
dev_mount fullsd /mnt/fullsd auto /devices/platform/sunxi-mmc.3/mmc_host
dev_mount sata /mnt/sata auto /devices/platform/sw_ahci.0
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
10. Compile Android
cd /home/gvi/android/olimex-a20/android4.2
source build/envsetup.sh
lunch
extract-bsp
make -j4
pack
11. Burn the image
and...voila
Internal storage part 1
Internal storage part 2
Micro SD card
Full SD card
SATA 32Gb SSD
For hardware pictures look in Android Remote Control for Digital camera
Download the image android_olinuxino-a20.img