Hardware Design: SIE
Sign in or create your account | Project List | Help
Hardware Design: SIE Git Source Tree
Root/
| 1 | #!/bin/sh |
| 2 | # Program: |
| 3 | # Program trys firstly to detect if uSD card inserted and then |
| 4 | # mount data |
| 5 | # History: |
| 6 | # Author: |
| 7 | # 2010-08-19 XiangFu Liu, xiangfu@sharism.cc |
| 8 | |
| 9 | if [ -b "/dev/mmcblk0" ] ; then |
| 10 | echo "there is a memory card present" |
| 11 | else |
| 12 | echo "ERROR - there is no memory card inserted" |
| 13 | exit 1 |
| 14 | fi |
| 15 | |
| 16 | #make multi-layer directory |
| 17 | mkdir -p /tmp/card |
| 18 | |
| 19 | echo "try to mount mmc card" |
| 20 | mount /dev/mmcblk0p1 /tmp/card/ |
| 21 | if [ $? == 0 ] ; then |
| 22 | echo "mount ok" |
| 23 | else |
| 24 | echo "ERROR - can not do a real mount on memory card" |
| 25 | exit 1 |
| 26 | fi |
| 27 | |
| 28 | echo "testing ..." |
| 29 | dd if=/dev/zero of=/tmp/card/testfile bs=1024 count=3096 |
| 30 | if [ $? == 0 ] ; then |
| 31 | echo "mount ok" |
| 32 | else |
| 33 | echo "ERROR - can not do a real test for mounting memory card" |
| 34 | exit 1 |
| 35 | fi |
| 36 | |
| 37 | rm -rf /tmp/card/testfile |
| 38 | umount /tmp/card |
| 39 | echo "test done" |
| 40 | |
| 41 | |
| 42 |
Branches:
master
