Modify Edimax BR-6104K / Sweex LB000021 firmwareModifying and Flashing firmware can lead to fatal errors or even destroys your router! Make sure you have the proper router and proceed at your own risk! |
|
Edimax and Sweex broadband routers use embedded Linux as their operating
system. By taking the firmware upgrade file apart you can modify the ram
image (initrd) part and build a new firmware upgrade file. You need a
Linux operating system to modify the ram image.
If you are not familiar with hex editors, Linux, iptables and DOS
commands this might not be the place for you.
In order to modify the firmware of your router, please refer to the table below and make sure you have the proper router.
This update can only be used with the BR-6104K or LB000021 router using the ADMtek 5120P processor and firmware 2.65 or 2.75! Firmware version 2.75 has a similar layout, but the offsets are different and the tmpimg.img file is compressed with bzip2 instead of gzip. The Edimax and Sweex firmware upgrade files (version 2.65/2.75) have the following layout:
V2.65 Block name V2.75
+--------------------+ 0x00 + 0x00+--------------------+
| Header | | | Header |
+--------------------+ 0x0c | 0x0c+--------------------+
| | | | |
| | | | |
| webpages-6104k.bin | webpages.bin | webpages-6104k.bin |
| gzipped | | | gzipped |
| | | | |
+--------------------+ | +--------------------+
| padding | | | padding |
+--------------------+ 0x20000 + 0x10000+--------------------+
| CSYS header | csys.bin | CSYS header |
+--------------------+ 0x2000c + 0x1000c+--------------------+
| | | | |
| | | | |
| vmlinux.bin | vmlinux.bin.gz | vmlinux.bin |
| gzipped | | | gzipped |
| | | | |
| | | | |
+--------------------+ + +--------------------+
CSYS header is 12 bytes long: 'C' 'S' 'Y' 'S' 0x00 0x00 0x50 0x80 0x1a 0x3f 0x1b 0x00The last 4 bytes contain the file length of vmlinux.bin.gz, in this case 0x1b3f1a (1785626) bytes. vmlinux.bin (unzipped) has the following layout:
V2.65 V2.75
+--------------------+ 0x00 + 0x00+--------------------+
| | | | |
| Kernel | kernel.bin | Kernel |
| | | | |
+--------------------+ 0x16d000 + 0x172000+--------------------+
| tmpimg.img | | | tmpimg.img |
| gzipped | --> ram image tmpimg.img.gz (bz2) | bzip2 |
| +padding | | | +padding |
+--------------------+ 0x28f000 + 0x27c000+--------------------+
Using a hex editor you can extract the various blocks (can be done on Linux or Windows)
After unzipping the kernel block into vmlinux.bin you get 2 additional blocks
You can download a file here
that contains these extracted blocks and some tools to put them back together again.
The newimg.img file can now be used to build the new firmware upgrade file. Make sure it is renamed to tmpimg.img before proceeding so copy it to a location where the other blocks are also stored. Instructions make use of some win32 tools that can be found here.
You can now use the firmware.bin file to upgrade your router! Remarks: Gzip sometimes gives a warning during decompressesion: decompression OK, trailing garbage ignored.This is due to the fact that some blocks contain padding characters at the end of the zipped file. The current firmware is about 1.9 Mb. The flash rom is 2 Mb which means you don't have that much room left to play with. Be careful not to exceed the 2 Mb since I don't know what will happen.
|