找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 11604|回复: 14

只要有openwrt就行,在各种不同官方或自制的openwrt版中刷uboot和art

[复制链接]
本帖最后由 jiuweiljp 于 2020-5-19 15:00 编辑

本文主要是方便那些没有编程器的玩家,注意刷bootload有风险,刷砖了那只有上编程器了
已经刷了breed的朋友可以无视。

有很多网友需要在openwrt中刷bootload 和 art 数据,但众所周知openwrt默认是锁了bootload和art分区的。
本文参考了
https://www.right.com.cn/forum/f ... F8uboot%B7%D6%C7%F8
(题外话:不知道怎么弄的这篇帖子我的 firefox 打开特别容易卡住,IE也很慢,chrome 还行)

里面提到了安装、使用kmod-mtd-rw模块可以刷bootload及art,对openwrt 有一定了解的人知道kmod模块是要区分内核版本的,不同的内核版本是装不上它的。
找吧,还真有,
qca(ar)系列的cpu用   http://downloads.openwrt.org/sna ... 71xx/generic/kmods/

                                   https://archive.openwrt.org/snapshots/targets/ar71xx/generic/kmods/
mtk系列cpu用               http://downloads.openwrt.org/sna ... amips/mt7620/kmods/


其它系列也有,自己找吧!

在这个文件夹下基本主流的内核版本的kmod 模块都有,下载对应内核版本的kmod-mtd-rw,用winscp传到openwrt 的/tmp 目录下手动安装(还好这个模块好像不依赖其它库)
1、安装模块
      opkg install --nodeps kmod-mtd-rw_xxxxxx.ipk
      注:我估计基本上需要强制安装,少数的openwrt可能不用强制安装的,但强制安装也需要内核版本对上,出了问题我不负责。
      例:opkg install --nodeps kmod-mtd-rw_4.9.106\+git-20160214-1_mips_24kc.ipk
            如果正常会显示:
                Installing kmod-mtd-rw (4.9.106+git-20160214-1) to root...
                Configuring kmod-mtd-rw.
            安装完成后可以看看安装情况:
            opkg list-installed |grep kmod-mtd
2、备份bootload或art
     查看mtd 分区信息
     cat /proc/mtd
     例:mtd0: 00010000 00010000 "u-boot"
           mtd1: 0015330c 00010000 "kernel"
           mtd2: 0068ccf4 00010000 "rootfs"
           mtd3: 003e0000 00010000 "rootfs_data"
           mtd4: 00010000 00010000 "art"
           mtd5: 007e0000 00010000 "firmware"
     备份art 使用 dd if=/dev/mtd4 of=/tmp/art_bak_old.bin

3、开刷
     insmod mtd-rw.ko i_want_a_brick=1 (载入kmod-mtd-rw 模块)
     用winscp上传新的art文件(newart.bin)到/tmp 目录后
      mtd write /tmp/newart.bin art  (刷写art)

4、最后验证一下
      dd if=/dev/mtd4 of=/tmp/art_bak_new.bin
     用winscp将
art_bak_new.bin文件传回电脑,用winhex对比下,看看是不是相同的  







我的恩山、我的无线 The best wifi forum is right here.
 楼主| | 显示全部楼层
本帖最后由 jiuweiljp 于 2019-2-26 21:40 编辑

特别注意:文件尺寸不同的U-boot 不能用这个方法刷。
例:
root@OpenWrt:/tmp# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00010000 00010000 "u-boot"
mtd1: 0015330c 00010000 "kernel"
mtd2: 0068ccf4 00010000 "rootfs"
mtd3: 003e0000 00010000 "rootfs_data"
mtd4: 00010000 00010000 "art"
mtd5: 007e0000 00010000 "firmware"
我的这个u-boot 占用空间是0x
10000 也就是64KB,而我上传的uboot是93KB占用空间是0x20000 128KB。
如果刷写后出现错误提示:

root@OpenWrt:/tmp# mtd write breed-qca956x-uart_rx18_tx20-reset1.bin u-boot
Unlocking u-boot ...

Writing from breed-qca956x-uart_rx18_tx20-reset1.bin to u-boot ...  [e]Failed to erase block

