ImageVerifierCode 换一换
格式:DOCX , 页数:16 ,大小:43.69KB ,
资源ID:26502177      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/26502177.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(arm9uboot移植.docx)为本站会员(b****7)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

arm9uboot移植.docx

1、arm9uboot移植Uboot移植目录目录 I1. uboot移植 11.1. 4.3.2版本交叉编译工具 11.2. 加入atmel芯片支持 11.3. 增加对大页nandflash支持 21.4. 修改ether.c增加网络支持 71.5. 修改启动命令和网络参数设置 71.6. 加快断开网络时系统启动速度 81.7. 编译uboot 81. uboot移植EP63平台uboot1.2.0挂载用户文件系统yaffs2时存在bug,挂载的镜像内容为空,只能采用从ramdisk文件系统中复制用户文件的方式。该bug的主要原因是移植uboot1.2.0增加对nandflash读写时不支持大页n

2、andflash。而uboot1.2.0对大页nandflash支持的资料比较少,鉴于此移植uboot1.3.4,增加对大页nandflash的正确读写。支持更多的命令,如支持nandcrube、上下键盘命令等。1.1. 4.3.2版本交叉编译工具uboot1.2.0选用3.4.1版本的arm-linux-gcc编译,uboot1.3.4选用4.3.2版本的编译。否则编译通不过。修改/etc/bashrc,注释掉3.4.1版本的交叉编译器,增加4.3.2版本的交叉器。下载arm-linux-gcc-4.3.2.tgz然后在根目录下解压。解压后把4.3.2的交叉编译路径加入环境变量如下:PATH

3、=$PATH:/usr/local/arm/4.3.2/bin#PATH=$PATH:/usr/local/arm/3.4.1/bin使刚才的修改生效source /etc/bashrc。这样修改后就不需要重启系统,4.3.2版本的交叉编译工具就可以生效。1.2. 加入atmel芯片支持下载uboot源码和补丁:rootemboard:/xiaoyj/uboot# lsu-boot-1.3.4-exp.3.diff u-boot-1.3.4.tar.bz解压打入atmel芯片补丁rootemboard:/xiaoyj/uboot# tar -xjvf u-boot-1.3.4.tar.bz2r

4、ootemboard:/xiaoyj/uboot# lsu-boot-1.3.4 u-boot-1.3.4-exp.3.diff u-boot-1.3.4.tar.bz2进入u-boot-1.3.4目录:将补丁复制到u-boot-1.3.4目录里:rootemboard:/xiaoyj/uboot/ u-boot-1.3.4# cp ./u-boot-1.3.4-exp.3.diff打入atmel的补丁并清除以前的配置选项:rootemboard:/xiaoyj/uboot/ u-boot-1.3.4# cat u-boot-1.3.4-exp.3.diff | patch -p1rootem

5、board:/xiaoyj/uboot/ u-boot-1.3.4# make distclean 采用从nandflash启动,增加nandflash配置选项:rootemboard:/xiaoyj/uboot/ u-boot-1.3.4# make at91sam9260ek_nandflash_config . with environment variable in NAND FLASHConfiguring for at91sam9260ek board.1.3. 增加对大页nandflash支持修改u-boot-1.3.4/commn/cmd_nand.c在第12行,#includ

6、e 之后增加读写yaffs配置 #include #ifndef CFG_NAND_WRITE_YAFFS / added begin#define CFG_NAND_WRITE_YAFFS#endif /added end然后增加yaffs2文件系统读写支持,关键是了解yaffs2中64bytes OOB区中的数据组织结构:1) OOB最前端的2bytes为0xFF 0xFF,用于标识为非坏块。2) 每256bytes的数据需要3bytes的ECC校验,因此2K的数据需要24bytes的ECC校验。修改如下:在else printf(offset 0x%lx, size 0x%xn, *of

7、f, *size); return 0;之后,第159行增加如下代码:#ifdef CFG_NAND_WRITE_YAFFS / xiaoyj added begin/* * Write a yaffs filesystem image to NAND. * * If yaffs flag is 1, then the image is assumed to have been * generated by yaffs2/utils/mkyaffsimage.c, and only * 512B block + 16B OOB NAND is supported using the YAFFS

