ASUS RT-N66U/CFE bootloader update


 * 02-12-2012. A bug fixed, please download archive and repeat update again.
 * 04-12-2012. Another bug fixed. For now, no PC is needed, you may update CFE right on the router.

Preamble
This archive is for a CFE bootloader upgrade on Asus RT-N66U router from factory version 1.0.1.2 to version 1.0.1.3.
 * The goal is to return CFE possibility to read variables from NVRAM which is lost while
 * NVRAM been upgraded 64Кб in recent stock firmware releases.

Disclaimer
If you don't need restoration of the this possibility or you just don't know what it is,
 * then better do not to touch the bootloader. Damaged CFE will bricks the router!

You should represent consequences of the actions and you should understand what you are doing
 * in the update process because only you take responsibility for update success. Or fail.

Problem diagnostics
It's enough to set any the NVRAM variable used by CFE and make sure that CFE ignores it.
 * For example, remember the current BogoMIPS value:

then try to change CPU frequency and reboot router: If CFE ignores your settings, BogoMIPS value will remain the same because CFE didn't set new CPU frequency.
 * 1) cat /proc/cpuinfo | grep BogoMIPS
 * 1) nvram set clkfreq=300 && nvram commit && reboot

Updating CFE
Update works only on original ASUS firmware or Merlin's mod, please follow this steps:

1. Download and unpack update script
 * Get access to the RT-N66U console via Telnet/SSH/Serial and type:


 * 1) wget http://wl500g-common.googlecode.com/files/cfe_n66u-1.0.1.3-4.tgz
 * 2) tar -xzf ./cfe_n66u-1.0.1.3-4.tgz

2a. Update current CFE
 * If you did not update before, then type:


 * 1) ./cfe_update.sh /dev/mtd0ro
 * and watch the progress of the update.

The script will ask your final decision before update.

Please, proceed if only two differencies will shown between old and new versions of CFE: --- nvram_orig.txt 2012-12-04 13:49:51.000000000 +0400 +++ nvram_updated.txt 2012-12-04 13:49:51.000000000 +0400 @@ -1 +1 @@ -bl_version=1.0.1.2 +bl_version=1.0.1.3 @@ -16,0 +17 @@ +odmpid=ASUS

2b. Update CFE, using previously saved CFE backup image

If you already done update before, you may fix it with saved CFE image this way:
 * 1) ./cfe_update.sh ./cfe.old

3. Saving old CFE image

Please consider saving your old CFE. A ./cfe.old file will be placed in the same dir with update script, save it to some safe place.
 * Here is original stock CFE 1.0.1.2 for those who never make a backups

The Entware. A modern Optware replacement.

Example script output
Here is an example of the entire output when all went well.

The script checks current CFE version before update to prevent CFE re-update. admin@RT-N66U:/tmp/mnt/SDCARD/tmp# wget --no-check-certificate http://github.com/downloads/ryzhovau/asuswrt-ryzhov/cfe_n66u-1.0.1.3-4.tgz admin@RT-N66U:/tmp/mnt/SDCARD/tmp# tar -xf ./cfe_n66u-1.0.1.3-4.tgz admin@RT-N66U:/tmp/mnt/SDCARD/tmp# ./cfe_update.sh Usage: './cfe_update.sh /dev/mtd0ro' - upgrade current CFE on RT-N66U './cfe_update.sh ./cfe.old' - upgrade CFE using a backup CFE image cfe.old Update works only on original ASUS firmware or Merlin's mod. admin@RT-N66U:/tmp/mnt/SDCARD/tmp# ./cfe_update.sh /dev/mtd0ro Original CFE is already updated! Exiting... admin@RT-N66U:/tmp/mnt/SDCARD/tmp# ./cfe_update.sh ./cfe_original.my [1/4] Dumping default NVRAM settings from original CFE... nvram header found: start  0x400 end    0x1374 len    3956 crc    0xe8 ver    0x01 [2/4] Preparing new CFE... nvram header created: start  0x400 end    0x137c len    3964 crc    0xc3 ver    0x01 [4/5] Checking differences between NVRAM from old and new CFE's --- nvram_orig.txt     2012-12-04 13:49:51.000000000 +0400 +++ nvram_updated.txt  2012-12-04 13:49:51.000000000 +0400 @@ -1 +1 @@ -bl_version=1.0.1.2 +bl_version=1.0.1.3 @@ -16,0 +17 @@ +odmpid=ASUS If you see only two differences: one is for 'bl_version' variable change and second is a new 'odmpid=ASUS' variable then all goes well! [5/5] Flashing new CFE... Do you want to flash a new CFE bootloader that? [y,n]y...flashing... Update completed. Old CFE is stored to cfe.old file, a new one - to cfe.new It's strongly recommended to store them, just in case. Please note, your personal MAC addresses in there, do not distribute them. admin@RT-N66U:/tmp/mnt/SDCARD/tmp#