找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 15732|回复: 10

制作编程器固件教程

[复制链接]
原文连接:

关注订阅号实时查看
制作编程器固件(7620为例)
说明
编程器固件依据flash大小而定,一般是8M16M
步骤
1、  确定分区
路由器上看mtd分区,命令cat  /proc/mtd
root@openwrt:/# cat /proc/mtd
dev:   size   erasesize  name
mtd0: 00030000 00010000"u-boot"
mtd1: 00010000 00010000"u-boot-env"
mtd2: 00010000 00010000"Factory"
mtd3: 00140000 00010000 "kernel"
mtd4: 00e70000 00010000 "rootfs"
mtd5: 00890000 00010000"rootfs_data"
mtd6: 00fb0000 00010000"firmware"
mtd7: 01000000 00010000"fullflash"
另外用logread命令可以看出来flash的大小和每个分区的起始结束点
[   0.520000] deice id : ef 40 18 0 0 (40180000)
[   0.528000] W25Q128BV(ef 40180000) (16384 Kbytes)----这个大小就是flash大小
[   0.536000] mtd .name = raspi, .size = 0x01000000 (0M) .erasesize =0x00000010 (0K) .numeraseregions = 65536
[   0.564000] Squashfs filesystem found at offset 0x190000,adjustment mtdpartition.
[   0.580000] Creating 7 MTD partitions on "raspi":
[   0.588000] 0x000000000000-0x000000030000 : "u-boot"
[   0.600000] 0x000000030000-0x000000040000 : "u-boot-env"
[   0.612000] 0x000000040000-0x000000050000 : "Factory"
[   0.624000] 0x000000050000-0x000000190000 : "kernel"
[   0.636000] 0x000000190000-0x000001000000 : "rootfs"
[   0.648000] mtd: partition "rootfs" set to be root filesystem
[   0.660000] mtd: partition "rootfs_data" created automatically,ofs=770000, len=890000
[   0.676000] 0x000000770000-0x000001000000 : "rootfs_data"
[   0.688000] 0x000000050000-0x000001000000 : "firmware"
[   0.700000] 0x000000000000-0x000001000000 : "fullflash"
从上面的信息可以看出每个分区所占用的flash空间范围。
7620来说我们需要的分区就是上面红色字体的几个。
2、获取每个分区数据
获取ubootuboot-envFactory分区
root@openwrt:/# dd if=/dev/mtd0of=/tmp/uboot.bin
384+0 records in
384+0 records out
root@openwrt:/#
root@openwrt:/# dd if=/dev/mtd1of=/tmp/uboot-env.bin
128+0 records in
128+0 records out
root@openwrt:/# dd if=/dev/mtd2of=/tmp/Factory.bin
128+0 records in
128+0 records out
获取firmware分区的方法
这个有两个方法,一个直接使用openwrt编译出来squashfs-factory.bin,注意是factory的固件,不是squashfs-sysupgrade.bin,这种方法需要给不满firmware分区长度的部分补0,让他的长度达到firmware分区的大小。
另一个就是先把factory或者sysupgrade的固件传到路由器上,mtd写进去,在用dd读出来,注意在读取之前不能重启,保证新写进去的固件是没有被启动过的
root@openwrt:~# mtd write/tmp/xxx-squashfs-sysupgrade.bin firmware
这样将固件写入到firmware分区,在用dd命令读取出来firmware数据
root@openwrt:~# dd if=/dev/mtd6 of=/tmp/firmware.bin
32128+0 records in
32128+0 records out
root@openwrt:~#
所有分区的数据都得到了,下面该合并了。
3、  合并分区得到编程器固件
winscp将路由器中的文件复制到电脑上(需要路由器固件支持sshscp
合并用到的软件是winhex
我的方法是分别复制uboot-env.bin,factory.binfirmware.bin的数据到uboot的下面粘贴,这样就ok了!
注意一定要看清楚每个分区的顺序

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×

评分

参与人数 1恩山币 +1 收起 理由
lon9*** + 1 感谢你的分享,无论怎样,你都是最无私的人!来,说说,你E盘上还有啥一起给我吧!

查看全部评分

我的恩山、我的无线 The best wifi forum is right here.
问题是别人的机器不TTL怎么才能知道 分区结构


知道后替换ART 、UBOOT、FW很多都会的啊!!!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

matsk 发表于 2015-10-10 13:30
问题是别人的机器不TTL怎么才能知道 分区结构

ssh连接也可以看的
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
matsk 发表于 2015-10-10 13:30
问题是别人的机器不TTL怎么才能知道 分区结构

ttl
ssh
telnet
都可以的
制作编程器固件一般都是自己给自己做!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

来自手机 | 显示全部楼层
不懂怎么弄,看似好难的样子
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

合并文件可以直接用这条命令
cat file1 file2 file3 ... filen > file.bak
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

第一,拿到编程器固件,用breed,不死uboot最方便。如果不是不死uboot,需要先刷不锁uboot的固件,然后mtd写入新的uboot。都是不用拆机。话说现在哪有几个低端机不要拆机mod啊。
第二,合并文件 ,用copy /b 命令。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

很好很强大
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

用breed可以直接备份出编程器固件啊!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
阿非 发表于 2016-4-10 23:41
用breed可以直接备份出编程器固件啊!

是的

我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

nand的flash,备份了mtd0-mtd4的固件怎么合并成为编程器固件啊。 上个月用cat强行合并mtd0-5,nand编程器刷入后,无法引导系统。请问方法是怎样啊
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

欢迎大家光临恩山无线论坛上一条 /1 下一条

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-5-5 06:36

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表