九、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驱动。。。
