Gateworks Notes

From ME2000

Jump to: navigation, search

Contents

Added Tue 16th May 2006 - First Things First

Well, Gateworks Avila playtime has started. After LOADS of reading, mailing list (there's only one), websites (there aren't more than a handful), I deviced to try and netboot using the gateworks supplied kernel and a buildroot filesystem. During the board boot, you can type CTRL-C to get to the redboot prompt (only if you've disabled flow-control on the serial port), and use the following commands to get the files onto the board. I set up a tftpd on 192.168.3.1 and copied the files into /boot.

load -r -v -b 0x01600000 zImage
load -r -v -b 0x00800000 ramdisk.gz
exec -c "console=ttyS0,115200 root=/dev/ram0 initrd=0x00800000,8M" 0x01600000

The thing booted. I was shocked. Amazed. Stunned. I didnt initially get a console, but as soon as I ran the makedevs script to populate /dev, and do the inittab mod with the 'sh', it came up into a console. No network yet, as the ixp42x nic driver is a module, it's not compiled into the kernel.

edit: for 10-pin header:

exec -c "console=ttyS1,115200 root=/dev/ram0 initrd=0x00800000,8M" 0x01600000

Added Wed 17th May 2006 - Some initial notes

Reading the staros forums, it looks like they don't support any method of loading staros onto the non-staros-supplied boards. This is a bugger, since only the 2348-4 will support 4 of the higher power cards, and are true -40-85 degree boards. I wonder if it'd be possible to tftp on a bootstrap linux capable of writing the flash, then tftp across the staros binfile, burn it into the flash, then reboot? It would be a nice side project. (note: no need, redboot will tftp data into ram, and can then burn it onto flash. Dunno why Valemont dont allow this simple method of update...)

18:23

I got the Gateworks 2.4.27 kernel compiled. There were compilation errors when using the buildroot cross compiler, but no problems when I used the one supplied on the Gateworks devkit CD. I'll have to come back to that one. I copied the kernel onto the board using the tftp method above, then booted.

BusyBox v1.2.0-pre0 (2006.05.16-21:46+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

/ #
/ # uname -a
Linux uclibc 2.4.27-uc1 #3 Wed May 17 19:11:57 IST 2006 armv5b unknown
/ #

Now, looking at the Intel ethernet driver, in this 2.4.27 kernel, it looks like it can't be compiled into the kernel. You only get to compile it as a module.

I did a

make modules

in the kernel, then had a look around for any newly built modules. I found ixp400.o, which I suspect is the main chipset driver. Then there was ixp425_eth.o for the ethernet, ixp425_gpio, for the i/o, and another ixp425.o, not sure about that one.


auto ixp0
iface ixp0 inet static
       address 10.4.11.16
       netmask 255.255.255.0
       gateway 10.4.11.254

auto ixp1
iface ixp1 inet static
       address 10.4.111.16
       netmask 255.255.255.0


Then I create an S15modules.sh file in init.d

#!/bin/sh
#

/sbin/insmod ixp400
/sbin/insmod ixp425
/sbin/insmod ixp425_eth
/sbin/insmod ixp425_gpio

to basically load them up before anything else. They need to be in before the networking, for example. Once the board was brought up, I see that they dont use the standard NIC naming conventions, they use ixp0 and ixp1. Funny. On changin the interfaces file in my buildroot filesystem, I rebooted from the new tftp image. This time I got

# ifconfig
ixp0      Link encap:Ethernet  HWaddr 00:02:B3:01:01:01
          inet addr:10.4.11.16  Bcast:10.255.255.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:198 errors:0 dropped:0 overruns:0 frame:0
          TX packets:191 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:256
          RX bytes:20733 (20.2 KiB)  TX bytes:21968 (21.4 KiB)

ixp1      Link encap:Ethernet  HWaddr 00:02:B3:02:02:02
          inet addr:10.4.111.16  Bcast:10.255.255.255  Mask:255.255.255.0
          UP 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:256
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  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:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
#

Once the network was up, I added in dropbear into the buildroot, softlinked /dev/random to /dev/urandom, and then I could ssh in and out of the box.

Added Thu 18th May 2006

The gateworks board uses Redboot by default. I happened to get version 2.02 with my board. See the Redboot Users Guide for more information on it's capabilities and usage.

Here's also some interesting info about Gateway Maker.

Added Fri 19th May 2006

!00:34

in madwifi, removed -arch=armv4 from

./hal/public/xscale-be-elf.inc

getting error

arm-linux-gcc -o athstats -g -O2 -Wall -include ../include/compat.h -I. -I../hal -I.. -I../ath  athstats.c
/home/daveh/ixp/snapgear/usr/local/bin/../lib/gcc-lib/arm-linux/3.3.2/../../../../arm-linux/bin/ld: cannot find /usr/local/arm-linux/lib/libc.so.6
collect2: ld returned 1 exit status


cp ./ath_hal/ath_hal.o $ROOTDIR/lib/modules/2*/net
cp ./ath/ath_pci.o $ROOTDIR/lib/modules/2*/net
cp ./ath_rate/sample/ath_rate_sample.o $ROOTDIR/lib/modules/2*/net
cp ./net80211/wlan_acl.o $ROOTDIR/lib/modules/2*/net
cp ./net80211/wlan_ccmp.o $ROOTDIR/lib/modules/2*/net
cp ./net80211/wlan.o $ROOTDIR/lib/modules/2*/net
cp ./net80211/wlan_scan_sta.o $ROOTDIR/lib/modules/2*/net
cp ./net80211/wlan_scan_ap.o $ROOTDIR/lib/modules/2*/net
cp ./net80211/wlan_tkip.o $ROOTDIR/lib/modules/2*/net
cp ./net80211/wlan_wep.o $ROOTDIR/lib/modules/2*/net
cp ./net80211/wlan_xauth.o $ROOTDIR/lib/modules/2*/net

Added Sat 20th May 2006 - madwifi working

Got madwifi working at last...

/etc/network # iwconfig

lo        no wireless extensions.

ixp0      no wireless extensions.

ixp1      no wireless extensions.

wifi0     no wireless extensions.

ath0      IEEE 802.11g  ESSID:"MATRIX1"
          Mode:Managed  Frequency:2.462 GHz  Access Point: 00:04:75:65:16:D0
          Bit Rate:11 Mb/s   Tx-Power:16 dBm   Sensitivity=0/3
          Retry:off   RTS thr:off   Fragment thr:off
          Encryption key:7765-6269-78   Security mode:restricted
          Power Management:off
          Link Quality=20/94  Signal level=-75 dBm  Noise level=-95 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

/etc/network #

What was prefenting the ath_pci module from working was a little mod in $KERNELPATH/include/asm-arm/arch-ixp425/io.h :

Gianluca,

Make sure your building madwifi-ng against a kernel that has the =
following mod:

>Edit file linux-2.4.x/include/asm-arm/arch-ixp425/io.h in the >Snapgear source tree and change line #215 to the following:
>
>if((phys_addr < 0x48000000) || (phys_addr > 0x48ffffff))

Tim

The oops that was getting caused by insmod'ding ath_pci was an error to to with a memory address above 0x48ffffff, and the original line was 0x4bffffff, so I guess the gateworks memory mapping is slightly different to the normal.

Anyway, same madwifi version was recompiled against this new io.h, and insmod'ded no problems. iwconfig then allowed me to config the interface, and once I edited /etc/netork/interfaces to add an entry for ath0, and did an

ifup ath0

The card started scanning, and associated with my access poing on 2.4GHz

Many thanks due to the people on the avila mailing list

Added Sun 21st May 2006

I updated the redboot start script to pull the kernel and rootfs from the tftp server rather than having to interrupt the boot and paste in the commands every time.

RedBoot> fconfig
Run script at boot: true
Boot script:
.. fis load ramdisk
.. fis load zimage
.. exec

Enter script, terminate with empty line
>> load -r -v -b 0x01600000 zImage
>> load -r -v -b 0x00800000 ramdisk.gz
>> exec -c "console=ttyS0,115200 root=/dev/ram0 initrd=0x00800000,8M" 0x01600000

>>
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>

So now the boot does the following

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> load -r -v -b 0x01600000 zImage
Using default protocol (TFTP)
|
Raw file loaded 0x01600000-0x016b2e0f, assumed entry at 0x01600000
RedBoot> load -r -v -b 0x00800000 ramdisk.gz
Using default protocol (TFTP)
-
Raw file loaded 0x00800000-0x009196b2, assumed entry at 0x00800000
RedBoot> exec -c "console=ttyS0,115200 root=/dev/ram0 initrd=0x00800000,8M" 0x01
600000
Using base address 0x00800000 and length 0x001196b4

And proceeds to boot the kernel.

Flash Storage

What I tried to do next was look at using some of the flash for storing files between reboots. Config settings, etc.

Now, looking at the fis in redboot...

RedBoot> fis list
Name              FLASH addr  Mem addr    Length      Entry point
RedBoot           0x50000000  0x50000000  0x00080000  0x00000000
zimage            0x50080000  0x01600000  0x00140000  0x00800000
ramdisk           0x501C0000  0x00800000  0x00320000  0x00800000
FIS directory     0x50FE0000  0x50FE0000  0x0001F000  0x00000000
RedBoot config    0x50FFF000  0x50FFF000  0x00001000  0x00000000
RedBoot>

From the mailing list, the following devices will allow access to the flash partitions.

crw-rw-r-- 1 0 0 90, 0 Aug 30 2005 /dev/mtd0 crw-rw-r-- 1 0 0 90, 2 Aug 30 2005 /dev/mtd1 crw-rw-r-- 1 0 0 90, 4 Aug 30 2005 /dev/mtd2 crw-rw-r-- 1 0 0 90, 6 Aug 30 2005 /dev/mtd3 crw-rw-r-- 1 0 0 90, 8 Aug 30 2005 /dev/mtd4 crw-rw-r-- 1 0 0 90, 10 Aug 30 2005 /dev/mtd5 crw-rw-r-- 1 0 0 90, 12 Aug 30 2005 /dev/mtd6 brw-rw-r-- 1 0 0 31, 0 Aug 30 2005 /dev/mtdblock0 brw-rw-r-- 1 0 0 31, 1 Aug 30 2005 /dev/mtdblock1 brw-rw-r-- 1 0 0 31, 2 Aug 30 2005 /dev/mtdblock2 brw-rw-r-- 1 0 0 31, 3 Aug 30 2005 /dev/mtdblock3 brw-rw-r-- 1 0 0 31, 4 Aug 30 2005 /dev/mtdblock4 brw-rw-r-- 1 0 0 31, 5 Aug 30 2005 /dev/mtdblock5 brw-rw-r-- 1 0 0 31, 6 Aug 30 2005 /dev/mtdblock6

So, I added the fillowing devices:

sudo mknod mtd0 c 90 0
sudo mknod mtd1 c 90 2
sudo mknod mtd2 c 90 4
sudo mknod mtd3 c 90 6
sudo mknod mtd4 c 90 8
sudo mknod mtd5 c 90 10
sudo mknod mtd6 c 90 12
sudo mknod mtdblock0 c 31 0
sudo mknod mtdblock1 c 31 1
sudo mknod mtdblock2 c 31 2
sudo mknod mtdblock3 c 31 3
sudo mknod mtdblock4 c 31 4
sudo mknod mtdblock5 c 31 5
sudo mknod mtdblock6 c 31 6
mount -t jffs2 /dev/mtdblock3 /mnt

But, it failed to mount them. This is because I had not created a partition. You can ceate a partition in flash using the following:

fis create -n storage -f 0x504E0000 -l 0x320000
fis erase -f 0x504E0000 -l 0x320000

Then mounting using

 mount -t jffs2 /dev/mtdblock3 /mnt

gave no errors. I edited a small file, rebooted, remounted, and the file was still there. So, now we have a method for storing configs in the flash on the Avila.

httpd

Had a play with thttpd. couldnt get it configged properly, so went back to the busybox httpd. Got the cfgmgr compiled up so that it pulls out settings from /etc/network/interfaces. So the Avila is just about up to the development status of the rest of the boards. Now I gotta take the common stuff further, like wireless settings, etc.

Added Thu 15th June 2006 - Booting from CF instead of network, and first snapshot release

After a little poking around on the Avila mailing list archives, I managed to piece together the information on how to access the compact flash. Seemingly the -m disk option, along with using the hda1: as the disk specifier is enough to load a file from the CF into memory. You can then execute it using exec, very similar to the tftp boot. I loaded the files into the same memory locations as the tftp network copt, and issued the same exec command.

load -r -m disk -b 0x01600000 hda1:zImage
load -r -m disk -b 0x00800000 hda1:ramdisk.gz
exec -c "console=ttyS0,115200 root=/dev/ram0 initrd=0x00800000,8M" 0x01600000

The Compact flash was simply a single e2fs partition, with the zImage and ramdisk.gz files copied onto it. On issuing the exec command, the system booted. Next, to change the boot script so that it defaults to using the CF instead of the network.

RedBoot> fconfig
Run script at boot: true
Boot script:
.. load -r -v -b 0x01600000 zImage
.. load -r -v -b 0x00800000 ramdisk.gz
.. exec -c "console=ttyS0,115200 root=/dev/ram0 initrd=0x00800000,8M" 0x01600000

Enter script, terminate with empty line
>> load -r -m disk -b 0x01600000 hda1:zImage
>> load -r -m disk -b 0x00800000 hda1:ramdisk.gz
>> exec -c "console=ttyS0,115200 root=/dev/ram0 initrd=0x00800000,8M" 0x01600000

>>
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>

After I got this working, I copied all the networking and wireless scripts in the first snapshot build of the wrap and rb532, and made a snapshop release of this as well. So, I've now got snapshot releases of wrap, rb532 and avila. :)


Added Wed 28th June 2006 - Using the 10-pin COM2 header

After queries on the forum about cards without a 9-pin serial port, I set about trying a standard "serial port to motherboard" cable. These are the cables you sometimes get with motherboards that take a 10-pin header on the motherboard out to a pci-slot cover with a 9-pin d-type in it. Sometimes they also have a parallel port. The 10-pin header needed drilling out (1.5mm bit) because it was blocked out. Once the hole was drilled, I could plug the 10-pin connector into the board. 9-pin cable into the other, but no traffic. So, I cut the ribbon cable in the middle, swapped pins 2 and 3, and up she came. I added a couple of lines in the inittab to kick off a few gettys , so now a login will appear on both serial ports regardless of what 'console' parameters is given to the kernel.

# Put a getty on the serial port
ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100
ttyS1::respawn:/sbin/getty -L ttyS1 115200 vt100

I also change the /etc/issue file to give the following message at boot:

Welcome to ME2000v3.

me2000v3 login:

The default login is user 'root', password 'admin'.

Personal tools