你好,游客 登录 注册 搜索
背景:
阅读新闻

linux-2.6.30.4移植至2440开发板

[日期:2012-12-31] 来源:Linux社区  作者:ce123 [字体:大 中 小]

九、NandFlash驱动移植
linux里面已经包含NandFlash驱动,只需对源码进行修改即可。

1、$vim arch/arm/plat-s3c24xx/common-smdk.c

107 /* NAND parititon from 2.4.18-swl5*/

 108

109 static struct mtd_partitionsmdk_default_nand_part[] = {

 110#if defined(CONFIG_64MB_NAND )

111 [0] = {

 112.name = "Board_uboot",

 113.size = 0x00040000,

 114.offset = 0x00000000,

 115},

 116[1] = {

 117.name = "Board_kernel",

 118.size        = 0x00200000,

 119.offset= 0x00200000,

 120},

 121[2] = {

 122.name = "Board_yaffs2",

 123.size = 0x03BF8000,

 124.offset = 0x00400000,

 125}

 126#elif defined(CONFIG_128MB_NAND)

127 [0]={

 128.name ="Board_uboot",

 129.offset =0x00000000,

 130.size =0x00040000,

 131},

 132[1]={

 133.name ="Board_kernel",

 134.offset =0x00200000,

 135.size =0x00200000,

 136},

 137[2]={

 138.name ="Board_yaffs2"

 139.offset =0x00400000,

 140.size =0x07BA0000,

 141}

142 #elif defined(CONFIG_more_than_256MB_NAND)

143 [0]={

 144.name ="Board_uboot",

 145.offset =0x00000000,

 146.size =0x00040000,

 147},

 148[1]={

 149.name ="Board_kernel",

 150.offset =0x00200000,

 151.size =0x00200000,

 152},

 153[2]={

 154.name ="Board_yaffs2",

 155.offset =0x00400000,

 156.size =0x0FB80000,

 157}

 158#endif

 159};

2、$vimdrivers/mtd/nand/Kconfig

166 choice

 167prompt "Nand Flash Capacity select"

 168depends on MTD

 169help

 170Board Nand Flash Capacity select

 171

172 config 64MB_NAND

173 boolean "64MB Nand for Board"

 174depends on MTD

 175help

 176Set 64MB Nand parts

 177

178 config 128MB_NAND

 179boolean "128MB Nand for Board"

 180depends on MTD

 181help

 182Set 128MB Nand parts

 183

184 config more_than_256MB_NAND

 185boolean "256MB~1GB Nand for Board"

 186depends on MTD

 187help

 188Set 256MB~1GB Nand parts

 189

190 endchoice

 注:如果在make menuconfig中选中64MB_NAND,则在.config表现形式如下:

 CONFIG _64MB_NAND=y

这实际是给C源文件提供预编译变量,如#if defined(CONFIG_64MB_NAND).......

这个过程就是实现了内核的定制,比如新增Nand驱动、或者去除wireless驱动。。。

linux
相关资讯       Linux内核移植 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款