Chinaunix首页 | 论坛 | 博客
  • 博客访问: 142007
  • 博文数量: 29
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 265
  • 用 户 组: 普通用户
  • 注册时间: 2014-01-04 13:11
文章分类

全部博文(29)

文章存档

2015年(2)

2014年(27)

我的朋友

分类: 嵌入式

2014-06-26 19:06:18

一,在编译linux内核时出现make:***[.tmp_vmlinux1] Error 1这类错误

解决方法:修改arch/arm/kernel/vmlinux.lds
[arm@localhost linux2.6.14]$
vi arch/arm/kernel/vmlinux.lds
将文件尾2条的ASSERT注释掉(1439行)
/* ASSERT((__proc_info_end __
proc_info_begin), "missing CPU support") */
/* ASSERT((__arch_info_end __
arch_info_begin), "no machine record defined") */
然后重新make zImage即可
二,使用mini2440带的Linux2.6.32 使用u-boot 1.3.4引导时候无法启动内核,一直停留在
Uncompressing Linux..................................................................................................................................................... done, booting the kernel.
出现这个现象的原因有三个:

1.u-boot中的频率与kernel中CPU频率的设置不一样,kernel中设置的过高,使程序跑飞。

2.mach_type值不一致。u-boot中的mach_type值与kernel中的不一致,导致这个问题。

3.启动的时候,串口参数设置有问题。


我的问题是第2个大原因。

去arch/arm/mach-s3c2440/mach-mini2440.c 查看下面这个结构体:
MACHINE_START(MINI2440, "MINI2440")
/* Maintainer: Michel Pollet */
.phys_io        = S3C2410_PA_UART,
.io_pg_offst    = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
.boot_params    = S3C2410_SDRAM_PA + 0x100,
.map_io         = mini2440_map_io,
.init_machine   = mini2440_init,
.init_irq       = s3c24xx_init_irq,
.timer          = &s3c24xx_timer,
MACHINE_END

问题就是出在第一行的MINI2440,因为这个宏定义扩展之后的machine type 就成了 MACHINE_TYPE_MINI2440, 而我在u-boot定义的是MACHINE_TYPE_S3C2440,因此不匹配导致内核不识别死在这里了。

将MINI2440改成S3C2440后内核成功起来

三,
在编译内核的时候,提示如下错误:
  1. dingq@wd-u1110:~/hwsvn/2sw/1prj_linux/pdu/kernel/linux-2.6.30$ make menuconfig  
  2.  *** Unable to find the ncurses libraries or the  
  3.  *** required header files.  
  4.  *** 'make menuconfig' requires the ncurses libraries.  
  5.  ***   
  6.  *** Install ncurses (ncurses-devel) and try again.  
  7.  ***   
  8. make[1]: *** [scripts/kconfig/dochecklxdialog] Error 1  
  9. make: *** [menuconfig] Error 2  
看到说只要安装libncurses5-dev就够了。
  1. sudo apt-get install libncurses5-dev  
