WRTSL54GS

From HBRC WIki

Jump to: navigation, search

Contents

First Install

  1. Make sure that 198.168.1.1 was accessible via my machine. The following command does the trick:
prompt> sudo ifconfig eth0:1 192.168.1.5 netmask 255.255.255.0

By the way, to bring it down:

prompt> sudo ifconfig eth0:1 down
  1. Press and hold the reset button on the OpenWRT for 10 seconds to get it back to factory reset condition. The end of a paper clip should fit inside the hole.
  2. Use a web browser to connect to <http://198.168.1.1/>.
  3. Log in as "admin" password "admin".
  4. Go to the administration page and click on [upgrade firmware].
  5. Upload open-wrtsl54gs-squashfs.bin downloaded from the OpenWRT.Org website from the whiterussian/0.9/micro directory. Better yet use the whiterussion/0.9/default directory.
  6. Wait a minute.
  7. Telnet to 198.168.1.1

Reference: Installing OpenWRT via TFTP

Note: Installing via TFTP did not work because boot_wait needs to be turned on in NVRAM. (See below.)

Outside world connectivity

I cheated. By plugging in another cable from the WAN port to the same hub, the it managed to get the router tables acceptably configured. Nothing else I tried worked.

To upgrade the firmware

1 Switch over to /tmp and use wget to get the .trx file:

  prompt> cd /tmp
  prompt> wget http://downloads.openwrt.org/whiterussian/0.9/default/openwrt-brcm-2.4-squashfs.trx

2) Use the mtd command to install:

  prompt> mtd -r write firmware.trx linux

"-r" will force automatic reboot after reflashing.

Refer to end of: README

Firing up the ipkg manager

1 Update the package list:

  prompt> ipkg update

2 View all of the pretty packages:

  prompt> ipkg list

USB to serial converter

Install USB support for USB-to-serial converter: 1 Get the correct driver installed:

  prompt> ipkg install kmod-usb-ohci
  prompt> insmod 

2 Download FTDI driver:

  prompt> ipkg kmod-usb-serial-ftdi
  prompt> insmod usbserial
  prompt> insmod ftdi_sio

3 Plug FTDI device. 4 Verify that it is there:

  prompt> cd /proc/bus/usb
  prompt> cat devices | grep -i ftdi   # Should list one device

5 Send some bits out the device:

  prompt> cd /dev/usb/tts
  prompt> echo hello > 0    # The transmit light should light

6 Install microcom:

  prompt> ipkg install microcom
  prompt> microcom -D/dev/usb/tts/0   # "~" is the escape character

Note: /dev/tts/{0,1...} are not USB devices.

Get boot_wait turned on (useful for TFTP boot loading)

 prompt> nvram set boot_wait=on
 prompt> nvram get boto_wait
 prmopt> nvram commit

Reference: BootWait

Install entire tool chain

  1. Download the white russian 0.9 tar.bz2 blob.
  2. Unpack.
  3. Read the README.
  4. Install flex, bison, and libncurses5-dev!! and zlib-dev.
  5. Type make and wait.

Run Hello World!

1 Download the SDK.

Reference: Packages How To

2 Find the compiler, it is actually called mipsel-linux-gcc.

3 Compile the hello world program:

  prompt> mipsel-linux-gcc -o hello hello.c

4) Use the "file" command to verify that it is a MIPS based ELF file.

5) Download to the router. I use wget. scp might work too.

6) Turn on the execute bits:

  prompt> chmod +x hello

7) Execute:

  prompt> ./hello		# Should print out "Hello, World!"


Debug Remotely

1) Obtain a fairly complete tool chain with gdbserver precompiled for the MIPS architecture.

    prompt> cd /tmp
    prompt> mkdir mipsel
    prompt> cd mipsel
    prompt> wget http://www.uclibc.org/downloads/root_fs_mipsel.ext2.bz2
    prompt> bunzip2 root_fs_mipsel.ext2.bz2

2 Mount the .ext file system image via linux loop back and make it so that mere mortals can access the file:

    prompt> cd /mnt
    prompt> mkdir loop
    prompt> sudo mount -o loop -o user /tmp/root_fs_mipsel.ext2 /mnt/loop
    prompt> cd /mnt/loop
    prompt> sudo chown -R {your_user_name} .
    prompt> sudo chgrp -R users .

3 Create the tar file containing gdbserver and required libraries:

    prompt> cd /mnt/loop      # We are at the virtual "root":
    prompt> tar cvf /tmp/gdbserver.tar usr/bin/gdbserver lib/libtread_db* lib_libgcc_s*

The total amount of code is about 100K.

4 Transfer .tar file over to the target machine using wget or scp.

