zl程序教程

您现在的位置是:首页 >  其他

当前栏目

Newifi2(D1) 刷入pb-boot和breed的记录

2023-03-07 09:40:49 时间

今天要给一个newifi d1刷系统时发现居然还是原厂的uboot, 使用uboot刷入rom时会进行校验拦截第三方的rom. 之前有刷过这个设备的, 但是已经完全记不清怎么处理的了. 查了一下, 这个得用pb-boot这个boot固件, 不能用breed, 因为这个32M的flash如果使用breed的话会有问题, 比如无法软件reboot.

网上很多资料因为时间长了, 文件链接都已经失效. 费了不少功夫把pb-boot安装上了, 把过程记录一下

1. 下载3500版本的固件, 地址 https://pan.baidu.com/s/1-jgMP_pa6BjxKopUsSrrkg, 密码 k533  
用其他版本的固件, 在最后一步执行mtd write的时候, 会出现 Could not open mtd device: fullflash Can't open device for writing! 错误

2. 拔掉电源, 压着resset孔加电. 进入自带的uboot
3. 需要将电脑IPv4地址配置为 192.168.1.10/255.255.255.0, 通过浏览器访问 http://192.168.1.1
4. 上传刚才下载的固件, 时间会比较长, 黄蓝灯(有些版本的颜色不一样, 也可能是蓝红灯)交错时是在上传, 然后是黄灯, 然后会自动重启, 蓝灯闪, 到蓝灯不闪时, 恢复就结束了
5. 电脑IPv4配置为DHCP自动获取IP, 然后浏览器访问http://192.168.99.1, 主界面点击"高级设置", 进入lucy界面后, 点击"系统->管理权", 在这里启用ssh

开始命令行操作,
终端1:

# ssh连入192.168.99.1
cd /tmp
dd if=/dev/mtd0 of=uboot.bin
dd if=/dev/mtd2 of=factory.bin
dd if=/dev/mtd3 of=fullflash.bin

终端2:

# 备份至本地
scp root@192.168.99.1:/tmp/factory.bin .
root@192.168.99.1's password:
factory.bin                                   100%   64KB   4.5MB/s   00:00    
scp root@192.168.99.1:/tmp/fullflash.bin .
root@192.168.99.1's password:
fullflash.bin                                 100%   32MB   5.0MB/s   00:06    
scp root@192.168.99.1:/tmp/uboot.bin .
root@192.168.99.1's password:
uboot.bin                                     100%  192KB   4.8MB/s   00:00    

# 将pb-boot上传至d1
scp pb-boot-newifi2-20170927-6562a88.bin root@192.168.99.1:/tmp/
root@192.168.99.1's password:
pb-boot-newifi2-20170927-6562a88.bin          100%  148KB   3.3MB/s   00:00    

终端1:

# 制作fullflash固件
dd if=/dev/zero bs=1024 count=192 | tr "\000" "\377" >pb_192.bin
192+0 records in
192+0 records out
196608 bytes (192.0KB) copied, 0.004637 seconds, 40.4MB/s

dd if=pb-boot-newifi2.bin of=pb_192.bin conv=notrunc
295+1 records in
295+1 records out
151312 bytes (147.8KB) copied, 0.003581 seconds, 40.3MB/s

cat /tmp/pb_192.bin /dev/mtd1 /dev/mtd2 /dev/mtd4 >fullflash_with_pb.bin

# 写入, 写入的时间比较长, 需要耐心等待
mtd write fullflash_with_pb.bin fullflash
Unlocking fullflash ...
Writing from fullflash_with_pb.bin to fullflash ...     
root@xCloud:/tmp# 

写入时, 等交替闪烁的(e)和(w)结束后返回提示符时, 就可以重启设备了, 按着reset进入pb-boot. 这次不需要再设置固定IP了, 可以自动获取192.168.1.2的IP

OpenWrt 18.06的rom, 2.4G wlan还是有问题

Update 2019-02-16:

Breed又提供d1的下载了, https://breed.hackpascal.net/ 下面的 breed-mt7621-newifi-d1.bin
如果是刷breed, 其实命令是一样的, 就是把pb-boot换成了breed, 全部命令如下

dd if=/dev/mtd0 of=uboot.bin
dd if=/dev/mtd2 of=factory.bin
dd if=/dev/mtd3 of=fullflash_original.bin #这步有点慢, 耐心等待
# scp备份之前生成的三个文件
dd if=/dev/zero bs=1024 count=192 | tr "\000" "\377" >breed_192.bin
dd if=breed-mt7621-newifi-d1.bin of=breed_192.bin conv=notrunc
cat /tmp/breed_192.bin /dev/mtd1 /dev/mtd2 /dev/mtd4 >fullflash_with_breed.bin #这步有点慢, 耐心等待
mtd write fullflash_with_breed.bin fullflash # 写入, 写入的时间比较长, 需要耐心等待
# 如果这步发生错误, 在未重启d1之前, 都可以用 mtd write fullflash_original.bin fullflash 命令将路由器恢复回原来的固件

全部命令执行记录

root@xCloud:/tmp# dd if=/dev/mtd0 of=uboot.bin
384+0 records in
384+0 records out
196608 bytes (192.0KB) copied, 0.103660 seconds, 1.8MB/s
root@xCloud:/tmp# dd if=/dev/mtd2 of=factory.bin
128+0 records in
128+0 records out
65536 bytes (64.0KB) copied, 0.033944 seconds, 1.8MB/s
root@xCloud:/tmp# dd if=/dev/mtd3 of=fullflash_original.bin
65536+0 records in
65536+0 records out
33554432 bytes (32.0MB) copied, 17.245314 seconds, 1.9MB/s
root@xCloud:/tmp# dd if=/dev/zero bs=1024 count=192 | tr "\000" "\377" >breed_192.bin
192+0 records in
192+0 records out
196608 bytes (192.0KB) copied, 0.004785 seconds, 39.2MB/s
root@xCloud:/tmp# dd if=breed-mt7621-newifi-d1.bin of=breed_192.bin conv=notrunc
205+1 records in
205+1 records out
104981 bytes (102.5KB) copied, 0.002521 seconds, 39.7MB/s
root@xCloud:/tmp# cat /tmp/breed_192.bin /dev/mtd1 /dev/mtd2 /dev/mtd4 >fullflash_with_breed.bin

root@xCloud:/tmp# mtd write fullflash_with_breed.bin fullflash
Unlocking fullflash ...

Writing from fullflash_with_breed.bin to fullflash ...