加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

编程器固件、uboot、fullflash  介绍

(2013-04-12 15:34:00)
标签:

it

root@DD-WRT:~# cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 00020000 00010000 "RedBoot"
mtd1: 007c0000 00010000 "linux"
mtd2: 00270000 00010000 "rootfs"
mtd3: 00410000 00010000 "ddwrt"
mtd4: 00010000 00010000 "nvram"
mtd5: 00010000 00010000 "board_config"
mtd6: 00800000 00010000 "fullflash"
mtd7: 00020000 00010000 "fullboot"
root@DD-WRT:~#

 

DDWRT备份成编程器固件命令(前提是有fullash分区)

root@DD-WRT:~# dd if=/dev/mtd6 of=/tmp/741_fullflash.bin
16384+0 records in
16384+0 records out
root@DD-WRT:~#

 

刷成编程器固件命令(前提是有fullash分区)

root@DD-WRT:~# mtd -r write fullflash /tmp/741_fullflash.bin
16384+0 records in
16384+0 records out
root@DD-WRT:~#

 

编程openwrt固件时修改mach-tl-mr3x20.c(对应3420)增加一个fullash

}, {
  .name  = "fullflash",
  .offset  = 0,
  .size  = 0x800000,

  .mask_flags = MTD_WRITEABLE,

}

 

  .size  = 0x800000, 这个是flash大小8M

去掉  .mask_flags = MTD_WRITEABLE,是分区可以写,否者只可读

 

 

编程器固件包含uboot+内核固件+art/board_config (适用于ar 3240固件等)

一、准备uboot、内核固件(firmware)、art/board_config
  1、登录路由
  2、切换到tmp目录,
  3、使用dd命令备份uboot、firmware、art/board_config,
  4、使用cat命令将文件合并,假设新文件名为xxx.bin
  5、使用WinSCP将文件复制到电脑 

root@OpenWrt:~# cd /tmp
root@OpenWrt:/tmp# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00020000 00010000 "u-boot"
mtd1: 00140000 00010000 "kernel"
mtd2: 00690000 00010000 "rootfs"
mtd3: 00460000 00010000 "rootfs_data"
mtd4: 00010000 00010000 "art"
mtd5: 007d0000 00010000 "firmware"
root@OpenWrt:/tmp# dd if=/dev/mtd0 of=uboot.bin
root@OpenWrt:/tmp# dd if=/dev/mtd5 of=firmware.bin
root@OpenWrt:/tmp# dd if=/dev/mtd4 of=art.bin
root@OpenWrt:/tmp# cat uboot.bin firmware.bin art.bin > fullflash.bin

相当于windows下   copy /b 1.txt+2.txt 3.txt

http://img.bimg.126.net/photo/SCbd6fruIAvPDhAQS_36Cw==/5792473545729891347.jpg 介绍" />

 

区分固件是否带uboot

用Uedit32打开固件

http://img.bimg.126.net/photo/6CZI2MyncDRKLKoUAcTmJg==/5792473545729891348.jpg 介绍" />

这个是有uboot的

http://img.bimg.126.net/photo/wbHX97HtTsxmjlpgJgPH9g==/5792473545729891349.jpg 介绍" />

这个是有没有uboot的的openwrt固件

 

 

去掉固件的uboot  (也就是删除固件前成128k数据)
这个是有uboot的http://img.bimg.126.net/photo/8nIP50r6PVsOHHjJvUEc-Q==/5792473545729891350.jpg 介绍" />

http://img.bimg.126.net/photo/d9DlYNudIlTgPueL5qCwGA==/5792473545729891351.jpg 介绍" />

128K*1024 =131072

 

固件加uboot

copy /b uboot.bin+固件.bin 新固件.bin

 

 

uboot下刷机

打开tftpd32 把固件放tftpd32设置的目录下
打开SecureCRT 波特率115200

这是7240 uboot下刷4M的固件
ar7240> printenv
ar7240> setenv ipaddr 192.168.1.2
ar7240> setenv serverip 192.168.1.100 
ar7240> tftpboot 0x80000000 150r.bin
ar7240> erase 0x9f000000 +0x3fffff
ar7240> cp.b 0x80000000 0x9f000000 0x3fffff
ar7240> bootm

ubnt uboot刷机 
tftpboot 0x80000000 1508m.bin


erase 0xbf000000 +0x3fffff


cp.b 0x80000000 0xbf000000 0x3fffff


bootm

普通的uboot 和 ubnt的uboot的刷机都搞定了

 

普通的uboot一个是 0x9f000000开始

,ubnt是 0xbf000000开始


0

阅读 收藏 喜欢 打印举报/Report
前一篇:openwrt 参考
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有