Lawrence's Research: Difference between revisions

From WirelessAfrica
(Replacing page with 'Category: Development Team Research Pages migrated to wireless dev')
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category: Development Team Research Pages]]
[[Category: Development Team Research Pages]]
= 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'
migrated to wireless dev
 
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.
[[Image:Tftp.jpg|left|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:/#
 
End!!
===NOTES===
In the above the steps, the root filesystem and the kernel were two different files. In the section on downloading and making our own customized images, we'll show how to combine the two files into one, so that from Redboot we only load one file instead of two.
 
== Configuring the Avila board ==
===Configuring the Ethernet ports ===
By default(from the downloaded images), the two Ethernet ports (eth0 and eth1) are not configurable since their hardware addresses are 00:00:00:00:00:00
root@OpenWrt:~# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:00:00:00:00:00 
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
eth1      Link encap:Ethernet  HWaddr 00:00:00:00:00:00 
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
 
On further inspection, I found that the reason why the hardware addresses are 00:00:00:00:00:00 is because the network drivers for the LAN interfaces were neither loaded (as modules) nor created during compilation!  A solution to the above problem is to download (svn) the source (either the trunk or kamikaze) and then make sure that the LAN network driver modules created/loaded.
 
===Working from the source code===
Create a working space from which you run:
svn co https://svn.openwrt.org/openwrt/trunk/    ///To download the trunk
OR!!!
svn co https://svn.openwrt.org/openwrt/tags/kamikaze_7.09  ///To download the kamikaze release
 
The following steps apply to either the trunk or Kamikaze. After the above commands are done the run:
$make
OR!!
$make menuconfig
 
====To merge the kernel and root filesystem into one image====
During menuconfig, select '''ramdisk''' under option '''Target Images'''. Save the configuration, exit the menu and type '''make''' again.
$make
The build process will take a few hours since it has to download the sources and only then it build the images.
 
After the build process, in the '''bin''' directory you will have either two files '''openwrt-ixp4xx-squashfs.img''' and '''openwrt-ixp4xx-zImage''' or only one file '''openwrt-ixp4xx-zImage''' (provided your selected '''ramdisk''' as you '''Target Image''')
 
'''NOTE: Ramdisk means all changes, you make on the filesystem, will be lost on reboot.'''
 
====Load the image(s)====
Follow the steps described above in section '''C. Upload OpenWRT onto the board'''  to load the images. Check the LAN addresses
root@OpenWrt:~# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:00:00:00:00:00 
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
eth1      Link encap:Ethernet  HWaddr 00:00:00:00:00:00 
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
 
Alas, the LAN hardware addresses are still 00:00:00:00:00:00!!!
====Diagnostics====
When the system starts up, look at the following messages
Using base address 0x00800000 and length 0x0031d030
Uncompressing Linux.......................................................................................................................................... done, booting the kernel.
Linux version 2.6.26.2 (lawrence@bluesky) (gcc version 4.1.2) #1 Fri Aug 22 12:44:15 SAST 2008
CPU: XScale-IXP42x Family [690541c1] revision 1 (ARMv5TE), cr=000039ff
Machine: Intel IXDP425 Development Platform
And in particular the line
Machine: Intel IXDP425 Development Platform
It should instead say
Machine: Gateworks Avila Network Platform
 
Check Redboot's version
RedBoot> version
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.
Apparently this version of Redboot is old which causes it to pass a wrong machine id to the linux kernel; So instead of using openwrt-ixp4xx-zImage as the kernel use the kernel named openwrt-avila-zImage, and everything should be fine.
 
Pheeew!!!
====Final Solution====
So here's the short of story of the above
RedBoot> ^C
RedBoot> fis init
 
About to initialize [format] FLASH image system - continue (y/n)? y
*** Initialize FLASH Image System
... Unlock from 0x50fe0000-0x51000000: .
... Erase from 0x50fe0000-0x51000000: .
... Program from 0x03fe0000-0x04000000 at 0x50fe0000: .
... Lock from 0x50fe0000-0x51000000: .
 
RedBoot> load -r -v -b 0x00800000 openwrt-avila-zImage
 
 
Using default protocol (TFTP)
\
Raw file loaded 0x00800000-0x008f211f, assumed entry at 0x00800000
 
RedBoot> fis create linux
 
... Erase from 0x50080000-0x50180000: ........
... Program from 0x00800000-0x008f2120 at 0x50080000: ........
... Unlock from 0x50fe0000-0x51000000: .
... Erase from 0x50fe0000-0x51000000: .
... Program from 0x03fe0000-0x04000000 at 0x50fe0000: .
... Lock from 0x50fe0000-0x51000000: .
 
RedBoot> load -r -v -b 0x00800000 openwrt-ixp4xx-squashfs.img
 
Using default protocol (TFTP)
\
Raw file loaded 0x00800000-0x0093ffff, assumed entry at 0x00800000
 
RedBoot> fis create -l 0xe60000 rootfs
 
... Erase from 0x50180000-0x50fe0000: ...................................................................................................................
... Program from 0x00800000-0x00940000 at 0x50180000: ..........
... Unlock from 0x50fe0000-0x51000000: .
... Erase from 0x50fe0000-0x51000000: .
... Program from 0x03fe0000-0x04000000 at 0x50fe0000: .
... Lock from 0x50fe0000-0x51000000: .
 
RedBoot> fconfig
 
Run script at boot: true
Boot script:
.. fis load linux
.. exec
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> reset
 
 
===Customizing the firmware===
To include your startup scripts do:
 
1) Create a directory called '''files''' in the trunk/top directory
 
2) From within the '''files''' directory create the subdirectory(ies) and store the file in the appropriate directory
 
