Lawrence's Research

From WirelessAfrica
Revision as of 12:24, 20 August 2008 by Ntuthuko (talk | contribs)
Jump to navigation Jump to search

Avila board development [ Avila GW2348-4 Intel XScale IXP425]

The intention of this exercise is to get the board to run Linux. There are number of ways to do this and will consider as many as feasible.

Running OpenWRT on Avila board

The following steps were performed to get the board to run OpenWRT

Requirements

A. Installing and setting up tftp server (Ubuntu, hardy)

B. Download two files 'openwrt-ixp4xx-squashfs.img' and 'openwrt-ixp4xx-zImage'

C. Upload OpenWRT onto the board

A. Installing and setting up tftp server (Ubuntu, hardy)

The diagram below shows the setup we will be using to setup and test the tftp server. The tftp server machine, sun, will be given IP address 192.168.3.1 and the client machine, moon, will be given IP address 192.168.3.2.

Tftp server (sun) to be tested using client PC(moon)














miguel@sun:~ sudo apt-get install xinetd tftpd tftp
miguel@sun:~ vi /etc/xinetd.d/tftp 
Add the following lines in /etc/xinetd.d/tftp
service tftp
{
protocol        = udp
port            = 69
socket_type     = dgram
wait            = yes
user            = nobody               //Please note if you have trouble with running tftpd, change "nobody" to "root"
server          = /usr/sbin/in.tftpd
server_args     = /tftpboot
disable         = no
}
Create /tftpboot directory
miguel@sun:~ sudo mkdir /tftpboot
miguel@sun:~ sudo chmod -R 777 /tftpboot //Please note the permissions need not be 777 but should be at least 444 (i.e readable by all) 
miguel@sun:~ sudo chown -R nobody /tftpboot //Please change "nobody" to "root" if in file /etc/xinetd.d/tftp you have specified "root"
Start tftpd using xinetd
miguel@sun:~ sudo /etc/init.d/xinetd start
Testing tftp server

We test tftp server by transfering a file from a client called 'moon' with IP address 192.168.3.2) to tftp server called 'sun' with IP address 192.168.3.1. Assuming you have file testTFTP.txt in your home directory on the client machine:

miguel@moon:~ ls -l testTFTP.txt
-rw-r--r-- 1 miguel miguel   3551088 2008-04-19 15:52 testTFTP.txt
miguel@moon:~ tftp 192.168.3.1
miguel@moon:~ trace
miguel@moon:~ put testTFTP.txt
sent WRQ <file=testTFTP.txt, mode=netascii>
received ACK <block=0>
sent DATA <block=1, 512 bytes>
received ACK <block=1>
sent DATA <block=2, 512 bytes>
received ACK <block=2>
.
.
.
received]] ACK <block=6933>
sent DATA <block=6934, 512 bytes>
received ACK <block=6934>
sent DATA <block=6935, 512 bytes>
received ACK <block=6935>
sent DATA <block=6936, 368 bytes>
received ACK <block=6936>
Sent 3551088 bytes in 5.8 seconds

Now logon to the 'sun' machine (the tftp server) and run 'ls' and your uploaded file should be there(hopefully).

miguel@sun:~ ls - -l /tftpboot/
-rw-r--r-- 1 root root   3551088 2008-04-19 15:52 testTFTP.txt
We now have a working tftp server!!

B. Download two files, openwrt-ixp4xx-squashfs.img and openwrt-ixp4xx-zImage on to tftp server

Visit http://ftp.iasi.roedu.net/mirrors/openwrt.org/snapshots/ixp4xx/ and download files openwrt-ixp4xx-squashfs.img and openwrt-ixp4xx-zImage and save these files to /tftpboot directory of the tftp server. Make sure the files are readable

miguel@sun:~ ls - -l /tftpboot/
-rw-r--r-- 1 root   root    3551088 2008-04-19 15:52 testTFTP.txt
-rw-r--r-- 1 root   root    1179648 2008-08-06 18:32 openwrt-ixp4xx-squashfs.img
-rw-r--r-- 1 root   root    1034156 2008-08-06 18:32 openwrt-ixp4xx-zImage