5 Unpack:

    target> cd /
    target> tar xvf /tmp/gdbserver.tar   # Where ever you put the .tar file
    

6 Now create a file to be debugged -- /tmp/my_prog.c

7 Using the compiler in the previous step:

    prompt> mipsel-linux-gcc -g -o /tmp/my_prog /tmp/my_prog.c

8 Make another copy in /tmp:

    prompt> cp /tmp/my_prog /tmp/target_my_prog

9 (Optional) strip the copy:

    prompt> mipsel-linux-strip /tmp/target_myprog

10 Copy over to target machine using wget or scp:

11 Set the execute bits and run gdbserver:

    target> cd /tmp
    target> chmod +x target_my_prog
    target> gdbserver 10.18.101.5:4444 target_my_prog {command_line_arguments}

12 Fire up host:

    prompt> mipsel-linux-gdb /tmp/my_prog
    gdb> target remote tcp:192.168.1.1:4444
    gdb> break main
    gdb> run
    gdb> # Have fun.

Notes: The debugger is real unhappy whenever it calls out to code that does not have debug symbols. Try to get everything compiled with -g.

Reference 1: OpenWRT Forum

Reference 2: Red Hat Documentation Chapters 16 and 17 are particularly important.

WebCam

I have worked with two web cameras:

  • Logitech Communicate STX: There are two versions. The one with USB id 0x046d:0x08ad works fine according to James Nugen. The one I have with USB id 0x046d:0x08d7 is too recent and is not found by either the SPCA5XX or SPCA5XX/LE drivers.
  • Micro Innovations IC50C: This works fine with the SPCA5XX driver. It has a very slow frame rate since there is no jpeg compression in the camera.

The issue is that White Russian is Linux 2.4 and only supports older cameras. Kamakazee is Linux 2.6 (not true!), but does not have drivers for the older Wi Fi chip sets, which are supplied as binary blobs from the vendors. There are other drivers than the SPCA5XX, but they have similar issues. The basic strategy is to install the viewer software first on the host machine. Then comes the fun of installing a the camera on the WRTSL54GS.

Installing the spcaview software on Kubuntu was a tad unpleasant:

1 Install gspca-source, libsdsl-dev, libjpeg-dev, module-assistent.

2 Read /usr/share/doc/gspca-source/README.Debian.gz

3 Warm up the module assistant:

 sudo module-assistant prepare

4 Build the requisite kernel module for spca:

 sudo module-assistant auto-install gspca

5 Visit SView and read chapter 4.

6 Build a home for spcaview to live in:

  mkdir -p ~/download/spcaview
  cd download/spcaview

7 visit <http://mxhaard.free.fr/download.html> drop the

  tar.gz file into ~/download/spcaview

8 Uncork the tar.gz file:

  gunzip -c *.gz | tar xvf -

9 Go down a level:

  cd spca-view-*8

10 Build everything:

  make

11 Install spcaview:

  sudo make install

12 Verify the install:

  which spcaview

13 List the spcaview command line options:

  spcaview -h

14 Install the webcam on the WRTSL54GS (see next section)

15 Open up the broadcast stream:

  spcaview -w 192.168.1.1:7070

16 Wave to yourself on the screen.

Loading up the WRTSL54GS was not much fun either:

1 Do some homework. Read the section on the SPCA5XX drivers. visit webcam

2 Do some more homework: visit [1]

3 Install some common packages:

  ipkg install kmod-usb-core
  ipkg install kmod-usb-ohci
  ipkg install kmod-usb-uhci
  ipkg install kmod-usb2
  ipkg install kmod-videodev
  ipkg install libpthread

4 If you are lucky you have a camera that will work with the spca5xx/le driver. Install it:

  ipkg install http://weimar-fon.de/ipkg/packages/spca5xx-le-webcam_1_mipsel.ipk 
  /etc/init.d/S90webcam	# Bring it up
  # Plug your camera in
  dmesg			# See whether the driver recognizes it.
  # If so, you are lucky.  Run the server:
  servfox -d /dev/video0 -w 7070 &
  # Now fire up spcaview on the host machine:

5 You are not lucky. Maybe the non-light driver will work for you. Install it:

  ipkg install http://pmeerw.net/openwrt/kmod-spca5xx_2.4.30+20060501-brcm-1_mipsel.ipk
  insmod spca5xx		# Bring up the module
  lsmod			# Verify that it is there
  cd /dev
  ln -s v4l/video0	# Build a sym. link
  # Plug in your camara
  dmesg			# See if it is found.
  # If it is found, you have a working camera.
  # Proceed to step 6)
   

