我板子的启动过程如下:
..showlogo..
Flash:
NAND:
In:
Out:
Err:
*************show logo***************Hit any key to stop autoboot:
NAND read: device 0 offset 0x900000, size 0x300000
s3c-nand: ECC uncorrectable error detected
s3c-nand: ECC uncorrectable error detected
s3c-nand: ECC uncorrectable error detected
s3c-nand: ECC uncorrectable error detected
s3c-nand: ECC uncorrectable error detected
s3c-nand: ECC uncorrectable error detected
s3c-nand: ECC uncorrectable error detected
s3c-nand: ECC uncorrectable error detected
s3c-nand: ECC uncorrectable error detected
s3c-nand: ECC uncorrectable error detected
s3c-nand: ECC uncorrectable error detected
s3c-nand: ECC uncorrectable error detected
s3c-nand: ECC uncorrectable error detected
s3c-nand: ECC uncorrectable error detected
s3c-nand: ECC uncorrectable error detected
get_format
-------- 0 --------
Wrong Image Format for bootm command
ERROR: can't get kernel image!
分析:uboot能够正常启动,但是从这句“NAND read: device 0 offset 0x900000, size 0x300000
”可以看出在nand中0x900000出开始读kernel到内存时,出错,问题应该出在这段nand中,幸亏uboot能正常启动,那就好说了,直接重新给nand分区,然后修改uboot启动后设置启动参数,就可以搞定了。
值得注意的是:nand分区在linux内核中修改,/arch/arm/plat-s3c24xx/common-smdk.c
板子原来的分区如下:
struct mtd_partition s3c_partition_info[] = {
#ifdef CONFIG_SPLIT_ROOT_FILESYSTEM
#endif
};
#endif
从上可以看出我板子的nand分区是:Bootloader
从上面可以看出,我们内核那部分空间会有部分坏块可能,所以我们要把内核空间往后移动2M空间就足够解决问题了,由于变量MTDPART_OFS_APPEND的使用,我们很好改变分区的位置和大小,我们只需要把Bootloader的空间增加2M就可以了,后面的分区就依次向后弄懂2M位置(uboot一般都很小,一般500多kb,所以后面的大部分空间就浪费了,由于nand一般都比较大,我们也就不必担心浪费的问题)。
修改后的分区应该是:
uboot再重新启动时,还要修改bootcmd:
SMDK2416 # setenv bootcmd nand read c0008000 b00000 300000\;bootm c0008000
SMDK2416 # saveenv
重新修改nand分区后,如何再进行sd卡一键烧写:
uboot分两种:一个是从sd卡启动的uboot,另一个是从nand启动的uboot;把修改过分区后的内核及其他相应文件制作一键烧写的sd卡,从sd卡启动进入uboot(此为sd的uboot),敲空格进入命令行
Helper2416 # print
bootargs=set bootargs root=/dev/mtdblock2 console=ttySAC0,115200
bootcmd=sleep 1;nand scrub ;sleep 1;nand erase;sleep 1;movi read 3800000# 40000 c0000000 ;sleep 1;nand write c0000000 0 40000;sleep 1;movi read kernel c0000000;sleep 1;nand write c0000000 900000 200000;sleep 1;movi read 3600000# 1800000 c0000000;sleep 1;nand write.yaffs c0000000 c00000 17ffac0
bootdelay=3
baudrate=115200
ethaddr=00:40:5c:26:0a:5b
ipaddr=192.168.0.20
serverip=192.168.0.100
gatewayip=192.168.0.1
netmask=255.255.255.0
nfspath=/opt/target
nfsargs=set bootargs console=ttySAC0,115200 root=/dev/nfs nfsroot=$serverip:/opt/target,tcp rw ip=$ipaddr init=/linuxrc
updateu=nfs c0000000 $serverip:$nfspath/u-boot.bin;nand erase 0 40000;nand write c0000000 0 40000
updatek=nfs c0000000 $serverip:$nfspath/zImage;nand erase 40000 200000;nand write c0000000 40000 200000
bootnand=nand read c2000000 40000 200000;bootm c2000000
stdin=serial
stdout=serial
stderr=serial
Environment size: 950/16380 bytes
就是上面那红色部分bootcmd完成了,把sd卡上的uboot、kernel、文件系统依次copy到内存中,然后再copy到nand中保存的。因为我们修改了kernel的nand分区,所以我们也要修改这部分往nand中回写部分的地址。要和内核中的nand分区对应。我的修改如下:
setenv bootcmd 'nand scrub ;sleep 1;nand erase;movi read 3800000# 40000 c0000000 ;nand write c0000000 0 40000;movi read kernel c0000000;nand write c0000000 b00000 300000;movi read 3600000# 1800000 c0000000;nand write.yaffs c0000000 e00000 17ffac0'
saveenv
然后就可以用这个sd卡进行一键烧写了。
还有就是要注意了,烧写完成后,启动还要报错:说是找不到zImage,那是因为你的nand中的uboot参数bootcmd没有修改成和内核nand分区对应的地址。