C. Upload OpenWRT onto the board

Make sure you have a terminal emulation program, like minicom(*nix) or HyperTerminal(Windows).

Setting up the serial interface on your Laptop/PC. Startup minicom and then Type "Ctrl+a o" or "Ctrl+A O"

+-----[configuration]------+ 
| Filenames and paths      |
| File transfer protocols  |
| Serial port setup        |
| Modem and dialing        |
| Screen and keyboard      |
| Save setup as dfl        |
| Save setup as..          |
| Exit                     |
+--------------------------+

Scroll down to option Serial port setup

+-----------------------------------------------------------------------+
| A -    Serial Device      : /dev/ttyS0                                |
| B - Lockfile Location     : /var/lock                                 |
| C -   Callin Program      :                                           |
| D -  Callout Program      :                                           |
| E -    Bps/Par/Bits       : 115200 8N1                                |
| F - Hardware Flow Control : No                                        |
| G - Software Flow Control : No                                        |
|                                                                       |
|    Change which setting?                                              |
+-----------------------------------------------------------------------+

Select the letters A-G to change the settings and press the "enter" key to get out of the menu back to the main menu. The final settings should be as shown above.

Connect the Avila board to your PC/laptop using a serial cable. Power-up the Avila and repeatedly press Ctrl+C until the board displays Redboot. This is what I see on my board:

+No devices on IDE controller 0
Trying NPE-B...success. Using NPE-B with PHY 0.
Ethernet eth0: MAC address 00:d0:12:03:24:67
IP: 192.168.3.2/255.255.255.0, Gateway: 0.0.0.0
Default server: 192.168.3.1

RedBoot(tm) bootstrap and debug environment [ROM]
Gateworks certified release, version 2.02 - built 05:22:19, Mar  3 2006

Platform: Gateworks Avila GW234X (IXP42X 533MHz) BE
Copyright (C) 2000, 2001, 2002, 2003, 2004 Red Hat, Inc.
Copyright (C) 2004, 2005 Gateworks Corporation

RAM: 0x00000000-0x04000000, [0x000298b0-0x03fc1000] available
FLASH: 0x50000000 - 0x51000000, 128 blocks of 0x00020000 bytes each.
== Executing boot script in 2.500 seconds - enter ^C to abort
^C
RedBoot> ^C
RedBoot> ^C

As shown, my board has the follwoing IP settings:

Local IP address: 192.168.3.2
Local IP address mask: 255.255.255.0
Default server IP address: 192.168.3.1

If after pressing Ctrl+C your board didn't not display the same information as above, then to see your IP settings do this

RedBoot> ip_address
IP: 192.168.3.2/255.255.255.0, Gateway: 0.0.0.0
Default server: 192.168.3.1

Use the "ip_address" command to change the IP settings if you need to. Remember in our case we have the tftp server set to 192.168.3.1 so the line "Default server: 192.168.3.1" above is correct. Change yours if it's not correct.


Now we need to initialize the FLASH

RedBoot>fis init

Answer yes by typing Y or y to the question below

About to initialize [format] FLASH image system - continue (y/n)?

You should see the following output:

*** Initialize FLASH Image System
... Erase from 0x50080000-0x50fe0000: ...............................
.....................................................................
.......................
... Unlock from 0x50fe0000-0x51000000: .
... Erase from 0x50fe0000-0x51000000: .
... Program from 0x03fe0000-0x04000000 at 0x50fe0000: .
... Lock from 0x50fe0000-0x51000000: .
RedBoot>

Next we check to see free available space

RedBoot> fis free
  0x50080000 .. 0x50FE0000

Therefore we have 0x00f60000 (16MB) available space We now copy the linux file from the ftp server as raw data (option -r) to memory address 0x0080000 (option -b) and want a progress indicator (option -v).

RedBoot> load -r -v -b 0x00800000 openwrt-ixp4xx-zImage

