« Previous | Next»

Install OpenWRT on the La Fonera

Posted by coldtobi | 23 Jan, 2008, 18:50

Some days ago, I patched the La Fonera to support RedBoot over Ethernet. As this is a very good opportunity trying out OpenWRT, I am gonna install OpenWRT on this piece.

The installation procedure is right quite forward,  basically the same as lined out on the OpenWRT Wiki. However, the pictures given in the Wiki seems not to shows some slightly different numbers which might make beating your heart faster. But it works, and the discrepancy can be ignored.

Neverless, here's a shorter "coldtobi quality" Wink howto. 

As usual, this instructions are linux (debian) ones, adapting for Windows users should be not that hard. However, you are gonna flash an linux-based operating system, and as OpenWrt has no Webinterface to configure, you should be confident enough to do things without touching the mouse. 

Ok, standard disclaimer applies: You break it, you fix it or your buy a new one. You, not me. Well, actually as you have access to the RedBoot via telnet, you should be able to recover from the worst errors, if you only let RedBoot alive. 

Lets stop scaring people here, and start flashing. Just another note: Don't do this in a hurry. The flashing itself is done about in 1/2 hours, but there are some points in the process where you have to be patient: Thee is no feedback on the terminal during several minutes. However, I will mark the points where you have to wait. 

Requisites

You'll need a Fonera, and Redboot enabled to use telnet. (See this post).

Preparation 

1. Get the OpenWRT Kamikaze files.

You find them here. You need thees two guys:
openwrt-atheros-2.6-vmlinux.lzma and openwrt-atheros-2.6-root.squashfs  

2. Install a TFTP Server.

You need it to transfer the flash files to RedBoot. On Debian, there a several "tftp"-serves, I went for "tftpd". This programm is started through inetd, and it does not need any configuration: Just copy the files you downloaded in step 1) to /srv/tftp on the machine. 

3. Configure your network and access RedBoot.

Read the other article for that. Look for the "Test Redboot" section.

Now you should have the following prompt:

telnet 192.168.1.254 9000
== Executing boot script in 4.340 seconds - enter ^C to abort
^C
RedBoot> RedBoot> Trying 192.168.1.254...
Connected to 192.168.1.254.
Escape character is '^]'.

 

4. Installation 

(in the prompts, green is the response of the system, in case you wonder.) 

a) Now at the prompt. Type to configure TCP/IP for the TFTP: "-l" is for the FON-IP, "-h" the tftp server. 

RedBoot> ip_address -l 192.168.1.254 -h 192.168.1.100

IP: 192.168.1.254/255.255.255.0, Gateway: 0.0.0.0
Default server: 192.168.1.100

b) Transfer the first file to the Bootloader.

RedBoot> load -r -b %{FREEMEMLO} openwrt-atheros-2.6-vmlinux.lzma
Using default protocol (TFTP)
Raw file loaded 0x80040800-0x801007ff, assumed entry

c)  Create a new FIS table.

This is necessary, as the flash layout on OpenWRT is different. Note: This might take some time. 

Please note, that is the first step, if executed, cannot be undone by reseting the box. This is the last change to stop! This is why RedBoots insists of confirming this step with a "y".

RedBoot> fis init
About to initialize [format] FLASH image system - continue (y/n)? y
*** Initialize FLASH Image System
... Erase from 0xa87e0000-0xa87f0000: .
... Program from 0x80ff0000-0x81000000 at 0xa87e0000: .

  _ASIP_

d)  Flash the Kernel. Be patient.The output is NOT a progress indicator, it appears first when it is actually done.

RedBoot> fis create -e 0x80041000 -r 0x80041000 vmlinux.bin.l7
... Erase from 0xa8030000-0xa80f0000: ............
... Program from 0x80040800-0x80100800 at 0xa8030000: ............
... Erase from 0xa87e0000-0xa87f0000: .
... Program from 0x80ff0000-0x81000000 at 0xa87e0000: .

e)  Calculate the free memory 

Do a

 RedBoot> fis free
 
0xA80F0000 .. 0xA87E0000

and fire up a calculator in hex mode. Subtract the higher number from the lower. (A87E0000-A80F0000), but be sure to take your numbers! (The might differ, if a new version is released)

f) and load the filesystem image.

RedBoot> load -r -b %{FREEMEMLO} openwrt-atheros-2.6-root.squashfs
Using default protocol (TFTP)
Raw file loaded 0x80040800-0x801607ff, assumed entry at 0x80040800

g) and flash it.

You'll need the number calculated in step e. Just replace the red letters with your result. (If you got something starting with 0xf..., you maybe switched the numbers)

Note: The felt time is maybe close to forever, but this command will also eventually finish! (Maybe 10 Minutes, I didn't use a watch, just a cup of coffee..)

RedBoot> fis create -l 0x6f0000 rootfs
... Erase from 0xa80f0000-0xa87e0000: ...............................................................................................................
... Program from 0x80040800-0x80160800 at 0xa80f0000: ..................
... Erase from 0xa87e0000-0xa87f0000: .
... Program from 0x80ff0000-0x81000000 at 0xa87e0000: .

h) Optional check:

Issuing a fis list should give something like that: 

RedBoot> fis list
Name              FLASH addr  Mem addr    Length      Entry point
RedBoot           0xA8000000  0xA8000000  0x00030000  0x00000000
vmlinux.bin.l7    0xA8030000  0x80041000  0x000C0000  0x80041000
rootfs            0xA80F0000  0x80040800  0x006F0000  0x80040800
FIS directory     0xA87E0000  0xA87E0000  0x0000F000  0x00000000
RedBoot config    0xA87EF000  0xA87EF000  0x00001000  0x00000000

Please note, that there are two entry points, which are not zero. This is ok, even if on the OpenWRT-Wiki this is not the case. This was the last step. Issue "reset" for a safe reboot (pulling the plug *might* be more unsafe, as I don't know if RedBoot caches anything. Probably not, but better safe than sorry!). After some minutes, you'll be able to telnet into OpenWRT: Note, that the IP of a new openwrt is 192.168.1.1. You can only telnet into it, as there is no password set.

You should set the password immediately. Use the following commands and follow the instructions on screen:

  • "passwd" to change the root password.
  • execute "/etc/init.d/dropbear start" to initialize ssh.  Wait till the comand returns: The box is creating the certificates and until it has not completed, ssh will not work. Note, the certificated are also recreated on the first reboot. Also note, that telnet will not work anymore after the next reboot: If a password is set, the unsecure and depreciated telnet will be disabled -- Telnet does not encrypt passwords.
_ASIP_

La Fonera | Comments (1) | Trackbacks (0)

Related Articles:

1 Comments | "Install OpenWRT on the La Fonera" »

  1. KillerDAN : boot script

    18/05/2009, at 18:49 [ Reply ]

    No need to clear/ set boot script ?