CFE bootloader update

  • ATTENTION! As of November 1, 2020, you are not able to reply to threads 6 months after the thread is opened if there are more than 500 posts in the thread.
    Threads will not be locked, so posts may still be edited by their authors.
    Just start a new thread on the topic to post if you get an error message when trying to reply to a thread.
Status
Not open for further replies.

RMerlin

Asuswrt-Merlin dev
After the nvram unset command and a reboot it dosen't give a version output at all now.
A few months ago I implemented displaying the bootloader version in Asuswrt-Merlin's Sysinfo page. I discovered back then that this value doesn't seem to be written back by CFE after you unset it, so I suspected it meant it was only written on a factory default reset, and decided to remove that entry from the Sysinfo page - as it probably meant that it wouldn't be updated if you were to update the bootloader, unless you were to reset back to factory defaults.

It's possible that with a fully 64-KB aware CFE that it would now properly write back the value if it got unset. If that's the case, I might re-add it to the Sysinfo page then.
 
Last edited:

RMerlin

Asuswrt-Merlin dev
I will think how to build universal (x64/i386) ./nvsimple and will upload it in a next version of archive.
If you force build it for i386 (or i586) instead of amd64, it should run under both 32 and 64-bits environments.
 

ryzhov_al

Very Senior Member
If you force build it for i386 (or i586) instead of amd64, it should run under both 32 and 64-bits environments.
How simple.

Koenig, please, check a new version of archive. There is i386 binaries.
 

Koenig

Occasional Visitor
How simple.

Koenig, please, check a new version of archive. There is i386 binaries.

Tried and succeeded:
Terminal said:
[email protected]:~/N66U$ ./cfe_update.sh cfe.original cfe.new
[1/4] Dumping default NVRAM settings from your CFE...
nvram start 0x400
nvram end 0x1388
nvram len 3956
nvram crc 0xc2
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,0270246 s, 151 kB/s
[4/4] Checking differences between NVRAM from old and new CFE's
1c1
< bl_version=1.0.1.2
---
> bl_version=1.0.1.3
16a17
> odmpid=ASUS
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' is prepared for flash.
[email protected]:~/N66U$
I have not yet flashed it to my device though, maybe tomorrow.
Now I'm gonna go see if my pillow still is where I left it.... :)

EDIT: I saw some post earlier about this beeing russian somehow...
Does that mean that the cfe-webserver now will be in russian after I flash this?
 
Last edited:

fritsp1989

Regular Contributor
dude that's some pretty dangerous shirt your doing there !
I will pray for you, i hope with a new CFE this whole 32k thing is over because we bought a router that deserves 64k in CFE.
I am actually mad at asus for not fixing this problem.
Don t get me wrong i just love this router in combination with merlin wrt.
But when merlin wrt and ddwrt could fall in one place dude that's going to be a heck off a party
 

RMerlin

Asuswrt-Merlin dev
dude that's some pretty dangerous shirt your doing there !
I will pray for you, i hope with a new CFE this whole 32k thing is over because we bought a router that deserves 64k in CFE.
I am actually mad at asus for not fixing this problem.
That's probably the very reason why Asus didn't provide a fix for existing routers in my personal opinion: because it was too risky, and could generate too many RMAs.

The RT-AC66U, which was released after the initial issue was discovered, has a fixed CFE already.
 

RMerlin

Asuswrt-Merlin dev
EDIT: I saw some post earlier about this beeing russian somehow...
Does that mean that the cfe-webserver now will be in russian after I flash this?
No. The only thing that is different in the CFE between regions are the default settings (which dictates whether your router wifi will follow EU or US output limitations, for instance), and this procedure takes care of reproducing your old CFE settings into the new one.
 

RocketJSquirrel

Senior Member
What is CFE?
 

kuby8388

Occasional Visitor
I'm very interested to try this out, although I don't quite get the flashing process in the OP. I have written C program before and learned Linux code through watching my dad work (we have 2 computers at home each with a linux OS).

