u-boot-2010.03在tq6410上的移植详解(五)

原创文章版权所有!如需转载,请注明出处: http://hi.baidu.com/liushuiyue1/myhome 谢谢合作!!!!!

七. Uboot 支持 yaffs2 文件的读写

       由于 Uboot 本身支持 yaffs2 文件的读写直接修改 ./include/configs/smdk6410.h 的配置文件,使得 uboot 支持 yaffs2 的读写,重新编译 Uboot 并下载到 Nand Flash 中,串口打印信息如下, uboot 已经支持 yaffs2 烧写到 nand flash (由于本人对于此 uboot 中指令不熟悉,所以至今还未写 yaffs2 文件成功,如有知道的可告知,谢谢)。

于是又重新手动 yaffs2 文件的烧写指令。首先修改 ./include/configs/smdk6410.h

#cd include/configs/smdk6410.h //

#define CONFIG_YAFFS2

 

于是又重新手动 yaffs2 文件的烧写指令。

1)       修改 ./include/configs/smdk6410.h

注意一定要屏蔽掉 CONFIG_YAFFS2 ,否则 yaffs 文件读写有冲突。

#cd include/configs/smdk6410.h //

//#define CONFIG_YAFFS2

#define CONFIG_SYS_NAND_YAFFS_WRITE     1 /* support yaffs write    EN       */

#define CONFIG_MTD_NAND_ECC_YAFFS 1

2) 修改 common/cmd_nand.c

373 行,红色字体为添加部分

if (!s || !strcmp(s, ".jffs2") ||

                 !strcmp(s, ".e") || !strcmp(s, ".i")) {

                    if (read)

                           ret = nand_read_skip_bad(nand, off, &size,

                                                (u_char *)addr);

                    else

                           ret = nand_write_skip_bad(nand, off, &size,

                                                (u_char *)addr);

             }

              #if defined(ENABLE_CMD_NAND_YAFFS)

              }else if ( s != NULL &&

                     (!strcmp(s, ".yaffs") || !strcmp(s, ".yaffs1"))){

                         if(read) {

                            printf("nand read.yaffs[1] is not provide temporarily!");

                         } else    {

                            nand->rw_oob = 1;

#if defined(ENABLE_CMD_NAND_YAFFS_SKIPFB)

                            nand->skipfirstblk = 1;

#else

                            nand->skipfirstblk = 0;

#endif

                            ret = nand_write_skip_bad(nand,off,&size,(u_char *)addr);

#if defined(ENABLE_CMD_NAND_YAFFS_SKIPFB)

                            nand->skipfirstblk = 0;

#endif

                            nand->rw_oob = 0;

                         }

#endif

}           

             else if (!strcmp(s, ".oob")) {

                    /* out-of-band data */

                    mtd_oob_ops_t ops = {

                           .oobbuf = (u8 *)addr,

                           .ooblen = size,

                           .mode = MTD_OOB_RAW

                    };

505 行添加,红色字体为添加部分

"nand erase [clean] [off size] - erase 'size' bytes from/n"

      "    offset 'off' (entire device if not specified)/n"

      #if defined(CONFIG_SYS_NAND_YAFFS_WRITE)

      "nand read[.yaffs[1]] is not provide temporarily/n"

      "nand write[.yaffs[1]] addr off size -write the 'size' byte yaffs image starting/n"

      "at offset 'off' from memory address 'addr' (.yaffs for 512+16 Nand)"

      #endif

      "nand bad - show bad blocks/n"

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值