首先大家看看前一篇所写的OK6410移植linux-3.3.1
因为移植时改了板级文件,以防大家看不懂,参考一下那篇文章
切入正题,首先进入arch/arm/mach-s3c64xx/
打开mach-ok6410.c
添加头文件#include <plat/sdhci.h>
添加代码:
static struct s3c_sdhci_platdata ok6410_hsmmc0_pdata =
{
.max_width = 4,
.cd_type = S3C_SDHCI_CD_INTERNAL,
};
static struct s3c_sdhci_platdata ok6410_hsmmc1_pdata =
{
.max_width = 4,
.cd_type = S3C_SDHCI_CD_PERMANENT,
};
之后在此文件中找到static void __init ok6410_machine_init(void)函数,在此函数中添加:
s3c_sdhci0_set_platdata(&ok6410_hsmmc0_pdata);
s3c_sdhci1_set_platdata(&ok6410_hsmmc1_pdata);
然后make menuconfig
进入Device Drivers --->
<*> MMC/SD/SDIO card support --->
.......................................................................
<*> MMC block device driver
(8) Number of minors per block device
[*] Use bounce buffer for simple hosts
.........................................................................
<*> Secure Digital Host Controller Interface support
<*> SDHCI support on Samsung S3C Soc
(以上必选,其他多选会不会影响挂载我还不知道)
之后就可以编译内核了
插入SD卡提示:
mmc0: new high speed SDHC card at address 1234
mmcblk0: mmc0:1234 SA04G 3.70 GiB
mmcblk0: p1
则说明移植成功.内核已经可以识别sdcard了.
编译时还需要选择内核支持sdcard的文件系统,例如我的sdcard是FAT32格式的.
则进入File systems --->
DOS/FAT/NT Filesystems --->
...........................................................
<*> VFAT (Windows-95) fs support
...........................................................
若无自动挂载,则手动挂载,挂载命令如: mount -t vfat /dev/mmcblk0p1 /sdcard/
若挂载时出现:
FAT-fs (mmcblk0p1): codepage cp437 not found
则是内核编译时没有选上相应的字符内码列表
这时make menuconfig
进入File systems --->
Native language support --->
.......................................................................................
<*> Codepage 437 (United States, Canada)
.........................................................................................
这里的选择视错误提示而定.
好了,到这里一般都没有什么错误,可以直接挂载上了