8、1 OOB layout. * * Otherwise, the image is assumed to have been generated by * yaffs2/utils/mkyaffs2image.c with Sergey Kubushyns patch applied * and supports larger 2KB block + 64B OOB NAND. * * Only MTD generated ECC is supported. * * Loosely based on mtd/util/nandwrite.c. */static struct nand_oobi

9、nfo yaffs1_oobinfo = .useecc = MTD_NANDECC_AUTOPLACE, .eccbytes = 6, .eccpos = 0, 1, 2, 3, 6, 7, .oobfree = 8, 8 ,;static struct nand_oobinfo yaffs2_oobinfo = .useecc = MTD_NANDECC_AUTOPLACE, .eccbytes = 24, .eccpos = 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60

10、, 61, 62, 63, .oobfree = 2, 38 ;static unsigned char ffchars = 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 16 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 32 */ 0xff, 0xff, 0xff, 0xff, 0xf

11、f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 48 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 64 */;static int nand_write_yaffs(nand_info_t *nand, ulong off, size_t *size, u_char *image, int yaffs) int imglen, pagelen

12、; u_char *imgptr, *oobptr; int ret; size_t retlen; int i; struct nand_oobinfo old_oobinfo; imglen = *size; imgptr = image; *size = 0; /* Make sure device page sizes are valid */ if (yaffs = 1 & !(nand-oobsize = 16 & nand-oobblock = 512) | (yaffs = 2 & !(nand-oobsize = 64 & nand-oobblock = 2048) prin

13、tf(Unsupported flash layoutn); return 1; /* update oobinfo for yaffs */ old_oobinfo = nand-oobinfo; nand-oobinfo = yaffs = 1 ? yaffs1_oobinfo : yaffs2_oobinfo; /* Check, if image is pagealigned */ pagelen = nand-oobblock + nand-oobsize; if (off % nand-erasesize) != 0 | (imglen % pagelen) != 0) print

14、f (Input image is not page alignedn); goto closeall; /* Check, if length fits into device */ if ( (imglen / pagelen) * nand-oobblock) (nand-size - off) printf (Input image does not fit into device); goto closeall; /* Get data from input and write to the device */ while (imglen 0 & (off size) /* if s

15、tart of eraseblock, check for bad block */ if (off % nand-erasesize = 0 & (nand-block_isbad)(nand, off) printf (Bad block at 0x%08lx, will be skippedn, off); off += nand-erasesize; continue; oobptr = imgptr + nand-oobblock; /* Write OOB data first, as ecc will be placed in there */ memset(ffchars, 0

16、xff, nand-oobsize); if(1 = yaffs) ffchars15 = oobptr12; ffchars14 = oobptr11; ffchars13 = oobptr7 & 0x3f; ffchars13|= (oobptr4 = 0 ? 0 : 0x40); ffchars13|= (oobptr5 = Y ? 0 : 0x80); ffchars12 = oobptr6; ffchars11 = oobptr3; ffchars10 = oobptr2; ffchars9 = oobptr1; ffchars8 = oobptr0; else memcpy(ffc

17、hars+(nand-oobinfo).oobfree)00,oobptr,(nand-oobinfo).oobfree)01); ret = (nand-write_oob)(nand, off, nand-oobsize, &retlen, ffchars); if (ret != 0) printf(nNAND OOB write error %d at block 0x%08lxn, ret, off); goto closeall; /* Write out the Page data */ ret = (nand-write)(nand, off, nand-oobblock, &

18、retlen, imgptr); if (ret != 0) printf(nNAND write error %d at block 0x%08lxn, ret, off); goto closeall; imgptr += pagelen; imglen -= pagelen; off += nand-oobblock; closeall: nand-oobinfo = old_oobinfo; *size = imgptr - image; if (imglen 0) printf(Data did not fit into device, due to bad blocksn); re

19、turn 1; return 0;#endif /* CFG_NAND_WRITE_YAFFS */ / xiaoyj added end修改第421行,修正在执行nand scrub命令擦除nandflash时异常退出的bug。 if (scrub) #if 0 / changed begin puts(Warning: scrub option will erase all factory set bad blocks!n There is no reliable way to recover them.n Use this command only for testing purpose

20、s if youn are sure of what you are doing!n nReally scrub this NAND flash? n); if (getc() = y & getc() = r) opts.scrub = 1; else puts(scrub abortedn); return -1; #else puts(Warning: scrub option will erase all factory set bad blocks!n There is no reliable way to recover them.n Use this command only f

