主题 : 能不能把uImage下载到nand flash中? 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 83108
精华: 0
发帖: 9
金钱: 45 两
威望: 9 点
综合积分: 18 分
注册时间: 2012-12-02
最后登录: 2013-05-25
楼主  发表于: 2012-12-03 21:56

 能不能把uImage下载到nand flash中?

为了实验方便,我采用NFS根文件系统,但每次断电后,又得重新下载uImage,这样觉得太麻烦了,请问各位大侠,能不能把uImage下载到nand flash中,在启动的时候用
nand read.i c0008000 80000 500000;bootm c0008000将uImage读回,再bootm c0008000启动。
我的步骤如下:
MINI6410 #tftp c0008000 uImage
MINI6410 # nand write c0008000 80000 500000
NAND write: device 0 offset 0x80000, size 0x500000
327680 bytes written: OK
MINI6410 # saveenv
Saving Environment to NAND...
Writing to Nand...//最后停在这里就不动了,请问各位,这是什么原因呢?
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
1楼  发表于: 2012-12-03 23:19

 回 楼主(放牛那娃进城) 的帖子

1. 不管你用什么文件系统,你都可以把uImage保存在NAND Flash中;
2. 从你的出错信息看,问题似乎出在common/env_nand.c里的FriendlyARMWriteNand()函数里。
另外,你似乎只指定了写入0x50000(327680)字节大小的uImage,正确的做法应该是nand write c0008000 8000 ${filesize}. 其中${filesize}在运行时会替换为实际下载的文件大小。
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 83108
精华: 0
发帖: 9
金钱: 45 两
威望: 9 点
综合积分: 18 分
注册时间: 2012-12-02
最后登录: 2013-05-25
2楼  发表于: 2012-12-04 22:00
多谢版主赐教,我把${filesize}修改成实际uImage的大小,问题还是一样的。
版主能否详细说一下将uImage下载到nand flash中的步骤?
谢谢!
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
3楼  发表于: 2012-12-04 22:49

 回 2楼(放牛那娃进城) 的帖子

我不觉得你的步骤有问题。事实上,如果你用${filesize}的话,你应该已经把uImage写入NAND了。
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 83108
精华: 0
发帖: 9
金钱: 45 两
威望: 9 点
综合积分: 18 分
注册时间: 2012-12-02
最后登录: 2013-05-25
4楼  发表于: 2012-12-05 21:29

 回 3楼(kasim) 的帖子

但还是保存不了,我要的是下次启动的时候,不要再重新下载uImage.
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
5楼  发表于: 2012-12-05 23:14

 回 4楼(放牛那娃进城) 的帖子

如果在nand write之后再用nand read读回来,读出来的数据和原来的uImage一致吗?
另外,你用的是什么版本的u-boot, 能把启动时候的log贴出来吗?
[ 此帖被kasim在2012-12-05 23:19重新编辑 ]
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 83108
精华: 0
发帖: 9
金钱: 45 两
威望: 9 点
综合积分: 18 分
注册时间: 2012-12-02
最后登录: 2013-05-25
6楼  发表于: 2012-12-06 21:51
##### FriendlyARM U-Boot(2011-07, NAND) for 6410 #####
[f] Format the nand flash
[v] Download u-boot.bin
[k] Download Linux/Android kernel
[y] Download root yaffs2 image
Download root ubifs image
[a] Download Absolute User Application
[n] Download Nboot.nb0 for WinCE
[w] Download WinCE NK.nb0
[s] Set the boot parameter of Linux
Boot Linux
[q] Quit to shell
NAND(MLC2): 2048 MiB, RAM: 256 MiB
LCD type, firmware version: 1 1046
Enter your Selection:q
Caution: any nand write command may damage your data. DON'T use them
MINI6410 # printenv
bootcmd=nand read.i c0008000 80000 500000;bootm c0008000
bootdelay=3
baudrate=115200
ethaddr=08:90:90:90:90:90
ipaddr=192.168.1.230
gatewayip=192.168.1.1
netmask=255.255.255.0
serverip=192.168.1.102
bootargs=root=/dev/nfs nfsroot=192.168.1.102:/home/rootfs,rsize=1500,wsize=1500
ip=192.168.1.230:192.168.1.102:192.168.1.1:255.255.255.0 console=ttySAC0,115200
mem=64M
stdin=serial
stdout=serial
stderr=serial

Environment size: 408/131068 bytes
MINI6410 # tftp c0008000 uImage
MINI6410 # nand write c0008000 80000 50000
...
MINI6410 # nand read c0008000 80000 50000
NAND read: device 0 offset 0x80000, size 0x500000//停在这里就不动了,我买的是tiny6410的开发板。
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
7楼  发表于: 2012-12-06 22:46

##### FriendlyARM U-Boot(2011-07, NAND) for 6410 #####
...
NAND(MLC2): 2048 MiB, RAM: 256 MiB
...
Caution: any nand write command may damage your data. DON'T use them

从tiny6410的软件更新记录(http://www.aiothome.net/read.php?tid-13500.html)看,在2011-11-16版本之后才加入了对MLC2 NAND读写的支持,也许你需要更到最新版的u-boot再试一下

U-boot更新:
增加支持MLC2 NAND Flash的常见操作指令:
     - read
     - write
     - dump
     - bad
     - erase
等等。
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 83108
精华: 0
发帖: 9
金钱: 45 两
威望: 9 点
综合积分: 18 分
注册时间: 2012-12-02
最后登录: 2013-05-25
8楼  发表于: 2012-12-10 20:38
多谢版主,重新下载了uboot,问题解决了!