6 Now we need to fetch spcaserv. From a web browser, Download: [2] and drop it in /tmp. Uncork the goodies and transfer spcaserv to the WRTSL54GS

  chmod +x spcaserv
  mv spcaserv /usr/bin
  spcaserv -w 7070 &	# Fire up the server.	
  # Now fire up spcaview on the host machine:


Bringing Up WiFi

1 Read: [3]

2 Read: [4]

3 Read: [5]

4 Read: [6]

5 Using a suggestion from James:

  nvram set wl0_ssid="726Henri"
  nvram commit
  reboot

6 wifi-radar picked up instantly.

7 Configure wifi-radar to use 192.168.1.6/255.255.255.0 as a manually configured ip address.

8 This step should not be necessary:

  host> sudo ifconfig eth0:1 192.168.1.6 netmask 255.255.255.0

9 Also, this step should be unnecessary:

  router> route add -net 0.0.0.0 netmask 0.0.0.0 gw 192.168.1.6 br0

10 This step is ugly too:

  host> echo 1 > /tmp/one ; sudo cp /tmp/one proc/sys/net/ipv4/ip_forward

I'm not sure these last 3 steps are strictly necessary. This gets us to the point where we can send packets to the laptop, but not much further. The gateway down stream has no idea the 192.168.1.0 subnet is.

Using on board serial port

1 Read the OpenWRT WRTSL54GS Hardware Hacking

2 Removing the solder was quite hard. High temperature was required. Other people have recommended getting some alloying metal to desolve into the solder joints to make them less sticky. On the second WRTSL54GS, I wound up drilling the holes out. That was not easy either.

3 I used a 2x5 right angle shrouded connector. I removed the pin 4's.

4 The hole in the case was drilled and then I used a nibbler and files to square the hole out.

5 Using a 14-pin component carrier I replaced the MAX232 on the WireHost board. I used a 3K0 and 4K7 resistor for the output voltage divider.

6 Remove the last line in /etc/inittab to turn the login daemon off of /dev/tts/0. The last line looks like:

  tts/0::askfirst:/bin/ash -- login

7 The serial port has a limitation of 100 turn-arounds a second. This should be changable by recompiling the kernel with HZ set to 1000. This is true, but setserial is the easier way.

8 Install the setserial package:

   ipkg install setserial

9 Set the port to low latency:

   setserial /dev/tts/0 low_letency

10 Get a setserial dump:

  setserial -a /dev/tts/0

What About Debian Linux?

{From an E-mail from James Nugen to Mike Thompson (CC Wayne Gramlich)}

Mike Thompson wrote:

  • What would be most ideal for me is if I could get a WRTSL45GS running a standard Debian system. I'll have to dig into the Kamakazee and see where it stands.

As far as I know, standard Debian hasn't been ported to run entirely on these routers. This guy is has it running, but he's using NFS to mount most of it: [7]

Another option is 'OpenEmbedded'. It is a system for creating your own "distro" for embedded devices. I've started playing around with it on the ALIX's. They do have a config file for the WRT54-type routers, but I don't know if anyone has tried it with the SL. [8]

It seems OpenWRT is your best bet for getting something working with the least amount of effort. The WhiteRussian 0.9 release is pretty stable, but it is getting pretty old (v2.4 kernel). You would have to make sure your webcam is supported by the older versions of webcam drivers in WhiteRussian.

As Wayne mentioned, the OpenWRT developers have moved on to Kamikaze (v2.6 kernel). Unfortunately, there is a problem with the wireless drivers for the Broadcom chip, used in the many of the Linksys routers including the SL, and the v2.6 kernel. So, if you want working wifi, you have to use the v2.4 kernel version of Kamikaze. I converted one of my SLs to running Kamikaze. It seems pretty stable. Our problem is that since it's still the v2.4 kernel, we are still stuck with old webcam drivers. Most everyone has moved on to v2.6. :-(

I got some time this weekend to play around with the latest development version of Kamikaze. They have switched to a open source driver for the Broadcom chips called 'b43'. I built an image using the v2.6 kernel and the new driver. The kernel (and system) seems fairly stable, but there are still problems with the b43 driver. I was able to get it working, but the RF strength is much weaker than it was with the older driver. So I'd say it's not quite ready yet. :-(

The nice thing about the newer kernel was that I could use the 'uvc' webcam driver. 'uvc' is the new standard for webcams. Most of the newer ones use it. I read somewhere that any webcam that claims "Compatible ith Vista" is a uvc webcam. Anyway, being newer webcams, they have igher resolution, faster frame rates, etc. They also support motion-jpeg streaming by default. I was able to stream 640x480 at 10 fps through the SL when connected via wired Ethernet with very little CPU loading. It could probably go faster, but I haven't tried it yet. Unfortunately, because of the problems with the wireless driver, I could only get 3-4 fps connected via wireless.

Personal tools