3) Rebuild the firmware
 
 
Examples, to have a passwd file in the /etc/ directory do:
mkdir $(TOPDIR)/files/etc/
cp passwd $(TOPDIR)/files/etc/passwd
To have your startup script called '''myinit''' do:
mkdir $(TOPDIR)/files/etc/
cp myinit $(TOPDIR)/files/etc/init.d/myinit
Please note, for startup scripts you MUST at the beginning of the file define the line START $NUMBER
 
e.g.
START 40
This will cause a file '''S40myinit''' to be created in directory /etc/rc.d/
 
====Passing kernel commands at boot time====
By default the kernel is passed the following commands:
root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200 init=/etc/preinit
The above parameters are specified in the '''kernel_menuconfig" option of make, so do:
$make kernel_menuconfig //then select the '''Boot options''' option
 
===Network connection===
I've compiled in the firewall, which by default blocks all incoming connections. For now simply switch off the firewall
root@OpenWrt:/# chmod 666 /etc/init.d/firewall
root@OpenWrt:/# reboot
====Kernel error when loading linux kernel====
I now enable wireless interface wifi0 from file ''''/etc/config/wireless'''.
config wifi-device  wifi0
        option type    atheros
        option channel  11   
        # REMOVE THIS LINE TO ENABLE WIFI:
#      option disabled 1
config wifi-iface
        option device  wifi0
        option mode    sta
        option ssid    avilabatman     
        option encryption none
