Sometimes development OpenWrt will smash some things on the Wgt's flash that prevent it from booting. Currently (circa July 30, 2010), r22409 is corrupting the nvram partition on flash, which prevents CFE from booting the image. An image built in April, r21175 is okay. I am about to attempt bisecting the problem to discover where/why it goes haywire.

To recover from the missing NVRAM, you need to restore some settings from CFE using setenv -p, like so (adjust your macaddrs appropriately):

CFE> setenv -p STARTUP "ifconfig eth0 -addr=192.168.1.1 -mask=255.255.255.0; boot -elf flash0.os:"
CFE> setenv -p kernel_args "console=ttyS1,115200 root=/dev/ram0 init=/linuxrc rw syst_size=8M"
CFE> setenv -p et0phyaddr 254
CFE> setenv -p et0mdcport 0
CFE> setenv -p configvlan 0x1
CFE> setenv -p et0macaddr 00-0f-b5-3d-58-b6
CFE> setenv -p et1macaddr 00-0f-b5-3d-58-b7

Or, more easily pasted as:

CFE> setenv -p STARTUP "ifconfig eth0 -addr=192.168.1.1 -mask=255.255.255.0; boot -elf flash0.os:"; setenv -p kernel_args "console=ttyS1,115200 root=/dev/ram0 init=/linuxrc rw syst_size=8M" ; setenv -p et0phyaddr 254 ; setenv -p et0mdcport 0 ; setenv -p configvlan 0x1 ; setenv -p et0macaddr 00-0f-b5-3d-58-b6 ; setenv -p et1macaddr 00-0f-b5-3d-58-b7

When nvram is patched, you can reflash by rebooting to CFE, interrupting with Ctrl-C, and the following CFE commands:

CFE> ifconfig eth0 -auto
CFE> flash -noheader 192.168.80.7:wgt634u/openwrt.bin flash0.os
CFE> reboot

or:

CFE> ifconfig eth0 -auto ; flash -noheader 192.168.80.7:wgt634u/openwrt.bin flash0.os ; reboot

From the running system:

cd /tmp
scp russell@192.168.80.7:/tmp/mtdblock4.img /tmp/
mtd write /tmp/mtdblock4.img mtd4

or, for a new test image from iris:

cd /tmp
scp russell@iris.personaltelco.net:src/openwrt-git/openwrt/bin/brcm47xx/openwrt-brcm47xx-squashfs.trx /tmp/
mtd -r write openwrt-brcm47xx-squashfs.trx linux

(the macaddrs will be wrong again, because the mtdblock4.img probably has the wrong ones, but it'll let you try the next bisection anyway)

To expedite things, it is possible to rewrite just the last 8K of flash with this:

CFE> setenv -p et0phyaddr 254
CFE> setenv -p et0mdcport 0
CFE> setenv -p configvlan 0x1
CFE> setenv -p et0macaddr 00-09-5b-f7-0d-da
CFE> setenv -p et1macaddr 00-09-5b-f7-0d-db
CFE> reboot

then:

CFE> ifconfig eth0 -auto ; flash -noheader 192.168.80.7:wgt634u/nvram.img flash0.nvram ; reboot

WgtRecovery (last edited 2016-08-21 02:11:41 by RussellSenior)