LaFonera Software Flashing

From DD-WRT Wiki

Revision as of 05:03, 19 February 2007 by Burnte (Talk | contribs)
Jump to: navigation, search

You are here: DD-WRT wiki mainpage / LaFonera / Software / Flashing

Contents

Flashing DD-WRT on LaFonera

This page is based on info from Camicia's forum post and the instructions that BrainSlayer has released.

You'll need the following for this HowTo:

  1. SSH client
  2. Telnet client
  3. 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/
  4. TFTP server software
    • Simple tftp server for windows: http://kin.klever.net/pumpkin/
    • If you're running Linux, here's the simplest cross-distribution way to setup a TFTP server:
      1. Build tftp-hpa by running ./configure and then make.
      2. Become root (or use sudo) and run ./tftpd/tftpd -s -L [tftpdir] where [tftpdir] is your tftp server directory.
      3. Test with a command-line FTP client, such as the one that was built with tftp-hpa.


If you have a serial connection to LaFonera skip to step 6.


1. Start with a LaFonera with original firmware 7.x

2. Hack the LaFonera to have SSH connection (see here: http://blog.blase16.de/index.php?url=2006/11/28/Hacking-Fonera)

3. Run these commands in SSH. After last command LaFonera will reboot.

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
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 make a internet connection (PPTP) you can download the files, install a ftp or html deamon/server on your PC and wget the files from the PC by entering the local server IP.

4. Run these commands in SSH. After last command LaFonera will reboot. [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 reboot (because the FIS directory will be erased) but you should be able to connect to Redboot. To connect to Redboot you need to:

  • a) Configure your PC so you have an address like 192.168.1.166.
  • b) Establish a ethernet physical connection between your PC and the LaFonera through a crossover ethernet cable or a switch and 2 normal cables.
  • c) Disconnect and reconnect the power to your LaFonera. In the first 10 secs you can access to RedBoot by typing in the following.
telnet 192.168.1.254 9000
This works because 9000 is the port to use. [Some times you better use putty because in telnet the prompt of reboot is not showing]
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 gets fucked up and resetting of the NVram parameters does not work by pressing the Reset button a few seconds long (while firmware is running, so wait a minute after fresh poweron), this is the way to go.

1. Reset the LaFonera and telnet into redboot follow step 5 in Flashing LaFonera above.

2. Enter the following in telnet to erase the nvram partition.

fis erase -f 0xA83D0000 -l 0x00010000

3. Run this command in telnet to reboot.

reset

You're all done. DD-WRT will rebuild the nvram and it will be fresh as spring!

Reflash LaFonera original Firmware

  1. Download Firmware from Fon.com
  2. Remove the first 519 Bytes using dd.
  3. Change the extension of the resulting file to .tar.gz and untar it.
  4. You now have 2 files, kernel.lzma and rootfs.squashfs. Put these to your tftp-server root directory.
  5. Connect to the Redboot prompt and type in the following commands:
#ip_address -l 192.168.1.1/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

Now you have the factory-default firmware for the Fonera.

Another complete HowTo on debricking/flashing the Fonera using different methods can be found here.