ASR_BASE

Change-Id: Icf3719cc0afe3eeb3edc7fa80a2eb5199ca9dda1
diff --git a/target/linux/mmp/base-files/sbin/mrvl_detect_sdcard b/target/linux/mmp/base-files/sbin/mrvl_detect_sdcard
new file mode 100755
index 0000000..fee319f
--- /dev/null
+++ b/target/linux/mmp/base-files/sbin/mrvl_detect_sdcard
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+. /lib/functions.sh
+
+num=0
+path_prefix=/sdcard
+
+link_mount() {
+        local config="$1"
+        local target
+        local path=$path_prefix
+
+        config_get target "$config" target
+        echo $target | grep "mnt" && {
+                grep -qs "$target" /proc/mounts
+                if [ $? -eq 0 ]; then
+                        [ $num -gt 0 ] && path=$path$num
+                        mkdir -p $path
+                        /bin/mount -o noatime,move $target $path
+                        echo $target mounted, soft link created:$path
+                        num=$((num+1))
+                else
+                        echo $target NOT mounted, removing $target
+                        rmdir $target &> /dev/null
+                fi
+        }
+}
+
+config_load fstab
+
+if [ $? -eq 0 ]; then
+
+        # Create a soft link to mounted partitions
+        rm $path_prefix* &> /dev/null
+        config_foreach link_mount mount
+else
+        echo "No SD Card detected"
+fi