What's new

CFE bootloader update

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Status
Not open for further replies.
Yes, definitely. On one hand:) On another hand — readable NVRAM is the only way to put Linux kernel boot time parameters, for example. for external rootfs.

I'll take a brick-free CFE before one that allows a feature that only very advanced developers might ever use. Remember that primarily this router is aimed at home users, not at developers. :)

At the very least, they need to make the WPS wiping code work regardless of what is present in the nvram partition - which means it shouldn't read that partition before checking for the WPS button state. I can't say for a fact that it's currently not the case with this CFE, but the fact that you can brick your router just with the combination of 64K CFE + 32K DD-WRT lead to indicate that it might be.

Interesting fact: the RT-AC66U first shipped with CFE 1.0.0.6. Latest CFE version in the GPL is 1.0.1.2 (1.0.1.3 if you consider the CFE version that had dual firmware support, and was reverted back to 1.0.1.2 in recent versions).
 
Ups... Nobody answered, it seems I said something stupid. If that's the case, don't be afraid to say, I'm a grown man, I can take it! :D

- lfbb

The WPS button handling for nvram reset is inside the CFE code, which probably no one here has looked at in depth.
 
What's the best and safer option to clear NVRAM:

- WPS+power on;
- mtd-erase -d nvram
- 'Restore' from web ui;

- lfbb
 
What's the best and safer option to clear NVRAM:

- WPS+power on;
- mtd-erase -d nvram
- 'Restore' from web ui;

- lfbb

They're mostly all the same, they just work in different situations.
 
Hi guys, please, can someone write responsible manual how can i upgrade CFE and dont brick my router? :) Maybe will be good step by step for me :) THX a lot

edit- I must have Linux i my PC? or i must have only WinSCP?
 
Last edited:
ryzhov_al

Could you add the following to the cfe_update.sh script in step2

sed -i 's/vlan1ports=1/vlan1ports=1\ 2\ 3\ 4\ 8*/g' nvram.txt

It prevents people ending up with bricked 1.0.1.3 CFE recovery consoles... after a nvram erase the CFE doesn't initialize the Ethernet bridge.

Looks like a bug in the nvsimple tooling. It exports vlan1ports=1 but in the backup image it says vlan1ports=1 2 3 4 8*

onbricked router with cfe serial hooked up.
CFE >
nvram set vlan1ports="1 2 3 4 8*"
nvram commit
reboot

brings it back to life.
http://www.dd-wrt.com/phpBB2/viewtopic.php?p=726576#726576

Is this right?

- lfbb
 
Last edited:
It seems right. The update script should look like this:

ubuntu20121201184730.png


I'll wait for ryzhov's reply before writing this to pmon.

- lfbb

EDIT:Can we overwrite the current CFE with this one? Or we need to return to 1.0.1.2?
 
Last edited:
Something's wrong. The 'odmpid=ASUS' does not appear in the output. What's wrong?

- lfbb
 
Something's wrong. The 'odmpid=ASUS' does not appear in the output. What's wrong?

- lfbb

For debugging shell scripts, putting a "set -x" command in as an early line (after the "#!" line) will output the shell script lines as they are actually executed, with arguments and variables expanded. This can be helpful. If you want to turn that off later in the script, you can use the "set +x" command.

Also, a lot of times when output doesn't occur it's because of unbalanced quotes where an echo statement is sucked up into an unterminated string. This is something else to look for.
 
Note that the odmpid var was only added a few releases ago (build 220 if I remember correctly).
 
I can set values with spaces for vlan1 but can't manage to include the odmpid variable! :(

lanports.png


- lfbb
 
Made some progress... The missing odmpid variable has something to do with the 2 sed -i lines that precedes it. I've joined that 2 lines in just one and the odmpid var appears in the output file, but the vlan1ports=1 2 3 4 8* not. Any clues?

- lfbb
 
Something's wrong. The 'odmpid=ASUS' does not appear in the output. What's wrong?
Output of what? odmpid variable will be added in cfe_update.sh script. Take a look at renewed CFE:
$ strings /dev/mtd0ro | grep odmpid
odmpid=ASUS
ryzhov_al, the cfe_update.sh did not change and the output cfe_new.bin still has vlan1ports=1
Yes, cfe_update.sh is the same, we just fixed nvsimple binary:
$ strings /dev/mtd0ro | grep vlan1ports
vlan1ports=1 2 3 4 8*
 
lfbb@ubuntu:~$ cd Desktop/cfe
lfbb@ubuntu:~/Desktop/cfe$ ./cfe_update.sh cfe_old.bin cfe_new.bin
[1/4] Dumping default NVRAM settings from your CFE...
nvsimple 0.2 (c) theMIROn
nvram start 0x400
nvram end 0x13d8
nvram len 4036
nvram crc 0x3f
nvram ver 0x01
[2/4] Modifying NVRAM settings (silent step)...
[3/4] Creating new CFE...
4092+0 records in
4092+0 records out
4092 bytes (4.1 kB) copied, 0.0255827 s, 160 kB/s
[4/4] Checking differences between NVRAM from old and new CFE's
0a1,7
> @=
> �=
> �@=
> =
><�=
> =
> �2=
4c11
< bl_version=1.0.1.2
---
> bl_version=1.0.1.3
64c71
< pci/1/1/regrev=3
---
> pci/1/1/regre�����=
176d182
< wait_time=3
If you see only two differences: one is for 'bl_version' and second is a new 'odmpid=ASUS' variable then all step are done! New CFE image 'cfe_new.bin' is prepared for flash.
lfbb@ubuntu:~/Desktop/cfe$
This is what I get running the script, what's wrong? I'm still using 1.0.1.2 CFE as cfe_old.bin, is this ok?

- lfbb
 
Last edited:
Status
Not open for further replies.

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top