linux挂载SD卡
(1)通过#fdisk -l命令确认板子上的linux系统是否识别SD卡
MP805M板子插入SD卡后显示
SD30 slot is without WP
mmc1: new high speed SD card at address 5bc0
mmcblk0: mmc1:5bc0 SD02G 1.83 GiB
mmcblk0: p1
[/]# fdisk -l
Disk /dev/mtdblock0: 1 MB, 1179648 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/mtdblock0 doesn't contain a valid partition table
Disk /dev/mmcblk0: 1967 MB, 1967128576 bytes
40 heads, 56 sectors/track, 1715 cylinders
Units = cylinders of 2240 * 512 = 1146880 bytes
Device Boot Start End Blocks Id System
/dev/mmcblk0p1 * 192 1716 1707008 6 FAT16
(2)确保/mnt存在
然后cat /proc/partitions
看看到底有没有mmc相关的分区
[/]# cat /proc/partitions
major minor #blocks name
31 0 1152 mtdblock0
31 1 768 mtdblock1
31 2 768 mtdblock2
31 3 7040 mtdblock3
31 4 121344 mtdblock4
179 0 1921024 mmcblk0
179 1 1707008 mmcblk0p1
没有这两个分区,就说明SD卡驱动没有移植成功
内核选项里支持
device deivers-》mmc/sd card support ->Samsung s3c sd/mmc card interface support
(3)挂载SD卡
mount /dev/mmcblk0p1 /mnt/mmc
或者
mount -t vfat /dev/mmcblk0p1/mnt/
(4)卸载SD卡
umount /mnt
注意,当前目录不能是/mnt,否则会出现“umount can't umount /mnt device or resource busy”的错误提示信息。
(5)Linux 如何上电挂载SD卡
编辑/etc/init.d/目录下的rcS文件:vi /etc/init.d/rcS
在里面加入一行:mount -t vfat /dev/mmcblk0p1 /mmc
这样上电后开发板就会自动挂载SD卡到主目录的mmc文件夹