编程器固件、uboot、fullflash

本文详细介绍了路由器固件的备份、编程器固件制作及刷机流程,包括使用dd命令备份uboot、内核固件、art/board_config,cat命令合并文件,以及使用WinSCP将文件复制到电脑。同时,阐述了如何区分固件是否带有uboot,以及如何在不同类型的uboot下刷机,最后提供了编程器固件的刷机步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

:~# 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"
:~#

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

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

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

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

 

编程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

 

区分固件是否带uboot

用Uedit32打开固件

这个是有uboot的

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

去掉固件的uboot  (也就是删除固件前成128k数据)
这个是有uboot的



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.222
ar7240> setenv serverip 192.168.1.2           #PC设置网卡IP为192.168.1.2
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开始

 

 

 

 

 

 

刷编程器固件
setenv ipaddr 192.168.1.111
setenv serverip 192.168.1.2
tftpboot 0x80000000 741V3_factory_all.bin
erase 0x9f000000 +0x400000
cp.b 0x80000000 0x9f000000 0x400000

刷普通固件
tftpboot 0x80000000 op.bin
erase 0x9f020000 +0x400000
cp.b 0x80000000 0x9f020000 0x400000
bootm




转载自:http://hi.baidu.com/opwrt/item/c7a7e72ff12bec98b6326362

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值