Sunday, 23 January 2011

OpenWRT on Linksys NSLU2

I have had a couple of NSLU2's running a little application to monitor utility meter readings for a few years now (meterserv).   It worked fine until the autumn when my Dad's one stopped recording readings.  I have not been able to find out why - it looks ok.  It may be that the interface card has broken, or I do wonder if I have worn out the USB flash drive that I am using for the root filesystem.

In my inability to find a fault, I decided to do a clean install on a usb disk to rule out software and flash drive problems.   They had been using OpenSlug (now called SlugOsBE) from nslu2-linux, but it is now very out of date, because I have not updated them for a few years.  This means that all the links to package directories are broken etc.

Given the recent success in building OpenWRT for the bifferboard, I decided to use OpenWRT for the re-build.   These are my notes so I can do it again next time....

  • In the MenuConfig system, set the target system to 'Intel IXP4xx', sub target to 'Generic' and target profile to 'Linksys NSLU2'.
  • Because this is not my new router, I do not want it to use the default IP address of 192.168.1.1.  This can be changed in the 'Image Configuration' bit of the configuration menu.
  • I would like to re-code some of the meterserv software in python, so I need python and pyusb installed in the flash image - these were selected from the 'Languages' section of the openwrt menu.
  • Make builds a firmware image in bin/ixp4xxx called openwrt-nslu2-squashfs.bin, which is an 8MB image - there is a 16MB one too, but I am not convinced that my nslu2 has that much flash memory.
  • You have to put the nslu2 into 'recovery mode'  by holding the re-set button in while you power up the machine - you have to release the reset button as soon as the status LED changes colour, after about 10 seconds.  The status LED then flashes a couple of different colours.
  • Flash the new firmware image onto the NSLU2 using upslug2 (sudo apt-get install upslug2 on ubuntu) - the command line was sudo upslug2 --target 00:14:bf:64:df:be --image openwrt-nslu2-squashfs.bin.
  • The machine now appears on the network with the right IP address.  Telnet into it and change the root password, then connect using SSH instead.
The only problem is that when I type 'python' I get an error "python: can't resolve symbol 'BC'".  So now I need to work out which package is missing - looks like openWRT missed a dependency, but I don't know which one!
I have had a bit more of a look at it.  There are two surprising things.  The first is that if I write a simple 'hello world' script and execute it, it works, so it is just interactive python that is broken.
The second is that doing "ldd /usr/bin/python" on the nslu2 and on the bifferboard give very similar results, except that the bifferboard one is linked against libgcc and libc, but the nslu2 one is linked against libc.
I think this is telling me something, but I am not sure what....

4 comments:

Mr. Fletcher said...

hi, sorry to bother you on such an hold post but i've been trying to flash openwrt to a NSLU2 for the last couple of days and it's starting to feel like i'm bashing my head on a wall ;)
i think i managed to flash the openwrt firmware correctly (i'm using 10.3.1) but i can't connect to the device:
i tried both connecting the NSLU2 to a switch and directly to my computer. when i try to telnet (or ping) the device on 192.168.1.1 or 192.168.1.77 it doesn't respond and when i connect it to the switch it doesn't show up on the DHCP table.
when i boot the NSLU2 it flashes al the leds and the shows only the ethernet led.

any help would be REALLY appreciated!
Thanks in advance!
Marcello

Graham Jones said...

Hi,
It is a while since I did this, so I am a bit out of practice. Not responding to ping sounds wrong. Connecting via a switch sounds right (you need a cross-over cable to connect directly to your computer).
Also, does your network use 192.168.1.xxx addresses? If not you need to use the same base IP address as the rest of your network - that is, it needs to be on the same sub-net (sorry, I don't know how experienced you are with network things, so this may be obvious to you!).
I would be minded to use NMAP to scan your network to see if you can see it.

Graham.

Mr. Fletcher said...

Hi, thanks for your answer!
i tried again both with DHCP and manually setting the IP address on my airbook (i use the thunderbolt network adapter) to 192.168.1.xxx but to no avail.
I tried pinging 192.168.1.255, using "arp -a" and a couple of network scanners but still had no luck finding the device (i assume its network hardware is ok because upslug2 works ok).

Thanks again! :)
M

Graham Jones said...

This might be one for the openwrt mailing list....