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

2010-9-26 17:30 1807 6 6 分类: MCU/ 嵌入式

原创文章版权所有!如需转载,请注明出处: 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"

文章评论0条评论)

登录后参与讨论
我要评论
0
6
关闭 站长推荐上一条 /2 下一条