- 积分
- 28
贡献70
飞刀0 FD
注册时间2013-3-13
在线时间7 小时
扫一扫,手机访问本帖
|
hi all
使用OK6410A开发板,使用原厂提供的uboot image。在uboot下通过tftp命令将更新的uboot image镜像下载到内存中,然后nand erase擦除nand flash中原始uboot分区内容,最后通过nand write.uboot命令将内存中的新uboot image镜像烧写到nand flash中。以上操纵能够实现在uboot下直接更新uboot镜像。查看了原厂提供的uboot1.1.6源码,关于这部分的nand flash操作,代码如下:
else if (!read && s != NULL && (!strcmp(s, ".uboot")) && nand->writesize == 4096) {
size=4096;
nand_write(nand, off, &size, (u_char *)addr);
off+=4096;
addr+=2048;
nand_write(nand, off, &size, (u_char *)addr);
off+=4096;
addr+=2048;
nand_write(nand, off, &size, (u_char *)addr);
off+=4096;
addr+=2048;
nand_write(nand, off, &size, (u_char *)addr);
off+=4096;
addr+=2048;
size=1024*1024-4*4096;
ret = nand_write(nand, off, &size, (u_char *)addr);
}else if(!read && s != NULL && (!strcmp(s, ".uboot")) && nand->writesize == 8192)
{
size=8192;
ret=nand_write(nand, off, &size, (u_char *)addr);
off+=8192;
addr+=2048;
ret=nand_write(nand, off, &size, (u_char *)addr);
off+=8192;
addr+=2048;
ret=nand_write(nand, off, &size, (u_char *)addr);
off+=8192;
addr+=2048;
ret=nand_write(nand, off, &size, (u_char *)addr);
off+=8192;
addr+=2048;
size=1024*1024-4*8192;
ret = nand_write(nand, off, &size, (u_char *)addr);
}
对于上述代码的操作,不清楚该代码为什么要这么做?难道是s3c6410芯片对于nand flash的操作比较特殊?addr为什么是2048?直接使用nand write命令从内存中将新的uboot image镜像烧写到nand flash中,可以吗?这个方法实际操作是失败的,烧写后uboot无法启动。对于以上问题,希望能够给以解答,谢谢!
|
|