四,在设置nand分区时,产生的错误
此时执行 make zImage 会报错如下:
  1. CHK include/linux/version.h
  2. make[1]: `include/asm-arm/mach-types.h' is up to date.
  3.   CHK include/linux/utsrelease.h
  4.   SYMLINK include/asm -> include/asm-arm
  5.   CALL scripts/checksyscalls.sh
  6.   CHK include/linux/compile.h
  7.   CC arch/arm/mach-s3c2440/mach-mini2440.o
  8. arch/arm/mach-s3c2440/mach-mini2440.c:49: error: array type has incomplete element type
  9. arch/arm/mach-s3c2440/mach-mini2440.c:50: error: array index in non-array initializer
  10. arch/arm/mach-s3c2440/mach-mini2440.c:50: error: (near initialization for 'mini2440_default_nand_part')
  11. arch/arm/mach-s3c2440/mach-mini2440.c:51: error: field name not in record or union initializer
  12. arch/arm/mach-s3c2440/mach-mini2440.c:51: error: (near initialization for 'mini2440_default_nand_part')
  13. arch/arm/mach-s3c2440/mach-mini2440.c:52: error: field name not in record or union initializer
这是因为缺少以下头文件:
  1. #include <linux/mtd/mtd.h>
  2. #include <linux/mtd/nand.h>
  3. #include <linux/mtd/nand_ecc.h>
  4. #include <linux/mtd/partitions.h>
  5. #include <plat/nand.h>
加入重新编译,生成arch/arm/boot/zImage,下载至板子,重新启动,结果产生kernel panic如下:
  1. S3C24XX NAND Driver, (c) 2004 Simtec Electronics 
  2. s3c24xx-nand s3c2440-nand: Tacls=4, 39ns Twrph0=8 79ns, Twrph1=8 79ns 
  3. Unable to handle kernel NULL pointer dereference at virtual address 00000018 
  4. pgd = c0004000 
  5. [00000018] *pgd=00000000 
  6. Internal error: Oops: 5 [#1] 
  7. last sysfs file: 
  8. Modules linked in: 
  9. CPU: 0 Not tainted (2.6.32 #2) 
  10. PC is at s3c24xx_nand_probe+0x2d8/0x514 
  11. LR is at s3c24xx_nand_probe+0x1a4/0x514 
  12. pc : [<c01d9d44>] lr : [<c01d9c10>] psr: 60000013 
  13. sp : c3823f08 ip : 00000000 fp : 00000001 
  14. r10: 00000000 r9 : 00000000 r8 : 00000000 
  15. r7 : c03cf388 r6 : 00000000 r5 : c39b68c0 r4 : c3895800 
  16. r3 : 00000001 r2 : c3895988 r1 : c4c00000 r0 : 00000002 
  17. Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel 
  18. Control: c000717f Table: 30004000 DAC: 00000017 
  19. Process swapper (pid: 1, stack limit = 0xc3822270) 
  20. Stack: (0xc3823f08 to 0xc3824000)
红色的内容说明我们更改的nand驱动参数根本就没有生效,分析Linux内核中的nand flash驱动drivers/mtd/nand/s3c2410.c文件中的相应函数,
其中的static int s3c2410_nand_setrate(struct s3c2410_nand_info *info)函数发现:
  1. struct s3c2410_platform_nand *plat = info->platform;
  2.         int tacls_max = (info->cpu_type == TYPE_S3C2412) ? 8 : 4; 
  3.          …………
  4.     info->clk_rate = clkrate;
  5.         clkrate /= 1000; /* turn clock into kHz for ease of use */

  6.         if (plat != NULL) {
  7.                 tacls = s3c_nand_calc_rate(plat->tacls, clkrate, tacls_max);
  8.                 twrph0 = s3c_nand_calc_rate(plat->twrph0, clkrate, 8);
  9.                 twrph1 = s3c_nand_calc_rate(plat->twrph1, clkrate, 8);
  10.         } else { 
  11.           /* default timings */
  12.                 tacls = tacls_max;
  13.                 twrph0 = 8;
  14.                 twrph1 = 8; 
  15.             }

  16.         if (tacls < 0 || twrph0 < 0 || twrph1 < 0) {
  17.                 dev_err(info->device, "cannot get suitable timings\n");
  18.                 return -EINVAL;
  19.         }

  20.         dev_info(info->device, "Tacls=%d, %dns Twrph0=%d %dns, Twrph1=%d %dns\n",
  21.                tacls, to_ns(tacls, clkrate), twrph0, to_ns(twrph0, clkrate), twrph1, to_ns(twrph1, clkrate));
由以上内容可以看出,你的内核并没有使用你的mini2440_nand_info结构体中的配置,而是使用了它的默认配给,即
else {      
          /* default timings */
                tacls = tacls_max;
                twrph0 = 8;
                twrph1 = 8;
      
            }
中的配置信息。这点和你的内核输出s3c24xx-nand s3c2440-nand: Tacls=4, 39ns Twrph0=8 79ns, Twrph1=8 79ns完全符合

解决方法:只需在mach-mini2440.c的初始化函数mini2440_machine_init(void)里加入
  1. s3c_device_nand.dev.platform_data=&mini2440_nand_info;



阅读(3269) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~