2012年(9)
分类: LINUX
2012-04-19 07:55:59
mini2440 nandflash驱动移植
今日根据《Mini2440_Linux移植开发实战指南》一文进行nandflash驱动
的移植出现了不少问题。不知道是我操作失误还是该文编写出现错漏导致的。
首先按照步骤修改相关信息之后执行make zImage出现了不少错误:
其中有代表性的错误如下:
arch/arm/mach-s3c2440/mach-mini2440.c:152: error: array type has incomplete element type
arch/arm/mach-s3c2440/mach-mini2440.c:153: error: array index in non-array initializer
arch/arm/mach-s3c2440/mach-mini2440.c:153: error: (near initialization for 'mini2440_default_nand_part')
arch/arm/mach-s3c2440/mach-mini2440.c:154: error: field name not in record or union initializer
arch/arm/mach-s3c2440/mach-mini2440.c:154: error: (near initialization for 'mini2440_default_nand_part')
arch/arm/mach-s3c2440/mach-mini2440.c:155: error: field name not in record or union initializer
arch/arm/mach-s3c2440/mach-mini2440.c:155: error: (near initialization for 'mini2440_default_nand_part')
arch/arm/mach-s3c2440/mach-mini2440.c:156: error: field name not in record or union initializer
arch/arm/mach-s3c2440/mach-mini2440.c:156: error: (near initialization for 'mini2440_default_nand_part')
arch/arm/mach-s3c2440/mach-mini2440.c:158: error: array index in non-array initializer
arch/arm/mach-s3c2440/mach-mini2440.c:158: error: (near initialization for 'mini2440_default_nand_part')
arch/arm/mach-s3c2440/mach-mini2440.c:159: error: field name not in record or union initializer
arch/arm/mach-s3c2440/mach-mini2440.c:159: error: (near initialization for 'mini2440_default_nand_part')
arch/arm/mach-s3c2440/mach-mini2440.c:160: error: field name not in record or union initializer
arch/arm/mach-s3c2440/mach-mini2440.c:160: error: (near initialization for 'mini2440_default_nand_part')
arch/arm/mach-s3c2440/mach-mini2440.c:161: error: field name not in record or union initializer
arch/arm/mach-s3c2440/mach-mini2440.c:161: error: (near initialization for 'mini2440_default_nand_part')
arch/arm/mach-s3c2440/mach-mini2440.c:163: error: array index in non-array initializer
arch/arm/mach-s3c2440/mach-mini2440.c:163: error: (near initialization for 'mini2440_default_nand_part')
arch/arm/mach-s3c2440/mach-mini2440.c:164: error: field name not in record or union initializer
arch/arm/mach-s3c2440/mach-mini2440.c:164: error: (near initialization for 'mini2440_default_nand_part')
arch/arm/mach-s3c2440/mach-mini2440.c:165: error: field name not in record or union initializer
arch/arm/mach-s3c2440/mach-mini2440.c:165: error: (near initialization for 'mini2440_default_nand_part')
arch/arm/mach-s3c2440/mach-mini2440.c:166: error: field name not in record or union initializer
arch/arm/mach-s3c2440/mach-mini2440.c:166: error: (near initialization for 'mini2440_default_nand_part')
arch/arm/mach-s3c2440/mach-mini2440.c:168: error: array index in non-array initializer
arch/arm/mach-s3c2440/mach-mini2440.c:168: error: (near initialization for 'mini2440_default_nand_part')
arch/arm/mach-s3c2440/mach-mini2440.c:169: error: field name not in record or union initializer
arch/arm/mach-s3c2440/mach-mini2440.c:169: error: (near initialization for 'mini2440_default_nand_part')
arch/arm/mach-s3c2440/mach-mini2440.c:170: error: field name not in record or union initializer
arch/arm/mach-s3c2440/mach-mini2440.c:170: error: (near initialization for 'mini2440_default_nand_part')
arch/arm/mach-s3c2440/mach-mini2440.c:171: error: field name not in record or union initializer
arch/arm/mach-s3c2440/mach-mini2440.c:171: error: (near initialization for 'mini2440_default_nand_part')
arch/arm/mach-s3c2440/mach-mini2440.c:173: error: array index in non-array initializer
arch/arm/mach-s3c2440/mach-mini2440.c:173: error: (near initialization for 'mini2440_default_nand_part')
arch/arm/mach-s3c2440/mach-mini2440.c:174: error: field name not in record or union initializer
arch/arm/mach-s3c2440/mach-mini2440.c:174: error: (near initialization for 'mini2440_default_nand_part')
arch/arm/mach-s3c2440/mach-mini2440.c:175: error: field name not in record or union initializer
arch/arm/mach-s3c2440/mach-mini2440.c:175: error: (near initialization for 'mini2440_default_nand_part')
arch/arm/mach-s3c2440/mach-mini2440.c:176: error: field name not in record or union initializer
arch/arm/mach-s3c2440/mach-mini2440.c:176: error: (near initialization for 'mini2440_default_nand_part')
arch/arm/mach-s3c2440/mach-mini2440.c:180: error: array type has incomplete element type
arch/arm/mach-s3c2440/mach-mini2440.c:181: error: array index in non-array initializer
arch/arm/mach-s3c2440/mach-mini2440.c:181: error: (near initialization for 'mini2440_nand_sets')
arch/arm/mach-s3c2440/mach-mini2440.c:182: error: field name not in record or union initializer
arch/arm/mach-s3c2440/mach-mini2440.c:182: error: (near initialization for 'mini2440_nand_sets')
arch/arm/mach-s3c2440/mach-mini2440.c:183: error: field name not in record or union initializer
arch/arm/mach-s3c2440/mach-mini2440.c:183: error: (near initialization for 'mini2440_nand_sets')
arch/arm/mach-s3c2440/mach-mini2440.c:184: error: field name not in record or union initializer
arch/arm/mach-s3c2440/mach-mini2440.c:184: error: (near initialization for 'mini2440_nand_sets')
arch/arm/mach-s3c2440/mach-mini2440.c:184: warning: type defaults to 'int' in declaration of 'type name'
arch/arm/mach-s3c2440/mach-mini2440.c:184: warning: type defaults to 'int' in declaration of 'type name'
arch/arm/mach-s3c2440/mach-mini2440.c:184: error: negative width in bit-field '
arch/arm/mach-s3c2440/mach-mini2440.c:185: error: field name not in record or union initializer
arch/arm/mach-s3c2440/mach-mini2440.c:185: error: (near initialization for 'mini2440_nand_sets')
arch/arm/mach-s3c2440/mach-mini2440.c:193: error: variable 'mini2440_nand_info' has initializer but incomplete type
arch/arm/mach-s3c2440/mach-mini2440.c:194: error: unknown field 'tacls' specified in initializer
arch/arm/mach-s3c2440/mach-mini2440.c:194: warning: excess elements in struct initializer
arch/arm/mach-s3c2440/mach-mini2440.c:194: warning: (near initialization for 'mini2440_nand_info')
arch/arm/mach-s3c2440/mach-mini2440.c:195: error: unknown field 'twrph0' specified in initializer
arch/arm/mach-s3c2440/mach-mini2440.c:195: warning: excess elements in struct initializer
arch/arm/mach-s3c2440/mach-mini2440.c:195: warning: (near initialization for 'mini2440_nand_info')
arch/arm/mach-s3c2440/mach-mini2440.c:196: error: unknown field 'twrph1' specified in initializer
arch/arm/mach-s3c2440/mach-mini2440.c:196: warning: excess elements in struct initializer
arch/arm/mach-s3c2440/mach-mini2440.c:196: warning: (near initialization for 'mini2440_nand_info')
arch/arm/mach-s3c2440/mach-mini2440.c:197: error: unknown field 'nr_sets' specified in initializer
arch/arm/mach-s3c2440/mach-mini2440.c:197: warning: type defaults to 'int' in declaration of 'type name'
arch/arm/mach-s3c2440/mach-mini2440.c:197: warning: type defaults to 'int' in declaration of 'type name'
arch/arm/mach-s3c2440/mach-mini2440.c:197: error: negative width in bit-field '
arch/arm/mach-s3c2440/mach-mini2440.c:197: warning: excess elements in struct initializer
arch/arm/mach-s3c2440/mach-mini2440.c:197: warning: (near initialization for 'mini2440_nand_info')
arch/arm/mach-s3c2440/mach-mini2440.c:198: error: unknown field 'sets' specified in initializer
arch/arm/mach-s3c2440/mach-mini2440.c:198: warning: excess elements in struct initializer
arch/arm/mach-s3c2440/mach-mini2440.c:198: warning: (near initialization for 'mini2440_nand_info')
arch/arm/mach-s3c2440/mach-mini2440.c:199: error: unknown field 'ignore_unset_ecc' specified in initializer
arch/arm/mach-s3c2440/mach-mini2440.c:199: warning: excess elements in struct initializer
arch/arm/mach-s3c2440/mach-mini2440.c:199: warning: (near initialization for 'mini2440_nand_info')
make[1]: *** [arch/arm/mach-s3c2440/mach-mini2440.o] Error 1
make: *** [arch/arm/mach-s3c2440] Error 2
对比原来2.6.32内核中外国爱好者编写的mach-mini2440.c
文件,隐约知道是头文件的问题。
于是在自己的mach-mini2440.c中加入
#include
#include
#include
#include
#include
果然make过了,不过仍然有一行warning:
arch/arm/mach-s3c2440/mach-mini2440.c:233: warning: 'mini2440_nand_info' defined but not used
把生成的zImage下载到板子上运行,也没有出现该文中所描述的情形,初步估计还是移植失败
看来该文漏洞不少,这次不得不依靠网上的高手了。
warning: 'mini2440_nand_info' defined but not used
终于还是解决了,在这个函数
static void __init mini2440_map_io(void)
{
}
中加入以下代码:
s3c_device_nand.dev.platform_data = &mini2440_nand_info;
再次make zImage,没有再出现warning,下载到板子, 成功出现了nand flash的分区信息。 当然网上还有所谓的"石器时代"的移植方法,迟下再试,毕竟这里头很多内在原理还是没搞明白的。当下先对文件系统的移植作个了解,过一阵子再回过头来详细分析。我对这两天的移植有2个感受:一是"尽信书不如无书",二是不学一些原始的方法,单是站在巨人的肩上去开发是学不透彻的,虽然移植成功但是还是糊里糊涂。。。。。。