整理记录一些 DW33D 刷 Openwrt 的 Nand 固件教程,主要内容来源于恩山论坛,加上一些文字歧义的修正与实践记录。
背景知识
dw33d内部有几个存储空间(可理解为硬盘),SPI-NOR(16M)、 NAND(128M)、 TF卡(16G)。
原厂固件是在NOR上的,一些旧版(lede 17.x)也是设计刷到NOR上,这类固件称为(ath1x)。BREED默认也是刷到NOR,启动也是NOR。
后来openwrt把dw33d纳入官方支持时候,改成使用NAND作为固件区域,这类称为(ath79),或者nand固件。
旧版固件虽然刷入简单(可以Breed WEB页面直刷),但是可用空间非常有限。
nand固件的刷入较为复杂,但是有足够大的存储空间(可用空间70M+),可以安装很多可选插件。
Breed虽然在dw33d上工作不完美,但是还是比u-boot简化一丢丢。
刷机方法可以是u-boot,连接TTL线操作;也可以不拆外壳,telnet操作;
帖子导航
解锁固件底包 (该贴固件为NOR固件,先考虑按帖子内容刷入Breed)
NAND固件们:【openwrt官方(默认无web)】【PandoraBOX】【PandoraBox ssrplus】【某版本的lean】
Breed刷Nand教程:【shanpo大神原帖】【图形详细化shanpo原帖】【需要注意命令的大小参数】
更多好固件麻烦跟帖补充
简介解释
Breed刷Nand看起来很复杂,其实总共3个步骤:
Breed设置环境变量
PC开启http服务器
Breed Telnet下载并写入固件。
1.Breed设置环境变量
无论你是通过什么方法刷的Breed,现在需要开机长按 reset 进入breed
然后通过 putty 或者系统任意支持 telnet 客户端的方式连接到路由器上
telnet 192.168.1.1
在 telnet 中:执行修改环境变量配置的起始地址和大小
envconf 0x6000000 0x20000
你也可以在web,这个页面看到当前的配置
http://192.168.1.1/envconf.html
修改完毕后,记得重启
reset
2.开启HTTP服务器
教程里推荐使用的是 MyWebServer
在此你可以使用任意方式将本地电脑开启一个HTTP服务器,并将文件丢到网站根目录。
我这里使用的是PHP开启的 web 服务器:
php -S 0.0.0.0:9991
确保路由器可以通过 wget 连接到你的电脑,你可以在虚拟机或者现有正常的路由器进行测试。
wget http://你的电脑IP:端口/openwrt-ath79-nand-domywifi_dw33d-squashfs-factory.bin
无论使用哪一种方式,你需要确保路由器能够成功连接到你,并且能够下载到文件,切记关闭防火墙。
备注:这里 wget 无关文件名,所以后面刷写也没有引用文件,猜测是 telnet 里的 wget 会直接将文件写入对应分区,不存在文件系统也不用指定。
3.配置环境变量并刷写固件
按照教程配置环境变量
env set network.ipaddr 192.168.1.1
env set network.netmask 255.255.255.0
env set autoboot.disabled 0
env set autoboot.delay 5
env set autoboot.command "boot flash bank 0 0x0"
env save
通过 wget 下载固件,并刷写固件。
重点是注意flash命令的最后一个参数,应该跟下载时候的长度匹配(或更大)。
这里是最后两个 flash 命令中的 0xd00000 都要改成对应的固件大小。
wget http://192.168.0.254/firmware/dw33d-factory.bin
##### 注意显示的长度,0xd00000应该跟后续两个命令中对应位置的参数相同
#####-> Length: 13631488/0xd00000 (13MB) [application/octet-stream]
flash bank 0 erase 0x0 0xd00000
flash bank 0 write 0x0 0x80000000 0xd00000
举例说明:
breed> wget http://192.168.1.17:9991/openwrt-ath79-nand-domywifi_dw33d-squashfs-factory.bin
wget http://192.168.1.17:9991/openwrt-ath79-nand-domywifi_dw33d-squashfs-factory.bin
Connecting to 192.168.1.17:9991... connected.
HTTP request sent, awaiting response... 200 OK
Length: 31326208/0x1de0000 (29MB) [application/octet-stream]
Saving to address 0x80000000
[========================================================================] 100%
Transmission completed in 5.5s.
根据这个 wget 的结果来看,固件大小为:0x1de0000,修改也需要将两处均修改掉:
flash bank 0 erase 0x0 0x1de0000
flash bank 0 write 0x0 0x80000000 0x1de0000
刷写成功后,重启耐心等待即可,注意将网卡 IP 设置为自动获取。
reset
之后你就可以根据 openwrt web 中的升级固件功能,刷一些 squashfs-sysupgrade 类的固件。
错误解决
如果你遇到下面的错误,就是因为修改完环境变量配置没有重启导致的环境变量只读。
breed> envconf 0x6000000 0x20000
envconf 0x6000000 0x20000
Environment variable block has been successfully changed.
It will take effect after reboot.
breed> env set network.ipaddr 192.168.1.1
env set network.ipaddr 192.168.1.1
Environment is read-only.
breed> env set network.netmask 255.255.255.0
env set network.netmask 255.255.255.0
Environment is read-only.
breed> env set autoboot.disabled 0
env set autoboot.disabled 0
Environment is read-only.
breed> env set autoboot.delay 5
env set autoboot.delay 5
Environment is read-only.
breed> env set autoboot.command "boot flash bank 0 0x0"
env set autoboot.command "boot flash bank 0 0x0"
Environment is read-only.
breed> env list
env list
Environment is not available.
breed> env save
env save
Environment is read-only.
breed> env list
env list
Environment is not available.
刷机记录
只包含环境变量修改和刷写。
Boot and Recovery Environment for Embedded Devices
Copyright (C) 2018 HackPascal <[email protected]>
Build date 2018-08-05 [git-3fc5188]
Version 1.1 (r1226)
Starting breed built-in shell
breed> envconf
envconf
Usage:
envconf [disable | <offset> <size>] - Enable / disable env block
breed> envconf 0x6000000 0x20000
envconf 0x6000000 0x20000
Environment variable block has been successfully changed.
It will take effect after reboot.
breed> env set network.ipaddr 192.168.1.1
env set network.ipaddr 192.168.1.1
Environment is read-only.
breed> env set network.netmask 255.255.255.0
env set network.netmask 255.255.255.0
Environment is read-only.
breed> env set autoboot.disabled 0
env set autoboot.disabled 0
Environment is read-only.
breed> env set autoboot.delay 5
env set autoboot.delay 5
Environment is read-only.
breed> env set autoboot.command "boot flash bank 0 0x0"
env set autoboot.command "boot flash bank 0 0x0"
Environment is read-only.
breed> env list
env list
Environment is not available.
breed> env save
env save
Environment is read-only.
breed> env list
env list
Environment is not available.
breed>
breed> reset
Boot and Recovery Environment for Embedded Devices
Copyright (C) 2018 HackPascal <[email protected]>
Build date 2018-08-05 [git-3fc5188]
Version 1.1 (r1226)
Starting breed built-in shell
breed> env set network.ipaddr 192.168.1.1
env set network.ipaddr 192.168.1.1
'network.ipaddr' is set with value '192.168.1.1'.
breed> env set network.netmask 255.255.255.0
env set network.netmask 255.255.255.0
'network.netmask' is set with value '255.255.255.0'.
breed> env set autoboot.disabled 0
env set autoboot.disabled 0
'autoboot.disabled' is set with value '0'.
breed> env set autoboot.delay 5
env set autoboot.delay 5
'autoboot.delay' is set with value '5'.
breed> env set autoboot.command "boot flash bank 0 0x0"
env set autoboot.command "boot flash bank 0 0x0"
'autoboot.command' is set with value 'boot flash bank 0 0x0'.
breed> env list
env list
Total size: 131066 bytes / Free size: 130933 byte(s)
network.ipaddr=192.168.1.1
network.netmask=255.255.255.0
autoboot.disabled=0
autoboot.delay=5
autoboot.command=boot flash bank 0 0x0
breed> env save
env save
ath79-nand: block erase failure at 0x06000000
Environment variables saved.
breed> wget http://192.168.1.17:9991/openwrt-ath79-nand-domywifi_dw33d-squashfs-factory.bin
wget http://192.168.1.17:9991/openwrt-ath79-nand-domywifi_dw33d-squashfs-factory.bin
Connecting to 192.168.1.17:9991... connected.
HTTP request sent, awaiting response... 200 OK
Length: 31326208/0x1de0000 (29MB) [application/octet-stream]
Saving to address 0x80000000
[========================================================================] 100%
Transmission completed in 5.5s.
breed>
breed> flash bank 0 erase 0x0 0x1de0000
flash bank 0 erase 0x0 0x1de0000
Erasing flash bank 0 from 0h , size 1de0000h
[ ] 0% ath79-nand: block erase failure at 0x00000000
ath79-nand: block erase failure at 0x00020000
ath79-nand: block erase failure at 0x00040000
[> ] 1% ath79-nand: block erase failure at 0x00060000
ath79-nand: block erase failure at 0x00080000
[> ] 2% ath79-nand: block erase failure at 0x000a0000
ath79-nand: block erase failure at 0x000c0000
ath79-nand: block erase failure at 0x000e0000
[=> ] 3% ath79-nand: block erase failure at 0x00100000
ath79-nand: block erase failure at 0x00120000
[=> ] 4% ath79-nand: block erase failure at 0x00140000
ath79-nand: block erase failure at 0x00160000
[==> ] 5% ath79-nand: block erase failure at 0x00180000
ath79-nand: block erase failure at 0x001a0000
ath79-nand: block erase failure at 0x001c0000
[===> ] 6% ath79-nand: block erase failure at 0x001e0000
ath79-nand: block erase failure at 0x00200000
[====> ] 7% ath79-nand: block erase failure at 0x00220000
ath79-nand: block erase failure at 0x00240000
ath79-nand: block erase failure at 0x00260000
[====> ] 8% ath79-nand: block erase failure at 0x00280000
ath79-nand: block erase failure at 0x002a0000
[=====> ] 9% ath79-nand: block erase failure at 0x002c0000
ath79-nand: block erase failure at 0x002e0000
[======> ] 10% ath79-nand: block erase failure at 0x00300000
ath79-nand: block erase failure at 0x00320000
ath79-nand: block erase failure at 0x00340000
[======> ] 11% ath79-nand: block erase failure at 0x00360000
ath79-nand: block erase failure at 0x00380000
[=======> ] 12% ath79-nand: block erase failure at 0x003a0000
ath79-nand: block erase failure at 0x003c0000
ath79-nand: block erase failure at 0x003e0000
[========> ] 13% ath79-nand: block erase failure at 0x00400000
ath79-nand: block erase failure at 0x00420000
[=========> ] 14% ath79-nand: block erase failure at 0x00440000
ath79-nand: block erase failure at 0x00460000
[=========> ] 15% ath79-nand: block erase failure at 0x00480000
ath79-nand: block erase failure at 0x004a0000
ath79-nand: block erase failure at 0x004c0000
[==========> ] 16% ath79-nand: block erase failure at 0x004e0000
ath79-nand: block erase failure at 0x00500000
[===========> ] 17% ath79-nand: block erase failure at 0x00520000
ath79-nand: block erase failure at 0x00540000
ath79-nand: block erase failure at 0x00560000
[===========> ] 18% ath79-nand: block erase failure at 0x00580000
ath79-nand: block erase failure at 0x005a0000
[============> ] 19% ath79-nand: block erase failure at 0x005c0000
ath79-nand: block erase failure at 0x005e0000
[=============> ] 20% ath79-nand: block erase failure at 0x00600000
ath79-nand: block erase failure at 0x00620000
ath79-nand: block erase failure at 0x00640000
[==============> ] 21% ath79-nand: block erase failure at 0x00660000
ath79-nand: block erase failure at 0x00680000
[==============> ] 22% ath79-nand: block erase failure at 0x006a0000
ath79-nand: block erase failure at 0x006c0000
[===============> ] 23% ath79-nand: block erase failure at 0x006e0000
ath79-nand: block erase failure at 0x00700000
ath79-nand: block erase failure at 0x00720000
[================> ] 24% ath79-nand: block erase failure at 0x00740000
ath79-nand: block erase failure at 0x00760000
[=================> ] 25% ath79-nand: block erase failure at 0x00780000
ath79-nand: block erase failure at 0x007a0000
ath79-nand: block erase failure at 0x007c0000
[=================> ] 26% ath79-nand: block erase failure at 0x007e0000
ath79-nand: block erase failure at 0x00800000
[==================> ] 27% ath79-nand: block erase failure at 0x00820000
ath79-nand: block erase failure at 0x00840000
[===================> ] 28% ath79-nand: block erase failure at 0x00860000
ath79-nand: block erase failure at 0x00880000
ath79-nand: block erase failure at 0x008a0000
[===================> ] 29% ath79-nand: block erase failure at 0x008c0000
ath79-nand: block erase failure at 0x008e0000
[====================> ] 30% ath79-nand: block erase failure at 0x00900000
ath79-nand: block erase failure at 0x00920000
ath79-nand: block erase failure at 0x00940000
[=====================> ] 31% ath79-nand: block erase failure at 0x00960000
ath79-nand: block erase failure at 0x00980000
[======================> ] 32% ath79-nand: block erase failure at 0x009a0000
ath79-nand: block erase failure at 0x009c0000
[======================> ] 33% ath79-nand: block erase failure at 0x009e0000
ath79-nand: block erase failure at 0x00a00000
ath79-nand: block erase failure at 0x00a20000
[=======================> ] 34% ath79-nand: block erase failure at 0x00a40000
ath79-nand: block erase failure at 0x00a60000
[========================> ] 35% ath79-nand: block erase failure at 0x00a80000
ath79-nand: block erase failure at 0x00aa0000
ath79-nand: block erase failure at 0x00ac0000
[========================> ] 36% ath79-nand: block erase failure at 0x00ae0000
ath79-nand: block erase failure at 0x00b00000
[=========================> ] 37% ath79-nand: block erase failure at 0x00b20000
ath79-nand: block erase failure at 0x00b40000
[==========================> ] 38% ath79-nand: block erase failure at 0x00b60000
ath79-nand: block erase failure at 0x00b80000
ath79-nand: block erase failure at 0x00ba0000
[===========================> ] 39% ath79-nand: block erase failure at 0x00bc0000
ath79-nand: block erase failure at 0x00be0000
[===========================> ] 40% ath79-nand: block erase failure at 0x00c00000
ath79-nand: block erase failure at 0x00c20000
[============================> ] 41% ath79-nand: block erase failure at 0x00c40000
ath79-nand: block erase failure at 0x00c60000
ath79-nand: block erase failure at 0x00c80000
[=============================> ] 42% ath79-nand: block erase failure at 0x00ca0000
ath79-nand: block erase failure at 0x00cc0000
[=============================> ] 43% ath79-nand: block erase failure at 0x00ce0000
ath79-nand: block erase failure at 0x00d00000
ath79-nand: block erase failure at 0x00d20000
[==============================> ] 44% ath79-nand: block erase failure at 0x00d40000
ath79-nand: block erase failure at 0x00d60000
[===============================> ] 45% ath79-nand: block erase failure at 0x00d80000
ath79-nand: block erase failure at 0x00da0000
[================================> ] 46% ath79-nand: block erase failure at 0x00dc0000
ath79-nand: block erase failure at 0x00de0000
ath79-nand: block erase failure at 0x00e00000
[================================> ] 47% ath79-nand: block erase failure at 0x00e20000
ath79-nand: block erase failure at 0x00e40000
[=================================> ] 48% ath79-nand: block erase failure at 0x00e60000
ath79-nand: block erase failure at 0x00e80000
ath79-nand: block erase failure at 0x00ea0000
[==================================> ] 49% ath79-nand: block erase failure at 0x00ec0000
ath79-nand: block erase failure at 0x00ee0000
[===================================> ] 50% ath79-nand: block erase failure at 0x00f00000
ath79-nand: block erase failure at 0x00f20000
[===================================> ] 51% ath79-nand: block erase failure at 0x00f40000
ath79-nand: block erase failure at 0x00f60000
ath79-nand: block erase failure at 0x00f80000
[====================================> ] 52% ath79-nand: block erase failure at 0x00fa0000
ath79-nand: block erase failure at 0x00fc0000
[=====================================> ] 53% ath79-nand: block erase failure at 0x00fe0000
ath79-nand: block erase failure at 0x01000000
ath79-nand: block erase failure at 0x01020000
[=====================================> ] 54% ath79-nand: block erase failure at 0x01040000
ath79-nand: block erase failure at 0x01060000
[======================================> ] 55% ath79-nand: block erase failure at 0x01080000
ath79-nand: block erase failure at 0x010a0000
[=======================================> ] 56% ath79-nand: block erase failure at 0x010c0000
ath79-nand: block erase failure at 0x010e0000
ath79-nand: block erase failure at 0x01100000
[========================================> ] 57% ath79-nand: block erase failure at 0x01120000
ath79-nand: block erase failure at 0x01140000
[========================================> ] 58% ath79-nand: block erase failure at 0x01160000
ath79-nand: block erase failure at 0x01180000
ath79-nand: block erase failure at 0x011a0000
[=========================================> ] 59% ath79-nand: block erase failure at 0x011c0000
ath79-nand: block erase failure at 0x011e0000
[==========================================> ] 60% ath79-nand: block erase failure at 0x01200000
ath79-nand: block erase failure at 0x01220000
[==========================================> ] 61% ath79-nand: block erase failure at 0x01240000
ath79-nand: block erase failure at 0x01260000
ath79-nand: block erase failure at 0x01280000
[===========================================> ] 62% ath79-nand: block erase failure at 0x012a0000
ath79-nand: block erase failure at 0x012c0000
[============================================> ] 63% ath79-nand: block erase failure at 0x012e0000
ath79-nand: block erase failure at 0x01300000
[=============================================> ] 64% ath79-nand: block erase failure at 0x01320000
ath79-nand: block erase failure at 0x01340000
ath79-nand: block erase failure at 0x01360000
[=============================================> ] 65% ath79-nand: block erase failure at 0x01380000
ath79-nand: block erase failure at 0x013a0000
[==============================================> ] 66% ath79-nand: block erase failure at 0x013c0000
ath79-nand: block erase failure at 0x013e0000
ath79-nand: block erase failure at 0x01400000
[===============================================> ] 67% ath79-nand: block erase failure at 0x01420000
ath79-nand: block erase failure at 0x01440000
[===============================================> ] 68% ath79-nand: block erase failure at 0x01460000
ath79-nand: block erase failure at 0x01480000
[================================================> ] 69% ath79-nand: block erase failure at 0x014a0000
ath79-nand: block erase failure at 0x014c0000
ath79-nand: block erase failure at 0x014e0000
[=================================================> ] 70% ath79-nand: block erase failure at 0x01500000
ath79-nand: block erase failure at 0x01520000
[==================================================> ] 71% ath79-nand: block erase failure at 0x01540000
ath79-nand: block erase failure at 0x01560000
ath79-nand: block erase failure at 0x01580000
[==================================================> ] 72% ath79-nand: block erase failure at 0x015a0000
ath79-nand: block erase failure at 0x015c0000
[===================================================> ] 73% ath79-nand: block erase failure at 0x015e0000
ath79-nand: block erase failure at 0x01600000
[====================================================> ] 74% ath79-nand: block erase failure at 0x01620000
ath79-nand: block erase failure at 0x01640000
ath79-nand: block erase failure at 0x01660000
[=====================================================> ] 75% ath79-nand: block erase failure at 0x01680000
ath79-nand: block erase failure at 0x016a0000
[=====================================================> ] 76% ath79-nand: block erase failure at 0x016c0000
ath79-nand: block erase failure at 0x016e0000
ath79-nand: block erase failure at 0x01700000
[======================================================> ] 77% ath79-nand: block erase failure at 0x01720000
ath79-nand: block erase failure at 0x01740000
[=======================================================> ] 78% ath79-nand: block erase failure at 0x01760000
ath79-nand: block erase failure at 0x01780000
[=======================================================> ] 79% ath79-nand: block erase failure at 0x017a0000
ath79-nand: block erase failure at 0x017c0000
ath79-nand: block erase failure at 0x017e0000
[========================================================> ] 80% ath79-nand: block erase failure at 0x01800000
ath79-nand: block erase failure at 0x01820000
[=========================================================> ] 81% ath79-nand: block erase failure at 0x01840000
ath79-nand: block erase failure at 0x01860000
[==========================================================> ] 82% ath79-nand: block erase failure at 0x01880000
ath79-nand: block erase failure at 0x018a0000
ath79-nand: block erase failure at 0x018c0000
[==========================================================> ] 83% ath79-nand: block erase failure at 0x018e0000
ath79-nand: block erase failure at 0x01900000
[===========================================================> ] 84% ath79-nand: block erase failure at 0x01920000
ath79-nand: block erase failure at 0x01940000
ath79-nand: block erase failure at 0x01960000
[============================================================> ] 85% ath79-nand: block erase failure at 0x01980000
ath79-nand: block erase failure at 0x019a0000
[============================================================> ] 86% ath79-nand: block erase failure at 0x019c0000
ath79-nand: block erase failure at 0x019e0000
[=============================================================> ] 87% ath79-nand: block erase failure at 0x01a00000
ath79-nand: block erase failure at 0x01a20000
ath79-nand: block erase failure at 0x01a40000
[==============================================================> ] 88% ath79-nand: block erase failure at 0x01a60000
ath79-nand: block erase failure at 0x01a80000
[===============================================================> ] 89% ath79-nand: block erase failure at 0x01aa0000
ath79-nand: block erase failure at 0x01ac0000
ath79-nand: block erase failure at 0x01ae0000
[===============================================================> ] 90% ath79-nand: block erase failure at 0x01b00000
ath79-nand: block erase failure at 0x01b20000
[================================================================> ] 91% ath79-nand: block erase failure at 0x01b40000
ath79-nand: block erase failure at 0x01b60000
[=================================================================> ] 92% ath79-nand: block erase failure at 0x01b80000
ath79-nand: block erase failure at 0x01ba0000
ath79-nand: block erase failure at 0x01bc0000
[=================================================================> ] 93% ath79-nand: block erase failure at 0x01be0000
ath79-nand: block erase failure at 0x01c00000
[==================================================================> ] 94% ath79-nand: block erase failure at 0x01c20000
ath79-nand: block erase failure at 0x01c40000
ath79-nand: block erase failure at 0x01c60000
[===================================================================> ] 95% ath79-nand: block erase failure at 0x01c80000
ath79-nand: block erase failure at 0x01ca0000
[====================================================================> ] 96% ath79-nand: block erase failure at 0x01cc0000
ath79-nand: block erase failure at 0x01ce0000
[====================================================================> ] 97% ath79-nand: block erase failure at 0x01d00000
ath79-nand: block erase failure at 0x01d20000
ath79-nand: block erase failure at 0x01d40000
[=====================================================================> ] 98% ath79-nand: block erase failure at 0x01d60000
ath79-nand: block erase failure at 0x01d80000
[======================================================================> ] 99% ath79-nand: block erase failure at 0x01da0000
ath79-nand: block erase failure at 0x01dc0000
[========================================================================] 100%
Another operation is in progress
breed> flash bank 0 write 0x0 0x80000000 0x1de0000
flash bank 0 write 0x0 0x80000000 0x1de0000
Writing flash bank 0 into 0h from memory 80000000h, size 1de0000h
[========================================================================] 100%
Succeeded
breed> reset
引用参考
https://www.right.com.cn/forum/thread-5202135-1-1.html