Now I reboot the board..
root@OpenWrt:/# reboot
Below is what happens
 
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
RedBoot> fis load linux
RedBoot> exec
Using base address 0x00800000 and length 0x000f9378
Uncompressing Linux..................................................................... done, booting the kernel.
Linux version 2.6.26.2 (lawrence@bluesky) (gcc version 4.1.2) #3 Mon Aug 25 15:15:49 SAST 2008
CPU: XScale-IXP42x Family [690541c1] revision 1 (ARMv5TE), cr=000039ff
Machine: Gateworks Avila Network Platform
Memory policy: ECC disabled, Data cache writeback
CPU0: D VIVT undefined 5 cache
CPU0: I cache: 32768 bytes, associativity 32, 32 byte lines, 32 sets
CPU0: D cache: 32768 bytes, associativity 32, 32 byte lines, 32 sets
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
Kernel command line: root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200 init=/etc/preinit
PID hash table entries: 256 (order: 8, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 62720KB available (1892K code, 180K data, 100K init)
SLUB: Genslabs=12, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 640 bytes
NET: Registered protocol family 16
IXP4xx: Using 16MiB expansion bus window size
PCI: IXP4xx is host
PCI: IXP4xx Using direct access for memory space
PCI: bus0: Fast back to back transfers enabled
dmabounce: registered device 0000:00:04.0 on pci bus
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
NET: Registered protocol family 1
IXP4xx Queue Manager initialized.
squashfs: version 3.0 (2006/03/15) Phillip Lougher
Registering mini_fo version $Id$
JFFS2 version 2.2. (NAND) (SUMMARY)  �© 2001-2006 Red Hat, Inc.
msgmni has been set to 122
io scheduler noop registered
io scheduler deadline registered (default)
gpiodev: gpio device registered with major 253
gpiodev: gpio platform device registered with access mask 000002AA
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0xc8000000 (irq = 15) is a XScale
console [ttyS0] enabled
serial8250.0: ttyS1 at MMIO 0xc8001000 (irq = 13) is a XScale
IXP4XX-Flash.0: Found 1 x16 devices at 0x0 in 16-bit bank
  Intel/Sharp Extended Query Table at 0x0031
Using buffer write method
cfi_cmdset_0001: Erase suspend on write enabled
Searching for RedBoot partition table in IXP4XX-Flash.0 at offset 0xfe0000
5 RedBoot partitions found on MTD device IXP4XX-Flash.0
Creating 5 MTD partitions on "IXP4XX-Flash.0":
0x00000000-0x00080000 : "RedBoot"
0x00080000-0x00180000 : "linux"
0x00180000-0x00fe0000 : "rootfs"
mtd: partition "rootfs" set to be root filesystem
mtd: partition "rootfs_data" created automatically, ofs=2E0000, len=D00000
0x002e0000-0x00fe0000 : "rootfs_data"
0x00fe0000-0x00fff000 : "FIS directory"
0x00fff000-0x01000000 : "RedBoot config"
i2c /dev entries driver
ds1672 0-0068: chip found, driver version 0.4
ds1672 0-0068: rtc core: registered ds1672 as rtc0
i2c-gpio i2c-gpio.0: using pins 7 (SDA) and 6 (SCL)
ad7418 0-0028: ad7418 chip found
ad7418 0-0028: configuring for mode 1
IXP4xx Watchdog Timer: heartbeat 60 sec
nf_conntrack version 0.5.0 (1024 buckets, 4096 max)
ip_tables: (C) 2000-2006 Netfilter Core Team
TCP westwood registered
NET: Registered protocol family 17
802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
All bugs added by David S. Miller <davem@redhat.com>
XScale DSP coprocessor detected.
Unknown/missing Avila model number -- defaults will be used
eth0: MII PHY 0 on NPE-B
eth1: MII PHY 1 on NPE-C
Registered led device: user
ds1672 0-0068: setting system clock to 2009-08-26 12:35:01 UTC (1251290101)
VFS: Mounted root (squashfs filesystem) readonly.
Freeing init memory: 100K
Please be patient, while OpenWrt loads ...
- preinit -
Press CTRL-C for failsafe
switching to jffs2
mini_fo: using base directory: /
mini_fo: using storage directory: /jffs
- init - 
Please press Enter to activate this console. firmware: requesting NPE-B
NPE-B: firmware's license can be found in /usr/share/doc/LICENSE.IPL
NPE-B: firmware functionality 0x2, revision 0x2:1
eth0: link down
NET: Registered protocol family 10
lo: Disabled Privacy Extensions
ADDRCONF(NETDEV_UP): eth0: link is not ready
PPP generic driver version 2.4.2
ip6_tables: (C) 2000-2006 Netfilter Core Team
ipt_time loading
wlan: trunk
eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
ath_hal: module license 'Proprietary' taints kernel.
ath_hal: 0.10.5.6 (AR5210, AR5211, AR5212, AR5416, RF5111, RF5112, RF2413, RF5413, RF2133, RF2425, RF2417, REGOPS_FUNC)
ath_rate_minstrel: Minstrel automatic rate control algorithm 1.2 (trunk)
ath_rate_minstrel: look around rate set to 10%
ath_rate_minstrel: EWMA rolloff level set to 75%
ath_rate_minstrel: max segment size in the mrr set to 6000 us
wlan: mac acl policy registered
ath_pci: trunk
PCI: enabling device 0000:00:04.0 (0340 -> 0342)
wifi0: 11a rates: 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
wifi0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
wifi0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
wifi0: H/W encryption support: WEP AES AES_CCM TKIP
ath_pci: wifi0: Atheros 5413: mem=0x48000000, irq=25
skb_under_panic: text:bf0ba140 len:28 put:24 head:c300c61e data:c300c5f8 tail:0xc300c614 end:0xc300c680 dev:<NULL>
Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c3f1c000
[00000000] *pgd=03f4d031, *pte=00000000, *ppte=00000000
Internal error: Oops: 817 [#1]
Modules linked in: ath_pci wlan_xauth wlan_wep wlan_tkip wlan_ccmp wlan_acl ath_rate_minstrel ath_hal(P) wlan_scan_sta wlan_scan_ap wlan nf_nat_tftp nf_conntrack_tftp nf_nat_irc nf_conntrack_irc  nf_nat_ftp nf_conntrack_ftp ipt_TTL xt_MAi
CPU: 0    Tainted: P          (2.6.26.2 #3)
pc : [<c01376b0>]    lr : [<c002d4f8>]    psr: 60000013
sp : c3039d4c  ip : c020630c  fp : c3039d7c
r10: c3e7815c  r9 : c3e7a000  r8 : c3e7815c
r7 : c300c680  r6 : c300c614  r5 : c300c5f8  r4 : c300c61e
r3 : 00000000  r2 : 60000013  r1 : 00000001  r0 : 00000076
Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: 000039ff  Table: 03f1c000  DAC: 00000015
Process wifi (pid: 2227, stack limit = 0xc3038260)
Stack: (0xc3039d4c to 0xc303a000)
9d40:                            c300c61e c300c5f8 c300c614 c300c680 c01dadb0
9d60: c300c61e c3e380c0 00000040 c3e78360 c3039d94 c3039d80 c0138548 c0137668
9d80: c3f903f0 c3e78360 c3039dc0 c3039d98 bf0ba140 c0138518 c3f903f0 c3e78360
9da0: c3e7a000 c3e380c0 c3f90360 00000000 00000000 c3039e08 c3039dc4 bf0ba804
9dc0: bf0b9fa8 c3e785a4 c3e7815c c3e7815c c3e7815c c3e7815c c3e785a4 c300c622
9de0: c3c3b000 00000000 c3e78360 c3f90494 c3e7815c 00000014 c3c1b700 c3039e48
9e00: c3039e0c bf0bfacc bf0ba6d8 bf0cc8d0 00000000 00000000 00000000 c3e785a4
9e20: 00000100 bf0bf98c c0219200 00000000 c3038000 c3eac5c0 c3c1b700 c3039e74
9e40: c3039e4c c003b13c bf0bf998 c3039e4c c3039e4c 00000081 c021900c 0000000a
9e60: 00000000 00000011 c3039e90 c3039e78 c0036ff4 c003b000 00000005 c0207c8c
9e80: 00000000 c3039ea0 c3039e94 c0037380 c0036fa4 c3039ebc c3039ea4 c0021048
9ea0: c0037348 ffffffff 0000001f 00000020 c3039f48 c3039ec0 c0021664 c002100c
9ec0: c3eac5c0 00000004 000008cc 60000013 c3038000 c3e0d1e0 c3eac5c0 00000000
9ee0: 00000011 c3eac5c0 c3c1b700 c3039f48 000000fc c3039f08 00000000 c003122c
9f00: 60000013 ffffffff c3eac5c0 c3039fb0 00000000 c3039fb0 be803308 00000000
9f20: 000a18c0 00000011 00000000 00000000 00000000 00000000 c3039fb0 c3039f8c
9f40: c3039f4c c00315a4 c0030680 00000000 c3f0de80 c3039f60 c007c004 c0073e00
9f60: 00000000 000a18c0 0009a238 000abccc 00000002 c0021be4 c3038000 000af22f
9f80: c3039fa4 c3039f90 c0024b84 c00314b4 00000000 00000000 00000000 c3039fa8
9fa0: c0021a40 c0024b5c 000a18c0 0009a238 000a18c0 000abccc 00000002 00000010
9fc0: 000a18c0 0009a238 000abccc 00000002 00000008 00000044 000af22f 000a18c0
9fe0: 000993f8 be803308 0002ecec 400630f8 60000010 000a18c0 00000000 00000000
Backtrace:
Function entered at [<c013765c>] from [<c0138548>]
  r7:c3e78360 r6:00000040 r5:c3e380c0 r4:c300c61e
Function entered at [<c013850c>] from [<bf0ba140>]
  r5:c3e78360 r4:c3f903f0
Function entered at [<bf0b9f9c>] from [<bf0ba804>]
Function entered at [<bf0ba6cc>] from [<bf0bfacc>]
Function entered at [<bf0bf98c>] from [<c003b13c>]
Function entered at [<c003aff4>] from [<c0036ff4>]
  r8:00000011 r7:00000000 r6:0000000a r5:c021900c r4:00000081
Function entered at [<c0036f98>] from [<c0037380>]
  r6:00000000 r5:c0207c8c r4:00000005
Function entered at [<c003733c>] from [<c0021048>]
Function entered at [<c0021000>] from [<c0021664>]
Exception stack(0xc3039ec0 to 0xc3039f08)
9ec0: c3eac5c0 00000004 000008cc 60000013 c3038000 c3e0d1e0 c3eac5c0 00000000
9ee0: 00000011 c3eac5c0 c3c1b700 c3039f48 000000fc c3039f08 00000000 c003122c
9f00: 60000013 ffffffff                                                     
  r6:00000020 r5:0000001f r4:ffffffff
Function entered at [<c0030674>] from [<c00315a4>]
Function entered at [<c00314a8>] from [<c0024b84>]
Function entered at [<c0024b50>] from [<c0021a40>]
Code: e88d00f0 e58dc010 ebfbee2d e3a03000 (e5833000)
Kernel panic - not syncing: Fatal exception in interrupt
 
Now recompiled the images, first without the madwidi drivers but then the wireless interfaces were not configurable. Then rebuilt the images with madwifi back in; and so far the kernel panic has not occurred. I will need to investigate further as to what causes the kernel panic.
====Current configuration of the board at startup====
1) Switch off the firewall
root@OpenWrt:~# chmod 666 /etc/init.d/firewall
2) Configuration of the interfaces '''/etc/config/network'''
  # Copyright (C) 2006 OpenWrt.org
 
config interface loopback
        option ifname  lo
        option proto    static
        option ipaddr  127.0.0.1
        option netmask  255.0.0.0
config interface lan
        option ifname  eth0
#      option type    bridge
        option proto    static
        option ipaddr  192.168.1.1
        option netmask  255.255.255.0
config interface eth1
        option ifname  eth1
        option proto    dhcp
config interface ath0
        option ifname  ath0
        option proto    static
        option ipaddr  172.16.1.1
        option netmask  255.255.255.0
2) Configguration of the wireless devices '''/etc/config/wireless'''
config wifi-device  wifi0
        option disabled 0
        option type    atheros
        option channel  149
        option agmode 11a
        option country za
 
