LaFonera Software Flashing
From DD-WRT Wiki
Revision as of 01:52, 28 February 2007 (edit) Sidd (Talk | contribs) (→Preparation) ← Previous diff |
Revision as of 05:45, 28 February 2007 (edit) (undo) Burnte (Talk | contribs) m (Fixing "Max OS X" to "Mac OS X") Next diff → |
||
Line 8: | Line 8: | ||
# Telnet client | # Telnet client | ||
#*For Windows, Putty again will work. | #*For Windows, Putty again will work. | ||
- | #*For | + | #*For Mac OS X, Build in open Terminal |
# Internet access from the Fonera unit for <tt>wget</tt>, or a local webserver to serve the the latest <tt>root.fs</tt> and <tt>vmlinux.bin.l7 </tt>from: http://www.dd-wrt.com/dd-wrtv2/down.php?path=downloads%2Fbeta+releases%2Ffonera+builds/ (Internet access or a webserver is not necessary as long as you can copy the both files locally with scp to the /tmp of the fonera and execute your commands afterwards.) | # Internet access from the Fonera unit for <tt>wget</tt>, or a local webserver to serve the the latest <tt>root.fs</tt> and <tt>vmlinux.bin.l7 </tt>from: http://www.dd-wrt.com/dd-wrtv2/down.php?path=downloads%2Fbeta+releases%2Ffonera+builds/ (Internet access or a webserver is not necessary as long as you can copy the both files locally with scp to the /tmp of the fonera and execute your commands afterwards.) | ||
# TFTP server software | # TFTP server software | ||
Line 152: | Line 152: | ||
#* If you want the firmware directly from FON, download it here: [http://www.fon.com/ Fon.com] ([http://downloads.fon.com/firmware/current/fonera_0.7.1.2.fon Direct link]) then follow these steps to convert it to usable files: | #* If you want the firmware directly from FON, download it here: [http://www.fon.com/ Fon.com] ([http://downloads.fon.com/firmware/current/fonera_0.7.1.2.fon Direct link]) then follow these steps to convert it to usable files: | ||
#*# Remove the first 520 Bytes of the downloaded file. | #*# Remove the first 520 Bytes of the downloaded file. | ||
- | #*#* On Linux, | + | #*#* On Linux, Mac OS X (or other *nixes): '''<tt>tail --bytes +520 fonera_0.7.1.2.fon > fonera_0.7.1.2.tar.gz</tt>''' |
#*#* Windows: Use the mirrored ZIPs which are already converted. | #*#* Windows: Use the mirrored ZIPs which are already converted. | ||
#*# Change the extension of the resulting file to <tt>.tar.gz</tt> and <tt>untar</tt> it. | #*# Change the extension of the resulting file to <tt>.tar.gz</tt> and <tt>untar</tt> it. |
Revision as of 05:45, 28 February 2007
You are here: DD-WRT wiki mainpage / LaFonera / Software / Flashing
Contents |
Preparation
You'll need the following for this tutorial:
- SSH client
- For windows, Putty is a free and popular choice
- For Mac OS X, Built in open Terminal
- Telnet client
- For Windows, Putty again will work.
- For Mac OS X, Build in open Terminal
- Internet access from the Fonera unit for wget, or a local webserver to serve the the latest root.fs and vmlinux.bin.l7 from: http://www.dd-wrt.com/dd-wrtv2/down.php?path=downloads%2Fbeta+releases%2Ffonera+builds/ (Internet access or a webserver is not necessary as long as you can copy the both files locally with scp to the /tmp of the fonera and execute your commands afterwards.)
- TFTP server software
- Simple tftp server for windows: http://sourceforge.net/projects/tftp-server/ or http://kin.klever.net/pumpkin/
- If you're running Linux, here's the simplest cross-distribution way to setup a TFTP server:
- Download http://mirror.usu.edu/mirrors/gentoo/distfiles/tftp-hpa-0.48.tar.bz2 and unpack into a temporary directory. Make sure you have gcc, make, etc installed on your system.
- Build tftp-hpa by running ./configure and then make.
- Become root (or use sudo) and run ./tftpd/tftpd -s -l [tftpdir] where [tftpdir] is your tftp server directory.
- Test with a command-line TFTP client, such as the one that was built with tftp-hpa.
- If you're running Mac OS X, you can use the integrated tftp server:
- Create the tftp server root by typing sudo mkdir /private/tftpboot
- Start the server by typing sudo /sbin/service tftp start
- Test it by typing tftp localhost then get (filename) where (filename) is the name of a file you have put in /private/tftpboot
- If you're running Mac OS X, you can also use this very usefull freeware: http://www.macupdate.com/info.php/id/11116
- (TFTP is not FTP, these are different protocols. TFTP, unlike FTP, is used primarily for transferring files to and from the network equipment (e.g. your router, switch, hub, whatnot firmware upgrade or backup, or configuration backup and restore))
Flashing
- If you have a serial connection skip to step 6
1. Start with a stock LaFonera, with the original firmware (7.x).
2. Enable the built-in SSH server on the Fonera (see here: http://blog.blase16.de/index.php?url=2006/11/28/Hacking-Fonera)
3. Connect via SSH to the Fonera, and execute the following commands:
cd /tmp wget http://fonera.info/camicia/openwrt-ar531x-2.4-vmlinux-CAMICIA.lzma mtd -e vmlinux.bin.l7 write openwrt-ar531x-2.4-vmlinux-CAMICIA.lzma vmlinux.bin.l7 reboot
After the "reboot" command, the LaFonera will reboot and you'll lose the connection.
- Don't be mislead by the name of the file. This is actually a FON kernel hacked to write on the mtd partion with RedBoot. After this step the LaFonera should be able to restart without any problem. In case you are not able to connect to the Internet from the Fonera, you can download the files locally, install an FTP or HTTP server on your PC and wget the files from the PC by entering the local server IP.
4. Again connect via SSH to the Fonera, and execute the following commands. [NOTE Your LaFonera will not boot past RedBoot anymore after this step]
cd /tmp wget http://fonera.info/camicia/out.hex mtd -e "RedBoot config" write out.hex "RedBoot config" reboot
5. Your LaFonera should not be able to completely boot, because the FIS directory will be erased. However, you should be able to connect to the Redboot prompt. To connect to Redboot you need to:
- a) Configure your PC so you have an address like 192.168.1.166.
- b) Connect your PC and the LaFonera through a crossover ethernet cable or a switch and 2 normal cables (note: Many NICs can connect to the Fonera directly with a normal cable, the Fonera may have an autosensing auto-sensing port making a crossover cable unnecessary).
- c) Disconnect and reconnect the power to your LaFonera. In the first 10 secs you can access to RedBoot via a plain Telnet connection on port 9000.
- On Windows, open a Command Prompt window, on Linux, you'll need a terminal window, and type in the following:
telnet 192.168.1.254 9000
- Note the 9000 after the IP. This specifies port 9000, which is the port Redboot is listening on.
- [Use a ip/port scan program like Angry IP Scanner, as soon as it can ping to your LaFonera you can telnet to it for 10 seconds and you can also check if port 9000 is availible]
- [Sometimes you may have to use another telnet client such as Putty. Windows' built-in telnet may fail to show the prompt after rebooting the Fonera]
- If everything goes well you should have a "RedBoot>" prompt in telnet.
6. Download the latest root.fs and vmlinux.bin.l7 from: http://www.dd-wrt.com/dd-wrtv2/down.php?path=downloads%2Fbeta+releases%2Ffonera+builds/
7. Copy root.fs and vmlinux.bin.l7 to your tftp server directory.
- No matter what you use for a TFTP server, RedBoot will try to fetch the files from the root directory, e.g., /root.fs. Make sure your TFTP server is configured to do this as some are not by default.
8. Configure RedBoot for local IP and tftp server enter in telnet.
ip_address -l [local ip address/24] -h [remote server address]
- Replace "[local ip address/24]" with "192.168.1.254/24" and "[remote server address]" with whatever you entered as the IP address of your TFTP server, 192.168.1.166 in this case. If the local IP address changes from 192.168.1.254 your telnet session will die and you will need to reconnect to the newly enter IP address.
9. Run these commands in telnet.
fis init load -r -v -b 0x80041000 root.fs fis create -b 0x80041000 -f 0xA8030000 -l 0x002C0000 -e 0x00000000 rootfs load -r -v -b 0x80041000 vmlinux.bin.l7 fis create -r 0x80041000 -e 0x80041000 -l 0x000E0000 vmlinux.bin.l7 fis create -f 0xA83D0000 -l 0x00010000 -n nvram
- The "fis create" commands take up to 10 minutes or so to complete, so be patient! There will be no output in the terminal window after the programming starts until the programming cycle has been completed. This is normal, don't panic.
- a) This is a sample of the output you will see.
RedBoot> fis init About to initialize [format] FLASH image system - continue (y/n)? y *** Initialize FLASH Image System ... Erase from 0xa83e0000-0xa83f0000: . ... Program from 0x80ff0000-0x81000000 at 0xa83e0000: . load -r -v -b 0x80041000 root.fs Using default protocol (TFTP) Raw file loaded 0x80041000-0x802e3fff, assumed entry at 0x80041000 RedBoot> fis create -b 0x80041000 -f 0xA8030000 -l 0x002C0000 -e 0x00000000 rootfs ... Erase from 0xa8030000-0xa82f0000: ............................................ ... Program from 0x80041000-0x80301000 at 0xa8030000: ............................................ ... Erase from 0xa83e0000-0xa83f0000: . ... Program from 0x80ff0000-0x81000000 at 0xa83e0000: . RedBoot> load -r -v -b 0x80041000 vmlinux.bin.l7 Using default protocol (TFTP) Raw file loaded 0x80041000-0x80120fff, assumed entry at 0x80041000 RedBoot> fis create -r 0x80041000 -e 0x80041000 -l 0x000E0000 vmlinux.bin.l7 ... Erase from 0xa82f0000-0xa83d0000: .............. ... Program from 0x80041000-0x80121000 at 0xa82f0000: .............. ... Erase from 0xa83e0000-0xa83f0000: . ... Program from 0x80ff0000-0x81000000 at 0xa83e0000: . RedBoot> fis create -f 0xA83D0000 -l 0x00010000 -n nvram ... Erase from 0xa83e0000-0xa83f0000: . ... Program from 0x80ff0000-0x81000000 at 0xa83e0000: .
- b) Run this command in telnet to reboot.
reset
Thats it. Your LaFonera should reboot and start DD-WRT. It by default will DHCP an IP address and have management on port 8080.
Resetting NVRAM
If the configuration is corrupted/incorrect, try resetting of the NVRAM. Power up the unit, and wait about 2 minutes, then hold down the Reset button for several seconds. You must do this while the firmware is loaded, hence waiting for a minute or two after powering it up.
If that fails, try these steps:
1. Reset the LaFonera and telnet into the Redboot prompt (see Step 5 above).
2. Enter the following command to erase the NVRAM partition.
fis erase -f 0xA83D0000 -l 0x00010000
3. Reboot the router by entering this command:
reset
You're all done. DD-WRT will rebuild the NVRAM and it will be fresh as spring!
Reflashing La Fonera original firmware
- Download the firmware:
- Download and unzip a pre-converted Zip file:
7.1.1 version (Enable-SSH hole is OPEN in this version): Link
7.1.2 versions (Enable-SSH hole has been patched in this version): Mirror 1 Mirror 2 - If you want the firmware directly from FON, download it here: Fon.com (Direct link) then follow these steps to convert it to usable files:
- Remove the first 520 Bytes of the downloaded file.
- On Linux, Mac OS X (or other *nixes): tail --bytes +520 fonera_0.7.1.2.fon > fonera_0.7.1.2.tar.gz
- Windows: Use the mirrored ZIPs which are already converted.
- Change the extension of the resulting file to .tar.gz and untar it.
- Remove the first 520 Bytes of the downloaded file.
- Download and unzip a pre-converted Zip file:
- You need 2 files from the steps above, kernel.lzma and rootfs.squashfs. Put these in your tftp-server root directory. If you don't have a tftp server, go back the beginning of this document and set one up.
- Connect to the Redboot prompt and type in the following commands:
ip_address -l 192.168.1.254/24 -h 192.168.1.2 fis init load -r -v -b 0x80040450 rootfs.squashfs fis create -b 0x80040450 -f 0xA8030000 -l 0x00700000 -e 0x00000000 rootfs load -r -b %{FREEMEMLO} kernel.lzma fis create -r 0x80041000 -e 0x80041000 vmlinux.bin.l7 fis load -l vmlinux.bin.l7 exec
Reboot the FON and you're done.
Recovery of a non-responsive Fonera
If you've managed to get partway through this guild and find the Fonera doesn't seem to respond anymore, here are a few recovery tricks.
- Set your computer's network card IP to 169.254.255.2 and the Subnet mask to 255.255.0.0. You may need to disconnect/disable all other network cards on that PC to ensure the proper route is used.
- Connect your Fonera to the network card via a network cable.
- In a browser, try to connect to http://169.254.255.1:8080
- If that fails, try to establish an SSH connection to 169.254.255.1
- If that fails, try to establish a TELNET connection to 169.254.255.1 on the standard port (23), or port 9000.
- Power on the Fonera, and after 2 to 4 seconds, try to start the TELNET connection to catch the REDBOOT prompt.
- If that fails, you may have to resort to a serial connection. Serial connect devices are listed in the #External_links section of this guide.
See also LaFonera_Software_Debricking.
External Links
- Here is another complete tutorial on debricking/flashing La Fonera using different methods.
- Hardware layout of the Fonera router.
- "Looking inside the FON La Fonera firmware" Useful info about the FON original firmware package.
- "How to make a dual-supply RS-232 to TTL level converter"
- Alternative serial port cable mod using cell-phone serial-to-USB cables. Requires no soldering, just the cable and two wires.
References
- http://www.dd-wrt.com/phpBB2/viewtopic.php?t=9011&postdays=0&postorder=asc&start=0 Camicia's forum post