失败了,注意这时候千万不要重启路由器。
把备份或正确的u-boot
刷进去就行了。
root@OpenWrt:/tmp# mtd write breed-qca9561-wdr6500v2-r1080.bin u-boot
Unlocking u-boot ...

Writing from breed-qca9561-wdr6500v2-r1080.bin to u-boot ...

刷写成功!

如果有人问不同尺寸的u-boot怎么刷呢?
1、最简单的用u-boot 中用控制台刷,tftp或Y-modem。(要你路由的uboot中有这些功能才行,一般都有我见过没有tftp,但有Ymodem的)

2、编程器(相对简单)
3、breed web(路由的bootload已经改成breed)
4、用jtag(有难度)


千万别蛮干啊!!!


点评

非常感谢教程!成功刷入不死breed,我的小米路由器3g官方bootloader是512k,breed是102k,能正常刷入,正常使用!  详情 回复 发表于 2020-5-11 16:01
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

学习了,谢谢楼主!
root@OpenWrt:~# dd if=/dev/mtd0 of=/tmp/boot.bin
512+0 records in
512+0 records out
这样表示备份了boot吗?

点评

是的  发表于 2019-3-1 07:32
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

真心感謝大神分享, 我的TP-LINK archer-c7-v2刷BREED成功了....



本帖子中包含更多资源

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

×

点评

有用就行1111111  详情 回复 发表于 2019-3-30 21:55
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

看上去很历害的教程,可惜不是太明白,小白路过支持
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
sillydanny 发表于 2019-3-30 11:16
真心感謝大神分享, 我的TP-LINK archer-c7-v2刷BREED成功了....

有用就行1111111
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

jiuweiljp 发表于 2019-2-26 20:34
特别注意:文件尺寸不同的U-boot 不能用这个方法刷。
例:
root@OpenWrt:/tmp# cat /proc/mtd

非常感谢教程!成功刷入不死breed,我的小米路由器3g官方bootloader是512k,breed是102k,能正常刷入,正常使用!

点评

戴佬,你用的哪个ipk,为啥我安装的时候一直报错 Installing kmod-mtd-rw (5.10.127+git-20160214-2) to root... Collected errors: * wfopen: //usr/lib/opkg/info/kmod-mtd-rw.control: Read-only file system.  详情 回复 发表于 2022-7-2 10:13
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

还想着先编译一个解锁uboot分区的固件,找教程的时候看见楼主的教程
小米R4A成功刷入,谢谢楼主分享
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

终于刷进入breed
谢谢大神
r3pttl被锁
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

请问我刷入的openwrt版本是5.4.110 但kmod-mtd-rw我没有发现与这个版本匹配的包,请问我该怎么办
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

请问在执行 insmod mtd-rw i_want_a_brick=1 这行代码的时候出现 Failed to find mtd-rw. Maybe it is a built in module ? 这行东西该怎么办,找了一上午都没找到解决方法。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

来自手机 | 显示全部楼层
咦,真的要谢谢楼主,章鱼就是要用armbian刷bootloader,怕烦一直用的U盘,马上试试看
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

扯淡君丶 发表于 2020-5-11 16:01
非常感谢教程!成功刷入不死breed,我的小米路由器3g官方bootloader是512k,breed是102k,能正常刷入,正 ...

戴佬,你用的哪个ipk,为啥我安装的时候一直报错
Installing kmod-mtd-rw (5.10.127+git-20160214-2) to root...
Collected errors:
* wfopen: //usr/lib/opkg/info/kmod-mtd-rw.control: Read-only file system.
* wfopen: //usr/lib/opkg/info/kmod-mtd-rw.postinst: Read-only file system.
* wfopen: //usr/lib/opkg/info/kmod-mtd-rw.prerm: Read-only file system.
* wfopen: /lib/modules/5.10.127/mtd-rw.ko: Read-only file system.
* pkg_write_filelist: Failed to open //usr/lib/opkg/info/kmod-mtd-rw.list: Read-only file system.
* opkg_install_pkg: Failed to extract data files for kmod-mtd-rw. Package debris may remain!
* opkg_install_cmd: Cannot install package kmod-mtd-rw.
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

来自手机 | 显示全部楼层
有个章鱼只能U盘启动,试试看机
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-27 05:55

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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

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