So I was wondering... how does all this work on a linux? For Windows OS changing settings for NVRAM requires either using merlin's custom firmware or telneting in through cmd command, but how does your computer connect to the router on a linux platform exactly to access the router's CFE files?

The reason I want to try this out is because I've notice that ever since I updated to the 64k versions.. my router has been very unstable in terms of performance (plus I bricked it before... because of an unlucky incident). I'm hoping that maybe reinstalling/upgrading my CFE would help.
 
Last edited:

mstombs

Very Senior Member
If you force build it for i386 (or i586) instead of amd64, it should run under both 32 and 64-bits environments.
For future reference use the "-m32" switch to build for 32 bit on 64 bit machine (guess you already found this!), should also use "-Wall" and fix format conversion warnings!

Can use the linux command "file" to report what type of binary, the original bin reported:-

$ file nvsimple
nvsimple: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0xddc936db9b639ce212751ddcc5c26c546de1ff70, not stripped
the fixed one

$ file nvsimple
nvsimple: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x6f2f35cfb6029a300b4409958f6c1fae8d30a7b5, stripped
 

Koenig

Occasional Visitor
I'm a bit reluctant to flash this yet.

At first I was thinking that it didn't matter much since there's still warranty on the unit, and the store that I bought it in is kind of clueless. So my plan was to flash it and if anything goes bad just go to the store, show them it doesn't work and get a replacement.

But they are out of stock on this device right now, and my dear girlfriend would kill me slowly if we were to be without WiFi for even a few days....

EDIT: I also used a HEX-editor to check this:
It's Ok. You are dumping a some region on flash, but not whole 256kB is used by CFE. You may look into cfe.original with any HEX viewer, there is only "FF FF FF .." in the second half of dump which means it's part is unused.
But from what I can see there is not just "FF FF FF..." at the end of the original cfe.
This is the last line I can see in Bless hex-editor:
B7 B9 FE 7D DD FE FF BF EB CD (at offset 0x0003fff6)
 
Last edited:

ryzhov_al

Very Senior Member
But from what I can see there is not just "FF FF FF..." at the end of the original cfe
It's OK, mine original CFE was the same. Original CFE ends at 0x208F0 by 00 00 00... series. Below this address only a garbage lies. You may see how "code density" changes at this address.

In other words, below 0x208F0 is never-been-erased blocks of flash memory. Before flashing new CFE (or firmware via web interface) every block of flash memory needs a erase procedure (this a flash memory feature), so after reflashing there will be "FF FF FF...".
If you ever did an firmware update, then you may see "FF FF FF..." at the end of /dev/mtd1 dump.

So it's Ok.
 
Last edited:

Gingernut

Senior Member
I'm a bit reluctant to flash this yet.

At first I was thinking that it didn't matter much since there's still warranty on the unit, and the store that I bought it in is kind of clueless. So my plan was to flash it and if anything goes bad just go to the store, show them it doesn't work and get a replacement.

But they are out of stock on this device right now, and my dear girlfriend would kill me slowly if we were to be without WiFi for even a few days....

EDIT: I also used a HEX-editor to check this:


But from what I can see there is not just "FF FF FF..." at the end of the original cfe.
This is the last line I can see in Bless hex-editor:
B7 B9 FE 7D DD FE FF BF EB CD (at offset 0x0003fff6)
I've been brave and updated mine. All went fine and haven't noticed anything strange yet.

I've dumped the updated CFE from my unit and hex compared it against my old CFE, I kept a copy just in case, and they are different in alot of places. I assume that means it updated correctly.

When I get a chance I'll do a full router reset and see what's the outcome.

Thanks Ryzhov.
 

fritsp1989

Regular Contributor
Okay i understand, asus is not going to provide a new CFE because what will cause a lot of faulty router probably.
I understand what a CFE is that's not the problem either.
But what i don't understand is if i follow these steps, will i then be able to native run 64k firmware like can i just flash ddwrt and actually see the 64k ?
And how will that work out when i stay with merlin wrt because that uses a kernel hack.

