TechInfoDepot:DD-WRT/LaFonera Software Debricking
Using Telnet
must be filled but a gudie is here fonerahacks.com
Sorry everybody, but I have to tell this:
I thought I bricked my fonera. I had it connected on my laptop, with power led lit constantly but internet blinking occasionally off (otherwise almost constantly lit). I found some "fonflasher" software, that then told me something about non-arp packets... I thought "what if..." and launched tftpd32 on my laptop, selected dhcp-server from options and gave it a try: my fonera did dhcp discovery request, and got ip from tftpd32! After that, normal telnet procedure went fine. So try this before soldering that serial-cable ;) LiteFun
Getting Started with serial
We will use the serial console to communicate with the device, so first thing you do: Find out what’s really going on by bulding a serial cable. You need MAX232 level converter and some C’s and that’s about it. You can find some instructions for making a serial cable here.
I actually used a MAX202.
There is also a 3.3V VCC at pin 2, but since my MAX232 needed 5V, i didn’t bother.
Then just take your favorite terminal application and connect to serial port using baud rate of 9600 with 8N1 settings.
Booting the LaFonera
It seems that the LaFonera sometimes doesn’t want to boot when connected to serial. This has been narrowed down to the connected TX at the LaFonera side. If you don’t see anything and the little sucker apparently isn’t booting at all, disconnect the TX from the LaFonera and boot with RX connected only. Once you see the first line of output running over your screen, quickly connect TX line. Other people just tried booting and connecting the serial cable only 5sec later, though i suppose you will need some practice, as the point where you need to activate the RedBoot bootloader will come after only a few lines of serial output. Be quick.
So what do we get while booting?
+PHY ID is 0022:5521 Ethernet eth0: MAC address 00:18:84:1b:b9:a8 IP: 0.0.0.0/255.255.255.255, Gateway: 0.0.0.0 Default server: 0.0.0.0 RedBoot(tm) bootstrap and debug environment [ROMRAM] Non-certified release, version v1.3.0 - built 16:57:58, Aug 7 2006 Copyright (C) 2000, 2001, 2002, 2003, 2004 Red Hat, Inc. Board: ap51 RAM: 0x80000000-0x81000000, [0x80040450-0x80fe1000] available FLASH: 0xa8000000 - 0xa87f0000, 128 blocks of 0x00010000 bytes each. == Executing boot script in 1.000 seconds - enter ^C to abort [...]
The last line looks interesting, we’ll need it later. I’ll spare you some lines of bootlog and just post the last 5 lines…
[...] Code: 8c920028 00809821 02408021 <8e020018> 8e030010 30420006 00621825 1460002a 00000000 Kernel panic: Attempted to kill init!
Ok, here we go! Booting ok until the point where it seems to encounter corrupted data in the flash, then just kernel panics. Just boot again and remember the CTRL+C at when it pauses to execute the boot script, which brings us to the RedBoot boot prompt:
RedBoot>
I played a little with it but in the end had to ask someone who knew about it. Essentially i was told to:
- Use Terminal with Xmodem, setup TFTP or HTTP server, provide an image
- Tell the LaFonera where to get the image, make new rootfs and boot
Getting the working image copied onto the device
1. Firstly, choose your preferred method of transport. Most people will have a Terminal programm with Xmodem support i guess. HTTP servers are easy 2 set up, too, some people might even go with the TFTP variant. (Thanx to the people in the comments for pointing out the two easier methods, i actually had to use the TFTP, because i was too lazy to read more about RedBoot…)
- A TFTP OR HTTP server needs to be running on some other machine, e.g. your laptop. I used OS X on a powerbook and just did it the lazy way using TFTP Server, which is a GUI for the TFTP server that was shipped with OS X. Worked almost out of the box, i just had to repair some permissions on the /private/tftpboot folder. The image will later go to this folder.
- The possibility to use HTTP-Server was pointed out in one of the comments, thank you for that! I guess just put the image in the webservers webroot and continue with the next step! :)
- If your terminal program supports sending files via xmodem, you don’t need any servers and can continue with the next steop and prepare the image!
2. Next thing is to prepare an image. For this you download the latest firmware from FON - e.g. from here. The file will be called something like fonera_0.7.1.1.fon. Yes, .fon that is. To make it and .tar.gz you’ll have to remove the first 519 bytes from that file. (If you happen to be using windows - how strange! - you might want to look at comment #15 in case you where wondering about the missing “dd” on your system…)
dd if=fonera_0.7.1.1.fon of=fonera.tar.gz bs=519 skip=1
- Unpack the resulting .tar.gz and copy the file rootfs.squashfs into your TFTP boot folder, e.g. /private/tftpboot.
- Or, as pointed out above: In the HTTP-Servers root-dir.
- For the Xmodem variant just remember were it was unpacked, since it will need to be uploaded later. You can skip the next step and continue with downloading the image!
3. Next, tell the LaFonera client and server IP, or skip this step for the Xmodem variant:
ip_addr -h server_ip -l LaFonera_ip/24
- Do not forget the /netmask_length at the end of your LaFonera_ip - i spent a good while to figure out why i always get a nice Cannot reach server… warning!
RedBoot> ip_addr -h 192.168.6.2 -l 192.168.6.100/24 IP: 192.168.6.100/255.255.255.0, Gateway: 0.0.0.0
4. Now we need to transfer the image file to the LaFonera with our chosen method:
- Download the imagefile using TFTP:
RedBoot> load -r -b %{FREEMEMLO} rootfs.squashfs Using default protocol (TFTP) Raw file loaded 0x80040800-0x801c07ff, assumed entry at 0x80040800
- Or, using http:
RedBoot> load -r -b %{FREEMEMLO} rootfs.squashfs -m HTTP -h 192.168.6.2
- … where 192.168.6.2 is the server ip!
- Or, using Xmodem:
RedBoot> load -r -b %{FREEMEMLO} -m xmodem
- … which should bring up the letter “C” on your console. Now you just use the Xmodem send feature of your terminal programm and transmit the file rootfs.squashfs.
- The last step is to create a new rootfs, replacing the bricked one from before:
RedBoot> fis create rootfs An image named 'rootfs' exists - continue (y/n)? y
Now just reboot and you are all set.