Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
WRT54G5%5FCFE
WRT54G5 CFE
Page Type: Article
Edit this page (last edited January 3, 2007)
Bookmarks: Bitsum | Wiki | Frontpage | RecentChanges | TitleIndex | CategoryIndex | UserPreferences |
FindPage | HelpPage | SandBox
This is the original WRT54G-GS v5-v6 flashing page, not a republished work. If you find these
works useful, consider donating or see 'supporting this project'.
January 3, 2007
WARNING: Flashing your router with a third-party firmware VOIDs the warranty. You can not rely on a
reversion firmware being available. I never have posted the reversion firmwrare for the GS. Do not return
routers after you've flashed them, this just encourages the vendors to make sure third party firmwares can not
be used.
WARNING: You may brick your router if something goes wrong. You assume full liability for whatever happens
and hold nobody responsible for damages, tangible or intangible, resulting from the use or mis-use of
information or software found here. You (the user) assumes all liability.
1 of 20 2/3/2007 3:46 PM
Bitsum Technologies Wiki - WRT54G5 CFE http://www.bitsum.com/openwiking/owbase/ow.asp?WRT54G5%5FCFE
I spent about a week documenting the firmware image format and deriving the checksum algorithm. While
doing this, I noticed in the disassembly of the decompressed VxWorks boot loader that a capability existed to
update the BSP itself (the same area of flash the CFE occupies). This was a dream come true!
So, I wrote a utility to create, view, extract, and fix firmware images for these units. This utility is fairly
polished, runs under linux and Windows, and includes full C++ source code. At this point it was simply a matter
of embedding appopriate CFEs into a firmware image and letting the VxWorks boot loader flash over itself.
After figuring out how, more time and work were needed to polish the method and make it fool-proof. I then
2 of 20 2/3/2007 3:46 PM
Bitsum Technologies Wiki - WRT54G5 CFE http://www.bitsum.com/openwiking/owbase/ow.asp?WRT54G5%5FCFE
ith DD-WRT micro, these routers are turned into truely useful and well-performing devices. This is especially
true of GS units, which have 16MB of RAM so should run at least as well as the WRT54GL under any
circumstances.
Compatibility
Device Notes
WRT54G v1-v4 unnecessary
WRT54GL v1, v1.1 unnecessary
WRT54G v5 fully supported
WRT54G v5.1 fully supported
WRT54G v6 fully supported
WRT54G-D2 fully supported
WRT54G v7 not supported - Atheros *1
WRT54GS v1-v4 unnecessary
WRT54GS v5 fully supported
WRT54GS v5.1 fully supported
WRT54GS v5.2 fully supported
WRT54GS v6 fully supported
*1 WRT54Gv7 uses a different chipset (reported to be Atheros). I don't have one of these and have not done
any work on it.
*2 Technically speaking, you can use the WRT54G reversion firmware on a WRT54GS. However, your unit will
then believe its a WRT54G and accept WRT54G firmwares.
D D -W R T M I C R O
DD-WRT is currently the only viable option for most users of micro devices.
O P E N W R T MI CR O - X-WRT
Work is on-going to create a good micro build of OpenWrt which utilizes the new webif^2 http management
console (a new generation of the original OpenWrt webif with vastly extended capabilities). This will be
available soon. To encourage its development, [ donate].
3 of 20 2/3/2007 3:46 PM
Bitsum Technologies Wiki - WRT54G5 CFE http://www.bitsum.com/openwiking/owbase/ow.asp?WRT54G5%5FCFE
An alternate tutorial with screenshots is [ here]. It may be very helpful to anyone who has trouble with
these instructions.
F OR THE W R T 5 4G V5, V 5. 1 , A N D V 6 O N LY
Do NOT reboot your router after TFTP'ing, this will happen automatically. It takes a couple minutes after the
TFTP transfer finishes for the firmware to actually be flashed.
F OR THE W R T 5 4G S V 5 , V 5. 1 AN D V 6 O N LY
At the momemnt for GS units this is a one way operation, no reversion back to VxWorks is available.
4 of 20 2/3/2007 3:46 PM
Bitsum Technologies Wiki - WRT54G5 CFE http://www.bitsum.com/openwiking/owbase/ow.asp?WRT54G5%5FCFE
MAC address embedded in it. See the 'Changing your MAC address' section below for more information.
3. Download [ DD-WRT micro generic]. You may want to check [ DD-WRT] to make sure there isn't a
newer version than v23 SP1. Do not use the one labelled 'WRT54G' or 'WRT54GS', use the 'generic'
version.
4. If you don't know how to use (or don't have) a console mode TFTP tool (i.e. tftp.exe), download the
[ Linksys TFTP transfer tool].
5. You will want to assign your network adaptor a manual IP address, since you may loose your
automatically configured one and have trouble TFTP'ing the firmware. To do this see the troubleshooting
section or google it. It's done at the properties dialog of your network connection, in the 'Internet
Protocol (TCP/IP)' properties.
6. Go to your router's web based interface and enter the 'Administration' tab. Then select 'Firmware
Upgrade' and choose the vxworks_prep_gs_v03.bin file. Hit apply. After a minute, your browser window
will go blank. At this point, power cycle your router.
7. Again point your web browser to http://192.168.1.1. You'll see a different sort of firmware upgrade
screen. This is the Management Mode. Select and apply the vxworks_killer_gs_v08.bin firmware upgrade.
WAIT for your browser window to turn to report 'Success'. Have troubles? Try a different web browser,
the http daemon in management mode is very finicky.
8. Now unplug the power cord of your router, then plug it back in. The power LED should now be blinking.
9. Now you need to do a binary mode TFTP transfer of DD-WRT micro generic to your router. To do this you
can use the Windows TFTP console mode utility, the Linksys TFTP Windows GUI utility, or some other
TFTP client. You may have to disable your firewall if by some chance it is blocking outgoing connections
on port 69. Many TFTP clients don't default to binary mode, so be sure to specify it (i.e. the -i switch
with the Windows console mode TFTP utility).
For Windows TFTP console mode utility (example, adjust accordingly):
tftp -i 192.168.1.1 put dd-wrt.v23_micro_generic.bin
For the GUI utility
simply enter your router's IP (192.168.1.1), select dd-wrt.v23_micro_generic.bin,
leave the password field blank, and initiate the transfer.
Do NOT reboot your router after TFTP'ing, this will happen automatically. It takes a couple minutes after the
TFTP transfer finishes for the firmware to actually be flashed.
F I N A LI Z I N G
After your router reboots itself following the TFTP transfer, you should have access to the DD-WRT's HTTP
interface at 192.168.1.1.
Congratulations, you're now running DD-WRT micro! This was a one tim operation, future firmware updates
do not require this process.
If you have problems, please visit an appropriate user forum to get aid from your fellow users. There are many
common problems, and common solutions. I suggest the forums at [ dd-wrt.com].
Remember, the default username and password for a new DD-WRT flash is:
username: root
password: admin
Make sure you waited for the router to flash the firmware and reboot itself. This takes a minute. There
should be no need to power cycle it.
Make sure you flashed the micro generic build of DD-WRT.
5 of 20 2/3/2007 3:46 PM
Bitsum Technologies Wiki - WRT54G5 CFE http://www.bitsum.com/openwiking/owbase/ow.asp?WRT54G5%5FCFE
Q: I can't seem to contact the router after I apply vxworks_killer, so can't TFTP the DD-WRT firmware.
What's up?
You've probably lost your automatically assigned IP address. You need to manually set your network
connection's IP address. Go to the properties of your network connection, select 'Internet Protocol
(TCP/IP)', hit 'Properties', then enter this:
1. IP = 192.168.1.99
2. Subnet mask = 255.255.255.0
3. Gateway = 192.168.1.1
4. (optional) set first DNS server to 192.168.1.1
Some users have reported the need to set the network adaptor to 10Base-T half-duplex. In Windows XP,
this can be found by clicking the 'configure' button beside the name of your network adaptor in the
network connection properties. I suggest trying this if you still can not contact the router. Don't forget
to change it back.
Q: Is my router bricked?
Probably not. If ALL the ethernet port LEDs on the front of the router are constantly lit AND your power
LED is flashing, then yes. Otherwise, NO IT IS NOT BRICKED. It can be recovered. However, it it may not
be recoverable if you do anything crazy like start shorting pins. Be patient, ask for help in the forums.
Try a different build of DD-WRT. The v23 SP2 betas are superior micro builds to the final v23 SP1.
Q: I made a mistake or need help... I mean, with this procedure, not life in general. Where can I get it?
F OR THE W R T 5 4G S V 5 , V 5. 1 AN D V 6 O N LY
6 of 20 2/3/2007 3:46 PM
Bitsum Technologies Wiki - WRT54G5 CFE http://www.bitsum.com/openwiking/owbase/ow.asp?WRT54G5%5FCFE
No automated reversion available for this firmare, use manual reversion below.
F I N A LI Z I N G
If you had troubles, see the [WRT54G5_CFE#trouble_rev trouble shooting] section below. Othewrise, you are
now back to Linksys firmware.
F OR THE W R T 5 4G V5, V 5. 1 , A N D V 6 O N LY
Be sure to run the embed.sh script before flash.sh (even if you don't want to embed a new MAC and
serial). If you don't, it will brick your box because part2.bin won't be found. I will add a protection
against this in the next version.
cd /etc/bsptools
./embed.sh 00-11-22-33-44-55 00-11-22-33-44-56 CGFN12345678
./flash.sh
If there are no errors your router should reboot itself and you should be able to access the VxWorks
management mode via your browser. At this time, flash an original Linksys firmware (do this first even if you
plan to immediately do the vxworks_killer procedure again).
F OR THE W R T 5 4G S V 5 , V 5. 1 AN D V 6 O N LY
7 of 20 2/3/2007 3:46 PM
Bitsum Technologies Wiki - WRT54G5 CFE http://www.bitsum.com/openwiking/owbase/ow.asp?WRT54G5%5FCFE
6. Issue the following commands with your desired MAC addresses and serial number instead. The command
syntax is of the embed.sh step is:
Be sure to run the embed.sh script before flash.sh (even if you don't want to embed a new MAC and
serial). If you don't, it will brick your box because part2.bin won't be found. I will add a protection
against this in the next version.
cd /etc/bsptools
./embed.sh 00-11-22-33-44-55 00-11-22-33-44-56 CGFN12345678
./flash.sh
If there are no errors your router should reboot itself and you should be able to access the VxWorks
management mode via your browser. At this time, flash an original Linksys firmware (do this first even if you
plan to immediately do the vxworks_killer procedure again).
Some have reported this issue. I think it is due to the HTTP server crashing repeatedly, as its very
unstable. Here are my recommendations (not step-by-step):
Keep trying to upload/flash the linksys firmware without rebooting your router until it finally
accepts it. If you catch the HTTP server at the right time, it may work. Others have reported this
works.
You might want to try uploading/flashing vxworks_prep_v03.bin, then reboot your router after it
succceeds. The linksys firmware might now be accepted.
Unplug the power cord of your router. Then plug it back in.
Q: My router isn't responding at http://192.168.1.1 after I flashed vxrevert. Does my router hate me?
Q: My router isn't responding at http://192.168.1.1 after 10 minutes. Is it okay to hit it with a hammer?
Wait another 5 minutes then power cycle your router. Now, are ALL your Ethernet port lights lit? If so,
you may have a bricked router. If not, your router can be recovered. You may need to TFTP the DD-WRT
micro firmware to the router again, but you will have to time the TFTP transfer so that it starts in a 3
second window when your router first turns on.
8 of 20 2/3/2007 3:46 PM
Bitsum Technologies Wiki - WRT54G5 CFE http://www.bitsum.com/openwiking/owbase/ow.asp?WRT54G5%5FCFE
[ VxWorks Killer Image Tool GUI v0.90 beta] Embeds a MAC address into a CFE and builds a
VxWorks compatible image for the WRT54G/GS v5-v6.
You can also use my console mode utility, which is more powerful in that it allows any nvram variables to be
changed/added:
[ IMGTOOL_NVRAM v0.02 alpha] Utility to set/change default NVRAM variables inside a CFE image.
Includes C++ source and Win32 binary.
9 of 20 2/3/2007 3:46 PM
Bitsum Technologies Wiki - WRT54G5 CFE http://www.bitsum.com/openwiking/owbase/ow.asp?WRT54G5%5FCFE
is equivelent to what it was when using the Linksys VxWorks based firmware set the tx power to 84mw.
Post-Install Notes
WRT54GS: How to enable 16MB of RAM
DO NOT DO THIS IF YOU HAVE A WRT54G, YOU WILL BRICK YOUR ROUTER. THIS IS FOR THE GS ONLY. If you try
to do this on other models you will brick your router
This applies only to WRT54GS v5-v6 users who utilized the vxworks_killer v0.7 or below. Only GS units have
16MB of RAM.
Simple as that! Now you should have 16MB of RAM accessible to DD-WRT.
For the curious, here are some notes about the RAM in this unit:
The RAM supports up to 166mhz operation, though it's only running at 100mhz by default on these units.
Recovery
JTAG
Building an unbuffered JTAG cable will allow recovery from any problem. The procedure is the same for
other WRT54G models.
Pin shorting
You changed some random nvram variable or uploaded an incompatible firmware and now your router won't
boot.
I can't recommend strong enough not to do this. The flash pins are delicate and easily damaged. Building an
unbuffered JTAG cable is very easy, don't be scared. If you are scared, or just don't want to build one, contact
Alden @ [ mailto:abessey@runbox.com] to purchase a very nice cable, with headers, at a reasonable price.
So you really want to short pins? At least do it right. Apparently grounding pin 16 (to the antenna shell) works.
Thanks Mungewell for this tip.
10 of 20 2/3/2007 3:46 PM
Bitsum Technologies Wiki - WRT54G5 CFE http://www.bitsum.com/openwiking/owbase/ow.asp?WRT54G5%5FCFE
The full C++ source is included. Currently it can be built under Windows and Linux. A Windows x32 binary and
Ubuntu 6.06 linux binary are included, along with the C++ source code. The code is endian neutral and has
some built in sanity checking to make sure it was built correctly.
[ Download WRT_VX_IMGTOOL v0.94 beta] - Windows x32 binary and C++ source (linux g++
ready).
Usage:
wrt_vx_imgtool
[-x|v|f|b] [-d device] [-c abc] [-m abc] -o outfile infile1 infile2 ...
Operations:
Options:
[-d] Set target device. Causes the code pattern and vendor name to be set to
proper values. By default the device is the WRT54G. Valid devices:
WRT54Gv5
WRT54Gv6
WRT54GSv5
[-c] Over-rides the code pattern. Not recommended.
[-m] Over-rides the vendor name. Not recommended.
Notes:
11 of 20 2/3/2007 3:46 PM
Bitsum Technologies Wiki - WRT54G5 CFE http://www.bitsum.com/openwiking/owbase/ow.asp?WRT54G5%5FCFE
The current verison of this tool does not set the correct nvram checksum or make any other NVRAM header
modifications since these semm to be unused in the default nvram data block, and intead are only used in the
actual nvram storage area. The checksum and other fields appear to be corrected when the default nvram is
copied to the real nvram.
[ IMGTOOL_NVRAM v0.1 alpha] Utility to set/change default NVRAM variables inside a CFE image.
Includes C++ source and Win32 binary.
[ BSPTOOL v0.4 alpha] Utility to manipulate BOOTP parameters. Full c++ source included.
Compatible with MSVC++ and gnu/linux g++.
Usage:
Usage:
bsptool [/v] imagefile [/mac1 x] [/serial x] [/country x] [/vendor
[/device x] [/codep x]
/v view only
/mac1 xx-xx-xx-xx-xx first MAC address
/mac2 xx-xx-xx-xx-xx second MAC address
/serial xxxxxxxxxxxx twelve digit serial number
/device optional device id (WRT54G or WRT54GS)
/country optional country (i.e. US)
/vendor optional vendor (i.e. LINKSYS)
/codep optional code pattern (WG54))
/bootstr optional boot string
imagefile any image with BOOTP at end
Notes:
Sample run:
12 of 20 2/3/2007 3:46 PM
Bitsum Technologies Wiki - WRT54G5 CFE http://www.bitsum.com/openwiking/owbase/ow.asp?WRT54G5%5FCFE
13 of 20 2/3/2007 3:46 PM
Bitsum Technologies Wiki - WRT54G5 CFE http://www.bitsum.com/openwiking/owbase/ow.asp?WRT54G5%5FCFE
(64)
sdram_init=0x419
sdram_config=0x0
sdram_refresh=0x8040
Done!
sdram_config=0x0
burst length : full page
fast memory (CAS 2) : False
sdram_init=0x419
generate refresh cycle : True
generate pre-charge cycle : False
generate mode reg select cycle : False
ext. access control enabled : True
external SDRAM size : 64 Mbit
soft reset : False
self-refresh : False
power down : False
32-bit interface : True
9-bit column : False
sdram_refresh=0x8040
refresh period : 64
refresh enabled : True
Done!
Technical Details
This project was accomplished in less than a week, but it took a bit of effort. The VxWorks BSP had to be
dumped from RAM (its compressed on ROM) and disassembled to derive the checksum algorithm, and to
properly document the firmware image format. Below is documentation and notes developed during this
project that may be useful to others.
Image format
Header
File1
File2
...
File8
14 of 20 2/3/2007 3:46 PM
Bitsum Technologies Wiki - WRT54G5 CFE http://www.bitsum.com/openwiking/owbase/ow.asp?WRT54G5%5FCFE
Trailer1
Trailer2
...
Trailer8
<<EOF>>
The primary files are the only ones of consequence, at least for the moment. The trailing files have an
unknown use and aren't written to the flash.
#define VX_FILE_ID_BOOTROMBIN 1
#define VX_FILE_ID_VXWORKSBIN 2
#define VX_FILE_ID_IGWHTMDAT 3
#define VX_FILE_ID_LANGPAK_EN 6
The header itself is designed to be endian neutral. Integers are stored big endian and are intended to be read
by endian neutral code (that is, read as they are stored).
As stated above, the checksum algorithm includes the header, so no field of the header can be changed
without updating the checksum.
Latest header defintion (for full source with other comments download wrt_vx_imgtool):
////////////////////////////////////////////////////////////////
// Linksys VxWorks based firmware image format
// Author: Jeremy Collake (http://www.bitsum.com)
// WARNING: Work In Progress. Mistakes and guesses are present.
//
#pragma pack(1)
15 of 20 2/3/2007 3:46 PM
Bitsum Technologies Wiki - WRT54G5 CFE http://www.bitsum.com/openwiking/owbase/ow.asp?WRT54G5%5FCFE
F I R M W A R E I MA G E C H E C K SU M A L GO R I TH M
The checksum algorithm is an endian neutral 32-bit unsigned sum of the entire firmware image, including the
header, with the checksum field itself excluded (set to NULL).
Here's my implementation:
/////////////////////////////////////////////////////////////
// Checksum_Linksys_WRT54Gv5_v6
//
// unsigned 32bit checksum of 32bit unsigned integer - endian neutral
//
unsigned long
Checksum_Linksys_WRT54Gv5_v6(unsigned long *pStart, unsigned long *pEnd)
{
unsigned long nChecksum=0;
while(pStart<pEnd)
{
nChecksum+=big_endian_l(*pStart++);
}
return ~(nChecksum-1); // return two's compliment
}
#pragma pack(1)
///////////////////////////////////////////////////////////
// BOOTP pre-requisities
//
typedef struct _MY_MAC_ADDR
{
unsigned __int8 addr[6]; // big endian
16 of 20 2/3/2007 3:46 PM
Bitsum Technologies Wiki - WRT54G5 CFE http://www.bitsum.com/openwiking/owbase/ow.asp?WRT54G5%5FCFE
} MY_MAC_ADDR, *PMY_MAC_ADDR;
////////////////////////////////////////////////////////////
// VxWorks BSP BOOTP definition
// by Jeremy Collake <jeremy@bitsum.com>
// WARNING: This is not an official definition.
//
typedef struct _BOOTP_BLOCK
{
unsigned __int32 dwCodePattern;
unsigned __int16 wChecksum;
unsigned __int16 wUnknown0;
unsigned __int32 dwBootcodeVersion;
SBYTE szDevice[0x40];
SBYTE szVendor[0x40];
SBYTE szCountry[0x20];
SBYTE szSerial[0x20];
unsigned __int8 VersionMajor;
unsigned __int8 VersionMinor;
unsigned __int16 wpciid;
unsigned __int32 dwConfig;
_MY_MAC_ADDR macAddr1;
_MY_MAC_ADDR macAddr2;
_MY_MAC_ADDR macAddr4; /* dunno if this really is a mac */
_MY_MAC_ADDR macAddr3;
SBYTE cUnknown3[0x12];
SBYTE szBootString[770];
} BOOTP_BLOCK, *PBOOTP_BLOCK;
B OOT P C H EC K S U M A L G O RIT H M
I was able to guess at the BOOTP checksum algorithm. Here's my implementation, used in my BSPTOOL utility:
G v5-v6:
17 of 20 2/3/2007 3:46 PM
Bitsum Technologies Wiki - WRT54G5 CFE http://www.bitsum.com/openwiking/owbase/ow.asp?WRT54G5%5FCFE
boardnum=42
boardflags=0x2558
boardrev=0x10
vlan0ports=3 2 1 0 5*
vlan1ports=4 5
wl0gpio0=2
wl0gpio1=5
wl0gpio2=0
wl0gpio3=0
vxkilled=g
GS v5-v6:
boardnum=42
boardflags=0x2758
boardrev=0x10
vlan0ports=3 2 1 0 5*
vlan1ports=4 5
wl0gpio0=2
wl0gpio1=5
wl0gpio2=0
wl0gpio3=0
sdram_init=0x0A
vxkilled=gs
Jobbie Jobs
Give me a holler if you need some work done. I'm broke. Email jeremy@bitsum.com.
Downloads
18 of 20 2/3/2007 3:46 PM
Bitsum Technologies Wiki - WRT54G5 CFE http://www.bitsum.com/openwiking/owbase/ow.asp?WRT54G5%5FCFE
Utilities:
Flash images:
VxWorks Killing
[ VxWorks_Killer_g_v06.zip] - Pre-built firmware image that upgrades a WRT54G v5, v5.1, or v6.
[ vxworks_killer_gs_v08.zip] - Pre-built firmware image that upgrades a WRT54GS v5, v5.1 (brand
new version with 16MB RAM support)
VxWorks Restoring
[ vxworks_revert_v01.zip] VxWorks reversion firmware for the WRT54G v5 and v6. Do not use on
the WRT54GS v5 or v6, unless you want your router to effectively be a WRT54G from now on (and accept
'G' firmwares).
[ http://www.bitsum.com/files/vxworks_reversion_g_v04.zip] VxWorks reversion with MAC and
serial restoration for the WRT54G. This is also a good firmware to use if you need to update your CFE for
some reason since it removes the normal protections on the MTD0 partition.
[[ http://www.bitsum.com/files/vxrevert_manual_gs_v06.zip]] VxWorks reversion with MAC and
serial restoration for the WRT54GS. This is also a good firmware to use if you need to update your CFE
for some reason since it removes the normal protections on the MTD0 partition.
DD-WRT downloads:
[ About DD-WRT]
[ DD-WRT] In the downloads area, find the MICRO build for the WRT54G or WRT54GS.
Links
Alternate tutorials:
[ WRT54Gv5 seies flashing tutorial with screenshots]
Firmwares:
[ Official project page]
[ DD-WRT Firmware] Supports WRT54G v5, v5.1, and WRT54G v6. It is built upon the works of
Broadcom and Linksys and the countless contributors to linux. However, the author is now selling
DD-WRT, placing restrictions on what the free version can do. It is no longer Free Open Source Software.
[ http://www.bitsum.com/xwrt.asp] X-Wrt - an OpenWrt based firmware. A micro build is in
progress and will soon be available and an alternate option.
[ FreeWrt Firmware] A fork of OpenWrt. Will probably work on the WRT54G/GS v5-v6, but you may
need to build your own firmware image.
[ Linksys] Get original firmwares here.
19 of 20 2/3/2007 3:46 PM
Bitsum Technologies Wiki - WRT54G5 CFE http://www.bitsum.com/openwiking/owbase/ow.asp?WRT54G5%5FCFE
Misc.:
[ Bitsum Technologies] My day job.
Acknowledgements
Ex_Cyber, who put up with my delerium on irc while I spent endless hours in IDA, trying to fix a problem
that didn't exist ;).
To all those users who have expressed interest in this project and/or contibuted helpful information.
Search
20 of 20 2/3/2007 3:46 PM