And could someone please make this a bit more fool proof because i already bricked a router with flashing a CFE onto it.
But i am really interested in this and i am ready to learn my piece before i jump in to this.

I think there are a lot of people with a rt-n66u that would really like to have all the options including being able to run ddwrt.
Is there any way that it could be made more simple to flash the CFE.
And could someone explain the PRO's and CON's of this update

EDIT*

Okay after checking the procedure again, the steps are actually quite easy its just a script.
But i think that is what scares me the most LOL.

EDIT*

I Pulled of the CFE of the router, installed ubuntu 64bit in vmware player.
Extracted the archive and ran the script this is what happend

The new CFE is only 5.1 kB ( 5,116 bytes )
The old CFE is about 262.1 kB ( 262,144 bytes )

Well i am not going to flash it anyway or i need to be 100% sure i didn't screw up somewhere.
And i know the cfe doesnt uses it all but the thing is i was curious so i opened up my new CFE with a hex editor.
They are all ZERO's
My old CFE has some lines but the new one is empty as far as i can tell so there has to be something wrong there.
By the way is this a european version or a us version cfe edit ?
If i run the script as root , it gives me ''./cfe_update.sh: 19: ./cfe_update.sh: ./nvserial: not found''
Should i just use a 32bit operating system ?
Also which binary's should i install ?
 
Last edited:

Koenig

Occasional Visitor
I Pulled of the CFE of the router, installed ubuntu 64bit in vmware player.
Extracted the archive and ran the script this is what happend

The new CFE is only 5.1 kB ( 5,116 bytes )
The old CFE is about 262.1 kB ( 262,144 bytes )

Well i am not going to flash it anyway or i need to be 100% sure i didn't screw up somewhere.
And i know the cfe doesnt uses it all but the thing is i was curious so i opened up my new CFE with a hex editor.
They are all ZERO's
My old CFE has some lines but the new one is empty as far as i can tell so there has to be something wrong there.
By the way is this a european version or a us version cfe edit ?
If i run the script as root , it gives me ''./cfe_update.sh: 19: ./cfe_update.sh: ./nvserial: not found''
Should i just use a 32bit operating system ?
Also which binary's should i install ?
Could you do the procedure again and post the entire terminal-"log"?

EDIT: For me it worked "out of the box" on my virtual Ubuntu installation (as soon as Ryzhov compiled the binaries for i386), no root needed
 
Last edited:

ryzhov_al

Very Senior Member
I Pulled of the CFE of the router, installed ubuntu 64bit in vmware player.
Extracted the archive and ran the script this is what happend

The new CFE is only 5.1 kB ( 5,116 bytes )
The old CFE is about 262.1 kB ( 262,144 bytes )

Well i am not going to flash it anyway or i need to be 100% sure i didn't screw up somewhere.
Wait, something wrong. New CFE must be 132Kb.

By the way is this a european version or a us version cfe edit ?
There is no EU or US specific code in CFE, only different NVRAM settings. My script used to take NVRAM from old CFE and "implant" it into new ONE. With all given region codes and unique MAC addresses.

If i run the script as root , it gives me ''./cfe_update.sh: 19: ./cfe_update.sh: ./nvserial: not found''
Should i just use a 32bit operating system ?
Also which binary's should i install ?
Did you unpack archive on Linux?
 

RMerlin

Asuswrt-Merlin dev
What is CFE?
CFE aka pmon aka bootloader. Think of it as the BIOS of a router. It's the first piece of code that gets run at power on time, it initializes basic hardware, allows recovery and such, before transfering control to the Linux kernel, which in turns will boot the actual firmware.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
Wallace_n_Gromit RT-N16 bricked after firmware update? How to rescue? ASUS N Routers & Adapters 4

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

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