• «
  • 1
  • 2
  • »
  • Pages: 1/2     Go
主题 : 求助tekkaman u-boot-2009-11 无法saveenv~(续) 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 25725
精华: 0
发帖: 24
金钱: 120 两
威望: 24 点
综合积分: 48 分
注册时间: 2010-07-28
最后登录: 2014-04-21
楼主  发表于: 2010-07-30 19:50

 求助tekkaman u-boot-2009-11 无法saveenv~(续)

描述:问题
图片:
Q2. 如今又有新问题了,还是saveenv的问题。
saveenv后,出现以下内容
erasing nand....
waring: erase size 0x00020000 smaller than a erase block 0x00040000
           erase 0x00040000 instead
NAND 1Gib 3.3V 8bit: MTD erase failure:-22

writing to NAND......FAILED!
我追踪了一下saveenv()的代码,在/common/env_nand.c中

#else /* ! CONFIG_ENV_OFFSET_REDUND */
int saveenv(void)
{
    int ret = 0;
    nand_erase_options_t nand_erase_options;

    nand_erase_options.length = CONFIG_ENV_RANGE;
    nand_erase_options.quiet = 0;
    nand_erase_options.jffs2 = 0;
    nand_erase_options.scrub = 0;
    nand_erase_options.offset = CONFIG_ENV_OFFSET;

    if (CONFIG_ENV_RANGE < CONFIG_ENV_SIZE)
        return 1;
    puts ("Erasing Nand...\n");
    if (nand_erase_opts(&nand_info[0], &nand_erase_options))
        return 1;

    puts ("Writing to Nand... ");
    if (writeenv(CONFIG_ENV_OFFSET, (u_char *) env_ptr)) {
        puts("FAILED!\n");
        return 1;
    }

    puts ("done\n");
    return ret;
}


saveenv()调用了nand_erase_opts(),产生我错误的原因就在下面这几段中。
                 if (erase_length < meminfo->erasesize) {
    printf("Warning: Erase size 0x%08lx smaller than one "    \
               "erase block 0x%08x\n",erase_length, meminfo->erasesize);
    printf("         Erasing 0x%08x instead\n", meminfo->erasesize);
        erase_length = meminfo->erasesize;


mtd_info数据结构中定义的擦除大小是nandflash的一个页(半页或是1/4页)
u_int32_t erasesize;
    /* Minimal writable flash unit size. In case of NOR flash it is 1 (even
     * though individual bits can be cleared), in case of NAND flash it is
     * one NAND page (or half, or one-fourths of it), in case of ECC-ed NOR
     * it is of ECC block size, etc. It is illegal to have writesize = 0.
     * Any driver registering a struct mtd_info must ensure a writesize of
     * 1 or larger.
     */

CONFIG_ENV_SIZE    0x20000 这个明显要比NAND Flash的页要大啊!
为什么会出现问题呢?






Q1.(已解决)我把u-boot烧到nand flash 0x0--0x60000
mkimage做的zImage.img烧到0x80000--0x500000
使用nand read 0x30008000 0x80000 0x500000;bootm可以启动内核
但是用saveenv bootcmd nand read 0x30008000 0x80000 0x500000;bootm显示
Wrong Image Format for bootm command
ERROR:can't get kernel image!

重启之后打印变量bootcmd 也没有改变
[ 此帖被turbowing在2010-08-02 19:43重新编辑 ]
级别: 侠客
UID: 6350
精华: 2
发帖: 110
金钱: 895 两
威望: 486 点
综合积分: 260 分
注册时间: 2009-05-29
最后登录: 2016-10-11
1楼  发表于: 2010-07-31 16:22
dynenv set env 先
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
2楼  发表于: 2010-07-31 16:37
但是用saveenv bootcmd nand read 0x30008000 0x80000 0x500000;bootm显示

saveenv不是这样用的,在u-boot的命令行上用"help setenv"和“help saveenv”看看正确的命令用法。
"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: 25725
精华: 0
发帖: 24
金钱: 120 两
威望: 24 点
综合积分: 48 分
注册时间: 2010-07-28
最后登录: 2014-04-21
3楼  发表于: 2010-08-01 11:57
引用第2楼kasim于2010-07-31 16:37发表的  :

saveenv不是这样用的,在u-boot的命令行上用"help setenv"和“help saveenv”看看正确的命令用法。

我setenv也是出现以上情况~
级别: 新手上路
UID: 25725
精华: 0
发帖: 24
金钱: 120 两
威望: 24 点
综合积分: 48 分
注册时间: 2010-07-28
最后登录: 2014-04-21
4楼  发表于: 2010-08-01 12:02
引用第1楼gt945于2010-07-31 16:22发表的  :
dynenv set env 先

这个dynenv set env 是什么意思~?
命令中没有dynenv
级别: 新手上路
UID: 25725
精华: 0
发帖: 24
金钱: 120 两
威望: 24 点
综合积分: 48 分
注册时间: 2010-07-28
最后登录: 2014-04-21
5楼  发表于: 2010-08-01 12:13

 回 2楼(kasim) 的帖子

我用的内核是MINI2440提供的t35内核,编译了之后,又用mkImage加了Tag的。
问题出在什么地方呢?
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
6楼  发表于: 2010-08-01 12:14
引用第3楼turbowing于2010-08-01 11:57发表的  :

我setenv也是出现以上情况~

哦,是吗?也许你应该用setenv bootcmd  'nand read 0x30008000 0x80000 0x500000; bootm'
如果你setenv成功了,用pri应该可以看到
bootcmd=nand read 0x30008000 0x80000 0x500000; bootm

setenv成功后,别忘了用savenv把环境变量保存到Flash中,否则下次开机bootcmd还是默认值
[ 此帖被kasim在2010-08-01 12:24重新编辑 ]
"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: 25725
精华: 0
发帖: 24
金钱: 120 两
威望: 24 点
综合积分: 48 分
注册时间: 2010-07-28
最后登录: 2014-04-21
7楼  发表于: 2010-08-01 12:27
引用第6楼kasim于2010-08-01 12:14发表的  :

哦,是吗?也许你应该用setenv bootcmd  'nand read 0x30008000 0x80000 0x500000; bootm'
如果你setenv成功了,用pri应该可以看到
bootcmd=nand read 0x30008000 0x80000 0x500000; bootm

.......

问题解决了~谢谢版主!
[ 此帖被turbowing在2010-08-01 13:38重新编辑 ]
级别: 新手上路
UID: 25725
精华: 0
发帖: 24
金钱: 120 两
威望: 24 点
综合积分: 48 分
注册时间: 2010-07-28
最后登录: 2014-04-21
8楼  发表于: 2010-08-02 19:46

 回 2楼(kasim) 的帖子

求大神帮忙~   
[ 此帖被turbowing在2010-08-02 20:02重新编辑 ]
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
9楼  发表于: 2010-08-02 23:02
waring: erase size 0x00020000 smaller than a erase block 0x00040000
           erase 0x00040000 instead

很明显,代码认为最小的erase单位是0x40000,因此小于这个的擦除size都会作为0x40000处理

真正致命的错误是这里
NAND 1Gib 3.3V 8bit: MTD erase failure:-22

这得靠你找出来为什么
"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."
  • «
  • 1
  • 2
  • »
  • Pages: 1/2     Go