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