参考
http://blog.sina.com.cn/s/blog_5f8665e701016le6.html
http://blog.chinaunix.net/uid-20620288-id-3180843.html
环境:内核2.6.35 busybox-1.15.2
(1)busybox配置mdev
Linux System Utilities->
[*] mdev
[*] Support /etc/mdev.conf
[*] Support subdirs/symlinks
[*] Support regular expressions substitutions when renaming device
[*] Support command execution at device addition/ | |
[*] Support loading of firmwares
(2)支持VFAT文件系统
File systems ->
DOS/FAT/NT Filesystems --->
<*> MSDOS fs support
<*> VFAT (Windows-95) fs support
(437) Default codepage for
(iso8859-1) Default iocharset for FAT
Native language support --->
<*> Codepage 437 (United States, Canada)
<*> NLS ISO 8859-1 (Latin 1; Western European Languages)
(3)SD驱动支持
<*> MMC/SD/SDIO card support --->
(4)支持热插拔
在以下文件添加内容
Vim /etc/init.d/rcS
#!/bin/sh
/bin/mount -t proc none /proc
/bin/mount -t sysfs sysfs /sys
/bin/echo > /dev/mdev.seq
/bin/echo /sbin/mdev > /proc/sys/kernel/hotplug
Vim /etc/mdev.conf
mmcblk([0-9]+)p([0-9]+) 0:0 660 */sbin/hotplug.sh $MDEV
mmcblk([0-9]+) 0:0 660 */sbin/hotplug.sh $MDEV
sd([a-z]+)([0-9]+) 0:0 660 */sbin/hotplug.sh $MDEV
sd([a-z]+) 0:0 660 */sbin/hotplug.sh $MDEV
Vim /sbin/hotplug.sh
#! /bin/sh
echo "lqj auto mount sd"
if [ "$1" == "" ]; then
echo "parameter is none" > /tmp/error.txt
exit 1
fi
MNT=$1
if echo "$1" | grep mmcblk; then
if echo "$1" | grep p[25]; then
MNT=sdcard2
else
MNT=sdcard
fi
else
if echo "$1" | grep sd; then
if echo "$1" | grep [25]; then
MNT=nandcard2
else
MNT=nandcard
fi
fi
fi
mounted=`mount | grep $1 | wc -l`
#echo "par=$1,mounted=$mounted,MNT=$MNT" > /dev/console
# mounted, assume we umount
if [ $mounted -ge 1 ]; then
echo "R/mnt/$1" >> /tmp/usbmnt.log
echo "R/mnt/$1" > /tmp/fifo.1
if ! umount -l "/mnt/$1"; then
exit 1
else
rm -f "/mnt/$MNT"
echo "[Umount FS]: /dev/$1 -X-> /mnt/$MNT" > /dev/console
fi
if ! rmdir "/mnt/$1"; then
exit 1
fi
# not mounted, lets mount under /mnt
else
if ! mkdir -p "/mnt/$1"; then
exit 1
fi
#try jffs2 first
if ! mount -t jffs2 "/dev/$1" "/mnt/$1"; then
#try vfat
if ! mount -t vfat -o noatime,shortname=mixed,utf8 "/dev/$1" "/mnt/$1"; then
# failed to mount, clean up mountpoint
if ! rmdir "/mnt/$1"; then
exit 1
fi
exit 1
else
ln -s /mnt/$1 /mnt/$MNT
echo "[Mount VFAT]: /dev/$1 --> /mnt/$MNT" > /dev/console
echo "A/mnt/$1" >> /tmp/usbmnt.log
echo "A/mnt/$1" > /tmp/fifo.1
fi
else
echo "[Mount JFFS2]: /dev/$1 --> /mnt/$MNT" > /dev/console
echo "A/mnt/$1" >> /tmp/usbmnt.log
echo "A/mnt/$1" > /tmp/fifo.1
fi
fi
http://blog.sina.com.cn/s/blog_5f8665e701016le6.html
http://blog.chinaunix.net/uid-20620288-id-3180843.html
环境:内核2.6.35 busybox-1.15.2
(1)busybox配置mdev
Linux System Utilities->
[*] mdev
[*] Support /etc/mdev.conf
[*] Support subdirs/symlinks
[*] Support regular expressions substitutions when renaming device
[*] Support command execution at device addition/ | |
[*] Support loading of firmwares
(2)支持VFAT文件系统
File systems ->
DOS/FAT/NT Filesystems --->
<*> MSDOS fs support
<*> VFAT (Windows-95) fs support
(437) Default codepage for
(iso8859-1) Default iocharset for FAT
Native language support --->
<*> Codepage 437 (United States, Canada)
<*> NLS ISO 8859-1 (Latin 1; Western European Languages)
(3)SD驱动支持
<*> MMC/SD/SDIO card support --->
(4)支持热插拔
在以下文件添加内容
Vim /etc/init.d/rcS
#!/bin/sh
/bin/mount -t proc none /proc
/bin/mount -t sysfs sysfs /sys
/bin/echo > /dev/mdev.seq
/bin/echo /sbin/mdev > /proc/sys/kernel/hotplug
Vim /etc/mdev.conf
mmcblk([0-9]+)p([0-9]+) 0:0 660 */sbin/hotplug.sh $MDEV
mmcblk([0-9]+) 0:0 660 */sbin/hotplug.sh $MDEV
sd([a-z]+)([0-9]+) 0:0 660 */sbin/hotplug.sh $MDEV
sd([a-z]+) 0:0 660 */sbin/hotplug.sh $MDEV
Vim /sbin/hotplug.sh
#! /bin/sh
echo "lqj auto mount sd"
if [ "$1" == "" ]; then
echo "parameter is none" > /tmp/error.txt
exit 1
fi
MNT=$1
if echo "$1" | grep mmcblk; then
if echo "$1" | grep p[25]; then
MNT=sdcard2
else
MNT=sdcard
fi
else
if echo "$1" | grep sd; then
if echo "$1" | grep [25]; then
MNT=nandcard2
else
MNT=nandcard
fi
fi
fi
mounted=`mount | grep $1 | wc -l`
#echo "par=$1,mounted=$mounted,MNT=$MNT" > /dev/console
# mounted, assume we umount
if [ $mounted -ge 1 ]; then
echo "R/mnt/$1" >> /tmp/usbmnt.log
echo "R/mnt/$1" > /tmp/fifo.1
if ! umount -l "/mnt/$1"; then
exit 1
else
rm -f "/mnt/$MNT"
echo "[Umount FS]: /dev/$1 -X-> /mnt/$MNT" > /dev/console
fi
if ! rmdir "/mnt/$1"; then
exit 1
fi
# not mounted, lets mount under /mnt
else
if ! mkdir -p "/mnt/$1"; then
exit 1
fi
#try jffs2 first
if ! mount -t jffs2 "/dev/$1" "/mnt/$1"; then
#try vfat
if ! mount -t vfat -o noatime,shortname=mixed,utf8 "/dev/$1" "/mnt/$1"; then
# failed to mount, clean up mountpoint
if ! rmdir "/mnt/$1"; then
exit 1
fi
exit 1
else
ln -s /mnt/$1 /mnt/$MNT
echo "[Mount VFAT]: /dev/$1 --> /mnt/$MNT" > /dev/console
echo "A/mnt/$1" >> /tmp/usbmnt.log
echo "A/mnt/$1" > /tmp/fifo.1
fi
else
echo "[Mount JFFS2]: /dev/$1 --> /mnt/$MNT" > /dev/console
echo "A/mnt/$1" >> /tmp/usbmnt.log
echo "A/mnt/$1" > /tmp/fifo.1
fi
fi