21、or testing purposes if youn are sure of what you are doing!n nReally scrub this NAND flash? n n n-y-n n); opts.scrub = 1; #endif / changeded end 修改第316行,采用大页nandflash,2KB block + 64B OOB NAND方式。int quiet = 0;#endif#ifdef CFG_NAND_WRITE_YAFFS /added begin int yaffs = 0; /* 1 = 512B block+64 OOB NAND,

22、 0 = 2048+64 NAND */#endif /added end 修改第518行,增加yaffs读写。 ret = nand_write_opts(nand, &opts); #ifdef CFG_NAND_WRITE_YAFFS / added begin else if(!read & s != NULL & 0 = strncmp(s, .yaffs, 6) if (s6 = 1) yaffs = 1; else if (s6 = 2 | s6 = 0) yaffs = 2; if(yaffs) ret = nand_write_yaffs(nand, off, &size,

23、(u_char *)addr, yaffs); #endif /added end修改第1116行,在uboot处增加nand write.yaffs2命令以支持烧写yaffs2。nand write.jffs2 addr off size - read/write size bytes startingn at offset off to/from memory address addrn#ifdef CFG_NAND_WRITE_YAFFS /added begin nand write.yaffs1 addr off size - read/write size bytes starti

24、ngn at offset off to memory address addr yaffs1 or yaffs2 formatn#endif /added end1.4. 修改ether.c增加网络支持默认情况下,uboot1.3.4网络不通,是因为网络初始化时没有打开网络连接,网络不通则yaffs2文件系统没法下载。修改u-boot-1.3.4cpuarm926ejsat91sam9ether.c第33行,使初始化网络状态为打开网络链接。/macb_eth_initialize(0, (void *)AT91_BASE_EMAC, 0x00);macb_eth_initialize(0,

25、(void *)AT91_BASE_EMAC, 0x01);1.5. 修改启动命令和网络参数设置根据SDRAM地址、内核分区情况和本地电脑ip设置修改u-boot-1.3.4includeconfigsat91sam9260ek.h中第165行注释掉如下代码:#define CONFIG_BOOTCOMMAND nand read 0x22000000 0xA0000 0x200000; bootm#define CONFIG_BOOTARGS console=ttyS0,115200 root=/dev/mtdblock5 mtdparts=at91_nand:128k(bootstrap)

26、ro, 256k(uboot)ro,128k(env1)ro, 128k(env2)ro,2M(linux),-(root) rw rootfstype=jffs2增加如下代码:#define CONFIG_BOOTCOMMAND nand read 0x22000000 0x100000 0x200000; nand read 0x23100000 0x400000 0x600000; bootm 0x22000000 #if 0#define CONFIG_BOOTARGS 64M console=ttyS0,115200 initrd 0x23100000,6000000 root=/d

27、ev/ram0 rw #endif #define CONFIG_IPADDR 192.168.100.101 #define CONFIG_ETHADDR 12:34:56:78:90:AB#define CONFIG_SERVERIP 192.168.100.102#define CONFIG_NETMASK 255.255.255.0#define CONFIG_GATEWAYIP 192.168.100.2551.6. 加快断开网络时系统启动速度在网络断开的情况下,系统会不断的搜索是否有网络到达,约5秒后才退出搜索网络,大大降低了系统启动速度。修改u-boot-1.3.4driversnetmacb.c注释掉第304到311行,增加一个延时函数,具体修改如下:#if 0 / changed begin for (i = 0; i name);无网络连接时,延时0.2秒之后就退出搜索网络,启动下一进程。1.7. 编译ubootrootemboard:/xiaoyj/uboot/ u-boot-1.3.4# make这样就可以编译出u-boot.bin,烧写到板子即可。启动信息如下:

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1