This process should take about 5 seconds,if you get any errors then make sure you have the tftp server running correctly and that the file you are copying is there, and further that the IP addresses are correct. From the above command you should see:

Using default protocol (TFTP)
/
Raw file loaded 0x00800000-0x00967c93, assumed entry at 0x00800000
RedBoot>

We proceed to create a flash image which we call 'linux' from the the file we've just loaded from the tftp server.

RedBoot> fis create linux

The output should be

... Erase from 0x50080000-0x50280000: ................
... Program from 0x00800000-0x00a00000 at 0x50080000: ................
... Unlock from 0x50fe0000-0x51000000: .
... Erase from 0x50fe0000-0x51000000: .
... Program from 0x03fe0000-0x04000000 at 0x50fe0000: .
... Lock from 0x50fe0000-0x51000000: .
RedBoot>

then need to We now need to copy the root filesystem from the tftp server as raw data (option -r) to memory address 0x0080000 (option -b) and want a progress indicator (option -v). Type the following command;

RedBoot> load -r -v -b 0x00800000 openwrt-ixp4xx-squashfs.img

The output is:

Using default protocol (TFTP)
/
Raw file loaded 0x00800000-0x00d13fff, assumed entry at 0x00800000 
RedBoot>

We once again check to see the available flash space

RedBoot> fis free
  0x50180000 .. 0x50FE0000

Therefore we have 0x00EF0000(about 14.7MB) of flash available.

We then proceed to create an root filesystem image onto the FLASH using the entire available space.

RedBoot> fis create -l 0xe60000 rootfs

The output should be:

... Erase from 0x50180000-0x50fe0000: ...................................................................................................................
... Program from 0x00800000-0x00920000 at 0x50180000: .........
... Unlock from 0x50fe0000-0x51000000: .
... Erase from 0x50fe0000-0x51000000: .
... Program from 0x03fe0000-0x04000000 at 0x50fe0000: .
... Lock from 0x50fe0000-0x51000000: .
RedBoot> 

Finally, we run the fconfig command to write the boot script and also make any changes we may need.

RedBoot> fconfig

For our purposes we will only specify the boot script and leave the other settings unchanged by entering the "Enter" key. The boot script we will enter is:

>> fis load linux
>> exec

Hit the "enter" key twice after the "exec" word. Enter Y or y when prompted with

Update RedBoot non-volatile configuration - continue (y/n)? y 

The complete output should be:

RedBoot> fconfig
Run script at boot: true
Boot script: 
Enter script, terminate with empty line
>> fis load linux
>> exec
>> 
Boot script timeout (100ms resolution): 25
Use BOOTP for network configuration: false
Gateway IP address: 
Local IP address: 192.168.3.2
Local IP address mask: 255.255.255.0
Default server IP address: 192.168.3.1
Console baud rate: 115200
GDB connection port: 9000
Force console for special debug messages: false
Network debug at boot time: false
Default network device: npe_eth0
Update RedBoot non-volatile configuration - continue (y/n)? y
... Unlock from 0x50fe0000-0x51000000: .
... Erase from 0x50fe0000-0x51000000: .
... Program from 0x03fe0000-0x04000000 at 0x50fe0000: .
... Lock from 0x50fe0000-0x51000000: .
RedBoot> 

Now we reset the Avila board

RedBoot> reset


Linux should now be booting. After a long display of messages you should see the message:

mini_fo: using storage directory: /jffs
- init -

After which it prints

Please press Enter to activate this console.

If you happened to have missed these above messages and it appears as though the board has "hanged" you need to hit the "Enter" key to see the prompt.

BusyBox v1.8.2 (2008-08-06 07:33:12 PDT) built-in shell (ash)
Enter 'help' for a list of built-in commands. 

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 KAMIKAZE (bleeding edge, r12194) -------------------
  * 10 oz Vodka       Shake well with ice and strain
  * 10 oz Triple sec  mixture into 10 shot glasses.
  * 10 oz lime juice  Salute!
 ---------------------------------------------------
root@OpenWrt:/#