Mein aktuelles Bastelprojekt, der Linksys WRT54G-De2 Dieser Router soll in kürze unser Haus mit WLAN versorgen.
Dies ist im wesentlichen eine schnelle Notiz-Seite um mir selbst dinge zusammen zu halten wärend ich am Linksys Arbeite, sollte mich mal ein Anfall überkommen werde ich hier noch alles aufräumen sortieren und schön schreiben
— Bernd 2006/01/25 00:45
eine Seite der Uni über den Linksys.
Ich bin aber eher skeptisch einfach ein paar Beichen des Chips kuzzuschliessen kann ja nicht so gut sein. Ich werde einmal nach dem Datenblatt suchen und schauen was da eigendlich Kuzgeschlossen wird. Habe mir das Datenblatt angesehen dieses Beinchen löst in der Tat einen Reset aus und löscht alles im Speicher.
Der im Router eingebaute Flash Speicher von 8MB ist ein Intel TE28F320B3. Laut http://www.intel.com/design/flcomp/prodbref/298188.htm sind alle Flash Chips der B3 Serie Pinkompatibel, was bedeutet, wo ein 8MB Platz findet, findet auch ein 32MB (o. ä.) Chip Platz! Ich werde also einen solchen besorgen und mal einlöten.
TE28F008B3xA:TSOP-40 ld
Sieh ganz anderst aus, als die anderen da es wohl nicht auf der Firmeware von Linux aufbaut.
Der Router läuft, oder lief eine Zeitlang unter OpernWRT bevor ich DD-WRT fand.
Links:
Eine sehr schöne Firmware mit einem tollen WebIE
Heute habe ich dann letztenendes DD-WRT auf dem Router installiert. Der Router ist jetzt schön über ein WEB Interface auch über https: zu administrieren. Das einzige was mich bis jetzt dran stört ist das diese Firmeware exessiven gebrauch des nvram’s macht und das Systemverzeichnis nicht Les/Schreib-bar ist. Es gibt zwar eine JffS partition, in dieser werden aber nur ein paar config dateien abgelegt. wünschenswert währe dass das Dateisystem wie bei OpenWRT aufgebaut ist und man die Systemdatein einfach bearbeiten kann. So lassen sich Änderungen am System nur mit grossem aufwand (neues Image erstellen und neu Flashen) verwirklichen. Alles in allem ist es eine gelungene Distribution für den Router
DD-wrt Ich erstelle für DD-WRT eine Extra Seite
dort steht zB wie man es Selbst compiliert.
— Bernd 2006/01/23 19:06
— Bernd 2006/01/10 00:28
http://en.wikipedia.org/wiki/HyperWRT
Unterstützt aber mein Vorhaben nicht, der Router lässt sich einfach nicht mit getrennten Adressbereichen für WLAN und LAN configurieren.
https://sourceforge.net/projects/wifi-box/ leider ist im Moment deren Projektseite Offline.
Lässt sich leider nicht installieren.
“Enhanced WRT linux distribution for the Linksys WRT54G” kommt nun in den Test weil WiFi-Box sich nicht installieren ließ. http://www.portless.net/menu/ewrt/
Diese Firmeware bietet so einiges!
Damit kann man schon etwas anfangen! Leider zuwenig für mich
Die configuration des Routers:
Normalerweise werden die Passwörter unverschlüsselt übertragen. Mann kann jedoch leicht einen verschlüsselten Tunnel von Port 80 auf Port 8080 aufbauen um das WebIE zu errreichen.
Tipp: Starte eine sichere Verbindung mit ssh -L 8080:localhost:80
root@[wrt-ip] ssh -L 8080:localhost:80 (Linux) oder C:\Programme\Putty\PuTTY -L 8080:localhost:80
Anschließend im Browser http://localhost:8080/ aufrufen.
~ # cat /proc/mtd dev: size erasesize name mtd0: 00040000 00010000 "pmon" # <- Inital Bootloader mtd1: 003b0000 00010000 "linux" # <- Linux Kernel image (?) mtd2: 002c7a65 00010000 "rootfs" # <- Rootfs rom file (SquashFS) mtd3: 00010000 00010000 "nvram" # <- nvram mtd4: 00050000 00010000 "ddwrt" # <- jffs2 writable Flash Patition ~ # ~ # mount /dev/root on / type squashfs (ro) none on /dev type devfs (rw) proc on /proc type proc (rw) ramfs on /tmp type ramfs (rw) /dev/mtdblock/4 on /jffs type jffs2 (rw)
Weitere informatione wie das Flash des Routers aufgebaut ist gibt es hier
— Bernd 2006/01/25 00:35
Daraus kann man sich ableiten wie man ein Backup des kompletten Routers, bzw der mühsam “live” geändeten und umgebauten Firmeware erstellt. Mann kann mit dd ein Backup erstellen, muss aber das es ein .bin file wird noch den Header davor kopierern, mit dd erhält man nur das .trx file. Den Header kann man Zb von einem anderen oder dem Orginal image nehmen. man sollte aber beachten das man nicht den header eines komplett anderen images anfügt. Näheres ist auf der OpenWRT eite irgendo zu finden, auch wie man aus einem .bin ein .trx macht (ein paar bytes forne abschneiden) und was man abschneidet kann man ja wo anderst getrost wieder anfügen.
In einem Makefile aus den DD-WRT Quellen fand ich dann den hinweis:
#-cp router/mipsel/linux.trx $(RELEASEDIR)/image/linux-glibc.trx # -cp router/mipsel-uclibc/linux.trx $(RELEASEDIR)/image/linux.trx # add CyberTAN header # addpattern -i $(RELEASEDIR)/image/linux.trx -o $(RELEASEDIR)/image/code.bin -g # addpattern_gs -i $(RELEASEDIR)/image/linux.trx -o $(RELEASEDIR)/image/code_gs.bin -g # -cp $(RELEASEDIR)/image/linux.trx $(RELEASEDIR)/image/code.binDas war meine theorie. Heute fand ich im Wiki von openWRT unten Folgendes. Es geht also tatsächlich und das noch sehr einfach.
There are two ways: image method and file method.
It’s a good idea to put the jffs2 partition in read only mode before reading it as a device, or you could make a backup that’s not up to date or corrupt. The default commit interval for jffs2 is 5 seconds. Log into your WRT, then:
mount -o remount,ro /dev/mtdblock/4 / dd if=/dev/mtdblock/1 > /tmp/wrt-linux.trx mount -o remount,rw /dev/mtdblock/4 / dd if=/dev/mtdblock/3 > /tmp/wrt-nvram.bin
And scp the files out. This assumes you have enough ram free on the WRT, which is usually the case. wrt-linux.trx contains kernel+squashfs+jffs2 one after the other. You could back the mtd partitions separately: 2 is squashfs and 4 is jffs2. Unlike disk partitions mtd partitions can, and in OpenWRT do overlap: 1 includes 2 and 4.
/!\ ‘WARNING:’ Restore the NVRAM partition ‘only’ on the same Wrt router where you did the backup! Restoring the NVRAM partition can brick your router.
I’ll assume you need a full restore, i. e. you’ve totally botched your box, and you have either restored to factory firmware, or bought a new box :)
1. install standard openwrt firmware on your box, if you haven’t already. Set up a password so you can use scp:
telnet 192.168.1.1 passwd
2. Transfer the files
scp wrt-linux.trx wrt-nvram.bin root@192.168.1.1:/tmp
3. On the wrt box, don’t forget to put jffs2 in ro mode if your’re writing the whole kernel+squashfs+jffs2 image.
dd if=/tmp/wrt-nvram.bin of=/dev/mtdblock/3 mount -o remount,ro /dev/mtdblock/4 / mtd -r write /tmp/wrt-linux.trx linux
The second command will take a minute or so to flash the rest and then reboot.
Of course you can use a shell script and the well known tar to backup your files and some system informations too. In the example below i installed the package wput, to upload the backup to my main FTP server.
#!/bin/sh # get the own name, to difference different WRTs HOST=$(nvram get wan_hostname) # create a directory, where the backup and tempoarary files will be stored mkdir /tmp/backupfiles NVRAMFILE=/tmp/backupfiles/nvram-$(date +%Y.%m.%d-%X)-$HOST.txt REMOTEFILE2=$(date +%Y.%m.%d-%X)-$HOST.tar.gz # save the nvram values nvram show | sort > $NVRAMFILE # save some other runtime informations SYSINFOFILE=/tmp/backupfiles/sysinfo-$(date +%Y.%m.%d-%X)-$HOST.txt touch $SYSINFOFILE ps axf > $SYSINFOFILE uptime >> $SYSINFOFILE ifconfig >> $SYSINFOFILE route -n >> $SYSINFOFILE wl scan sleep 3; wl scanresults >> $SYSINFOFILE wl status >> $SYSINFOFILE iwconfig >> $SYSINFOFILE # create the tar archive, if you created your own directories below root ( / ), add the directory here too tar czf /tmp/backupfiles/$REMOTEFILE2 /bin/ /dev/ /etc/ /jffs/ /lib/ /rom/ /sbin/ /usr/ /var/ /www/ /tmp/ sleep 3 # now upload the tar file to your prefered FTP server # for the options i used with wput type wput --help /usr/bin/wput -R -v -t 2 -B /tmp/backupfiles/$REMOTEFILE2 ftp://FTPUSERNAME:FTPPASSWORD@FTPSERVER/$REMOTEFILE2 # remove the backup directory (if wanted) to free space rm -r /tmp/backupfiles
– von http://wiki.openwrt.org/BackupAndRestore
— Bernd 2006/05/11 23:50
Es gibt viele wege den Router mit einer neuen FW zu flashen
Eine ist mit mtdkill
/bin/mtdkill write /openwrt-brcm-2.4-squashfs.trx linux
schreibt die datei /openwrt-brcm-2.4-squashfs.trx in die “partition” Linux und startet den Router neu
Der Bootvorgang eine Linksys Routers http://wrt-wiki.bsr-clan.de/index.php?title=Bootvorgang
kopiert aus http://wiki.openwrt.org/OpenWrtDocs/Customizing funktionierende CFE Images können unter
für Version 1.1 von hier
Alle JTAG Software findet man hier
The following is a guide from http://wl500g.dyndns.org/wrt54g.html that I’ve copied here, with added commentary. I am not the original author, that credit goes to Oleg.
Copyright © 2005 Oleg I. Vdovikin IMPORTANT: This information provided AS IS, without any warranties. If in doubt leave this page now. This information applies to WRT54G hw rev 2.0, 2.2, 3.0. No other units were tested, but most likely WRT54GS units should be the same. WRT54G hw rev 1.x use different layout, so you need to adjust things accordingly.
The wrt54g v.2.2 unit was kindly donated to me by maxx, the member of the forum.chupa.nl forum. I would like to publically say thank you to him.
Telnet/ssh to your router running your favorite firmware and type the following
dd if=/dev/mtdblock/0 bs=1 skip=4116 count=2048 | strings > /tmp/cfe.txt dd if=/dev/mtdblock/0 of=/tmp/cfe.bin
Copy both cfe.bin and cfe.txt to your linux box (this is required).
To copy files from your router to your computer, make sure the Dropbear package is installed, and type:
scp root@<router ip>:/tmp/cfe.bin /directory/on/your/computer scp root@<router ip>:/tmp/cfe.txt /directory/on/your/computer
Check cfe.txt, it should look like this (this is from v.2.2):
boardtype=0x0708 boardnum=42 boardrev=0x10 boardflags=0x0118 boardflags2=0 sromrev=2 clkfreq=200 sdram_init=0x000b sdram_config=0x0062 sdram_refresh=0x0000 sdram_ncdl=0x0 et0macaddr=00:90:4C:00:00:00 et0phyaddr=30 et0mdcport=0 gpio5=robo_reset vlan0ports=1 2 3 4 5* vlan0hwname=et0 vlan1ports=0 5 vlan1hwname=et0 wl0id=0x4320 il0macaddr=00:90:4C:00:00:00 aa0=3 ag0=255 pa0maxpwr=0x4e pa0itssit=62 pa0b0=0x15eb pa0b1=0xfa82 pa0b2=0xfe66 wl0gpio2=0 wl0gpio3=0 cctl=0 ccode=0 dl_ram_addr=a0001000 os_ram_addr=80001000 os_flash_addr=bfc40000 lan_ipaddr=192.168.1.1 lan_netmask=255.255.255.0 scratch=a0180000 boot_wait=off watchdog=5000 bootnv_ver=2
Open cfe.txt using text editor and change defaults in the way you like (but be extremely careful, as some changes could prevent device from booting and you will need to use JTAG cable to bring it back to life). For me I’ve decided to enable both Afterburner (Speedbooster) and set boot_wait to on by default, so reset to default no longer messes the things, so I’ve applied this pseudo-patch (please note, that I’ve added bit 0×200 to boardflags to enable afterburner):
+boardflags=0×0318
+boot_wait=on
To make life easier for me, I added “reset_gpio=6” to the cfe.txt file. This way, if I do set something wrong, like clkfreq, and the router just locks up, I wont have to try over and over again to hit a very slim window with the JTAG to erase the nvram. I can just hold reset when the router powers on, and it will use the default nvram values stored in the cfe.
If you do not understand some things in this file, do not try to edit it. This is also applies to afterburner. I’ve also tried to change default lan_ipaddr, but this does not work in the way I expect: CFE started to answer to ping request to new lan_ipaddr, but it does not accept tftp transfers...
You will need a nvserial utility which comes with several GPL tarballs. Linksys supplies it in the wrt54g.1.42.3, wrt54g.1.42.2, wap55ag.1.07, wap54gv2.2.06. Launch nvserial in the way like this on your x86 linux box: You can get nvserial from [WWW] http://downloads.openwrt.org/people/inh/programs/nvserial
nvserial -i cfe.bin -o cfe_new.bin -b 4096 -c 2048 cfe.txt
It works really slow, but it should finally create cfe_new.bin file for you, which has new embedded nvram.
By default most firmwares has pmon partition write protected, i.e. you can’t flash anything to this first 256k of flash. This is to prevent corrupting PMON/CFE. To remove this “lock” you will need to compile your own firmare with the following patch, you will need to copy the patch into “target/linux/linux-2.4/patches/brcm”. (This patch works with WHITERUSSIAN RC3)
+++ linux-2.4.30/arch/mips/bcm947xx/setup.c 2005-09-21 13:48:46.853425632 -0400
@@ -174,7 +174,7 @@ #ifdef CONFIG_MTD_PARTITIONS
static struct mtd_partition bcm947xx_parts[] = {
- { name: "pmon", offset: 0, size: 0, mask_flags: MTD_WRITEABLE, },
+ { name: "pmon", offset: 0, size: 0 /*, mask_flags: MTD_WRITEABLE,*/ },
{ name: "linux", offset: 0, size: 0, },
{ name: "rootfs", offset: 0, size: 0, },
{ name: "nvram", offset: 0, size: 0, },
So, once you’ve recompiled and flashed your new firmware you need you upgrade CFE. This process is dangerous, as flash failure during it will prevent your unit from booting. Copy cfe_new.bin to your wrt54g and flash it. The exact commands are dependent on the firmware. With OpenWrt I’ve used the following:
mtd unlock pmon mtd write -f /tmp/cfe_new.bin pmon
I recommend using the JTAG cable method for re-flashing your CFE. If something were to go wrong, you would end up needing the JTAG cable anyways. It’s really cheap and easy to build, and makes it possible to recover from almost any error you make when writing to the flash. Check out [WWW] http://openwrt.org/OpenWrtDocs/Troubleshooting
Embedded nvram is only used, when real nvram is either corrupted or empty (CRC/magic checks fails), so you will need to erase nvram or to reset to defaults. With OpenWrt type this:
mtd erase nvram
Then cross your fingers and reboot your unit. And remember - I’m not responsible for any damage to your unit, as this information is provided AS IS for my own pleasure. [MAILTO] oleg@cs.msu.su Posted: 2005-04-03
— Bernd 2006/01/24 22:35
Die Hardeware des Routers
Die interne benennung der der Netzwerkschnitstellen
Da ich eine andere Antenne am Linksys betreiben möchte und ich keine RP-TNC Stecker suchen will habe ich einfach den Router göffnet (die Garantie ist ja durch das flashen sowieso weg), die linke (von vorne aus gesehen) RP-TNC Buchse entfernt und duch eine Normale TNC Buchse ersetzt. Diese Buchse ist statt dem RG174 Kabel über ein dickeres, verlustärmeres RG58 Kabel mit der PCB verbunden. So ist es mir möglich meine, bzw andere als die Werksseitig montiereten Antennen mit 2dBi am Router zu verwenden.
Zum Umschalten der Antennen kommt dieser Chip zum Einsatz: Datenblatt S79 Mir ist aber im Moment noch nicht wirklich klar wie die Antennen im Betrieb umgeschaltet werden. Ich vermute das er immer zwischen den zwei Antennen hin und her schaltet und diejenige länger benutzt, die den bessteren Emfang hat.
Eine Anleitung wie man dem Linksys zusätzlichen Speicherplatz durch austausch des Flash Chips zur verfügung stellt.
— Bernd 2006/06/01 02:10
During my research for wrt54-flash-upgrade, it became necessary to adapt the hairydairymaid (aka. ligthbulb) debrick tool. I added two newer SST chips to autodetection, and an “debugging” output of the Flash Vendor ID and the Device ID. I also included v2.0 Images to the package.
Naja, Somit sollt eman einen Anderen SDRAM Chip auflöten können!
— Bernd 2007/03/18 18:06
/dev/tts/0 /dev/tts/1
115200 bit/s 8N1 Maxim243 chip