config wifi-iface                             
        option device  wifi0                 
        option mode    adhoc                   
        option ssid    apex_wifi0 
config wifi-device  wifi1                   
        option disabled 0                   
        option type    atheros             
        option channel  157   
        option agmode 11a     
        option country za
config wifi-iface             
        option device  wifi1 
        option mode    adhoc
        option ssid    apex_wifi1
config wifi-device  wifi2                     
        option disabled 0                     
        option type    atheros               
        option channel  11                   
        option agmode 11bg                   
        option country za
config wifi-iface                             
        option device  wifi2                 
        option network  lan                   
        option mode    ap                   
        option ssid    apex_hotspot 
        option encryption none               
 
3) Web server configuration
 
Either by hand or within the startup script of udhcpd, do this:
mkdir -p /var/lib/misc
touch /var/lib/misc/udhcpd.leases
Otherwise udhcpd will fail to start.
root@OpenWrt:/# udhcpd -f /etc/udhcpd.conf
 
udhcpd (v1.8.2) started
udhcpd: can't open '/var/lib/misc/udhcpd.leases': No such file or directory
udhcpd: bind: Address already in use
 
If you see this error message
udhcpd (v1.8.2) started
udhcpd: bind: Address already in use
Then do this
root@OpenWrt:/etc# netstat -l
and if it shows
udp        0      0 0.0.0.0:67              0.0.0.0:*
Then most likely you need to stop dnsmasq
root@OpenWrt:/etc/rc.d# sh S60dnsmasq stop
Here's the configuration file '''/etc/udhcpd.conf''' stub
# replace these with your own ip address range as appropriate
start 192.168.1.2
end 192.168.1.250
interface eth0 # replace this if your network runs on eth1, eth2, ath0, etc.
                # Make sure the IP address specified in "start" and "end"
                # match the IP address of the interface specified here
# these options are for bootp.. PXE uses this to figure out which server to
# go to for tftp.  This will be the ip address of your dhcp/tftp server
#siaddr 10.1.1.254
#sname dhcp_server_name # the name of your dhcp server
#boot_file /tftpboot/pxelinux.0
#set up dns, routes and other info
opt dns 192.168.1.1 # (replace with your DNS servers)
opt subnet 255.255.255.0 # replace with your subnet if it's different
opt router 192.168.1.1 # replace with your gateway
option domain local
option lease 864000 # 10 days of seconds
#opt tftp 10.1.1.254 # the IP address of your tftp/dhcp server
 
4) Wireless interfaces auto configuration at startup '''/etc/init.d/netinit'''
 
Note this script is included in the firmware at build time. See section '''Customizing firmware'''
#!/bin/sh /etc/rc.common
# Copyright (C) 2008
START=39
#
# This scheme of calculating IP addresses is based on two observed patterns:
#  1. The Ethernet addresses for first Ethernet port(eth0) of the Avila boards differ on the 6th byte.
#  2. The Ethernet addresses for Atheros cards (we have, so far) differ on the 6th byte
#
#  So, for the IPv4 IP address,A.B.C.D,
#
#  A -- is fixed, currently set to 10
#  B -- is the 6th byte of eth0's MAC address
#  C -- is the lowest nibble of the 6th byte of eth0's MAC address, for interface eth0 only
#    -- is the 6th byte of the wifi card's MAC address, for wifi interfaces only
#  D -- is fixed to 1
#
#  E.g. For eth0 with MAC address 00:D0:12:03:24:67,
#      Interface ath0(wifi) with MAC address 00:80:48:4F:24:DA
#      Therefore,
#            the 6th byte is '67'
#      Implies;
#              eth0's IP address is 10.103.3.1
#              ath0's IP address is 10.103.218.1
#
#
#
#  Returns A (which is always fixed) in IP address A.B.C.D
#
get_a_class()
{
    a_class=10;
    echo "$a_class"
}
#
#  Returns B in IP address A.B.C.D
#
get_b_class()
{
    b_class=$(ifconfig eth0 | grep HW | sed  's/^.*HWaddr //' | awk ' {split($1,e,":"); \
      b = "0x" e[6]; \
      printf("%01d\n", b); }')
    echo $b_class
}
#
#  Input  : interface name
#  Returns : C in IP address A.B.C.D
#
get_c_class()
{
    case $1 in
#  wifi*) c_class=$(ifconfig $1 | grep HW | sed  's/^.*HWaddr //' | awk ' {split($1,e,"-"); \
#    c = "0x" e[6]; \
#
#    printf("%01d\n", c); }')
    wifi0) c_class=0
    ;;
  wifi1) c_class=1
    ;;
  wifi2) c_class=2
    ;;
    eth*) c_class=$(ifconfig $1 | grep HW | sed  's/^.*HWaddr //' | awk ' {split($1,e,":"); \
      c = "0x" e[6]; c = and (c,0x0f); \
      printf("%01d\n", c); }')
    ;;
    *)  c_class=10
      ;;
    esac
    echo $c_class
}
#
#  Input  : Ethernet interface name
#  Output : A.B.C.D
#
get_ipaddr()
{
    cc=$1
    echo $(get_a_class).$(get_b_class).$(get_c_class $1).1
}
create_dnsmasq_conf()
{
cat >/etc/dnsmasq.conf <<-EOF
# filter what we send upstream
domain-needed
#
bogus-priv
filterwin2k
localise-queries
#
# allow /etc/hosts and dhcp lookups via *.lan
local=/lan/
domain=lan
expand-hosts
no-negcache
resolv-file=/etc/resolv.conf
#
# enable dhcp (start,end,netmask,leasetime)
dhcp-authoritative
dhcp-range=eth0,$(get_a_class).$(get_b_class).$(get_c_class eth0).100,$(get_a_class).$(get_b_class).$(get_c_class eth0).150,255.255.255.0,12h
dhcp-range=ath2,$(get_a_class).$(get_b_class).$(get_c_class ath2).100,$(get_a_class).$(get_b_class).$(get_c_class ath2).150,255.255.255.0,12h
dhcp-leasefile=/tmp/dhcp.leases
#
# use /etc/ethers for static hosts; same format as --dhcp-host
# <hwaddr> <ipaddr>
read-ethers
#
# other useful options:
# default route(s): dhcp-option=3,192.168.1.1,192.168.1.2
#    dns server(s): dhcp-option=6,192.168.1.1,192.168.1.2
dhcp-option=15,"cids.org.za meraka.csir.co.za"
EOF
}
create_network()
{
cat >/etc/config/network <<-EOF
# Copyright 2008
config interface loopback
    option ifname  lo
    option proto  static
    option ipaddr  127.0.0.1
    option netmask 255.0.0.0
config interface eth0
    option ifname  eth0
    option proto    static
    option ipaddr  $(get_ipaddr eth0)
    option netmask  255.255.255.0
config interface eth1
    option ifname  eth1
    option proto  dhcp
config interface ath0
    option ifname  ath0
    option proto  static
    option ipaddr  $(get_ipaddr wifi0)
    option netmask 255.255.255.0
config interface ath1
    option ifname  ath1
    option proto  static
    option ipaddr  $(get_ipaddr wifi1)
    option netmask 255.255.255.0
config interface ath2
    option ifname  ath2
    option proto  static
    option ipaddr  $(get_ipaddr wifi2)
    option netmask 255.255.255.0
EOF
}
create_wireless()
{
cat >/etc/config/wireless <<-EOF
# Copyright 2008
config wifi-device  wifi0
    option disabled 0
    option type    atheros
    option channel  110
    option agmode 11a
config wifi-iface
    option device  wifi0
    option mode adhoc
    option ssid avila_batman_backhaul0
    option encryption none
config wifi-device  wifi1
    option disabled 0
    option type    atheros
    option channel  111
    option agmode 11a
config wifi-iface
    option device  wifi1
    option mode    adhoc
    option ssid    availa_batman_backhaul1
    option encryption none
config wifi-device  wifi2
    option disabled 0
    option type    atheros
    option channel  11
    option agmode 11bg
config wifi-iface
    option device  wifi2
    option mode    ap
    option ssid    avila_batman_hotspot
    option encryption none
EOF
}
start() {
    setup_switch() { return 0; }
    include /lib/network
    setup_switch
    [ -s /etc/config/wireless ] || \
      /sbin/wifi detect > /etc/config/wireless
        /sbin/wifi up
    chmod -x /etc/init.d/firewall
    sleep 1
        create_wireless
    create_dnsmasq_conf
    create_network
    /sbin/wifi up
    ifup -a
### main logic ###
#case "$1" in
#  start)
#    start
#    ;;
#esac
 
===Booting from Compact Flash===
Kamikaze doesn't support Compact flash. So I got the latest source code branch (8.09) from Openwrt:
svn co https://svn.openwrt.org/openwrt/branches/8.09
 
I've created (using cfdisk /dev/sdb) four partitions on the 128MB of 32MB each.
  cfdisk /dev/sdb
Then I created I ext2 file systems for all the the paritions using (mke2fs /dev/sdb1,2,3,4).
mke2fs /dev/sdb1
I copied the Linux kernel into the first partition (cp linux /dev/sdb1) and copied the root file system into the second partions (cp rootfs /dev/sdb2)
$cp linux /dev/sdb1
$cp rootfs /dev/sdb2
 
Redboot script used so far:
 
>> load -r -m disk -b 0x01600000 hda1:linux
>> load -r -m disk -b 0x00800000 hda2:rootfs
>> exec -c "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200 init=/etc/preinit" 0x01600000
 
Default kernel command as set in kamikaze (make kenerl_menuconfig) is:
root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200 init=/etc/preinit
 
 
USING RAMDISK
RedBoot> load -r -m disk -b 0x01600000 hda1:linux
Raw file loaded 0x01600000-0x018f662f, assumed entry at 0x01600000
RedBoot> exec -c "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200 init=/etc/preinit" 0x01600000
 
===Things to do===
* Find out how the kernel scans for Mini-PCI slots. That is, how does it determine which slot to name/assign interface '''ath0''', '''ath1''', etc.
* Configure udhcpd. '''Done!!!!'''
* Ensure '''eth0''' does not accept DHCP-offered addresses when plugged to a network. At the moment it accepts IPv6 address.
* Ensure '''eth1''' doesn't respond to DHCP requests. Although '''udhcpd.conf''' should do this!!!
* Submit to OpenWRT that
root@OpenWrt:~# hostid
Segmentation fault
*Create startup scripts for all services needed, batman, udhcpd, etc.
*Find out if dnsmasq is needed, if so then resolve conflict with udhcpd.They both seem to use port 67!!!
 
===NOTES===
====Identifying the Mini-PCI slots to interface names====
With the board facing up and the Ethernet ports facing away from you, the slot on your left (Top Left) is  scanned first, followed by the slot on the right (Top Right), followed by the slot below the first slot (Bottom Left) and lastly the slot below the second one (Bottom Right).
 
So if all slots are filled with cards you will have:
 
Slot 1 (Top Left)    -- ath0
Slot 2 (Top Right)    -- ath1
Slot 3 (Bottom left)  -- ath2
Slot 4 (Bottom right) -- ath3
 
However, please note that the assignment of interface names ( i.e ath0, 1, 2,...) depends on which device is found/detected first. I.e. if slot 1 is empty, then ath0 will be on slot 2, ath1 on slot 3, etc.
 
=Features of the APEX High Performance Node (HPN)=
==Network configuration==
===Ethernet Network===
*'''eth0'''
**Identification: This is the port closest to the power injector.
**Function(s)  : It provides power over Ethernet. It is used to respond to DHCP requests.
**IP address    : IP address is fixed.
*'''eth1'''
**Identification: It is the second port on the board
**Function(s)  : It receives DHCP offered IP addresses when plugged to a network
**IP address    : It has no fixed IP address. (Apropos!!)
 
===Wireless network===
*'''ath0'''
**Identification: It's connected to a first 5GHz antenna
**Function(s)  : Provides backhaul
**IP address    : IP address is fixed and is determined/calculated based on the MAC address of the interface.
**Channel      : TBD
**SSID          : TBD
**Mode          : Ad-Hoc, 11a
**Security      : None(??)
*'''ath1'''
**Identification: It's connected to a second 5GHz antenna
**Function(s)  : Provides backhaul
**IP address    : IP address is fixed and is determined/calculated based on the MAC address of the interface.
**Channel      : TBD
**SSID          : TBD
**Mode          : Ad-Hoc, 11a
**Security      : None(??)
*'''ath2'''
**Identification: It's connected to a 2.4GHz antenna
**Function(s)  : Provides hotspot
**IP address    : IP address is fixed and is determined/calculated based on the MAC address of the interface.
**Channel      : TBD
**SSID          : TBD
**Mode          : Ad-Hoc, 11b/g
**Security      : None(??)
**Other        : .
 
==Services running on the HPN==
*DHCP server - udhcpd
*Routing protocol - Batman(batmand)
*Web server - mini_httpd
*Web security - HTTPS and authentication

Latest revision as of 12:43, 17 June 2009


migrated to wireless dev