Table of Contents
Linksys NSLU2
Web references
Hardware
See the NSLU2.
CPU | XScale-IXP42x 266 MHz |
---|---|
RAM | 32 Mb |
Flash | 8 Mb |
Flashing a new firmware
Obviously we want Debian GNU/Linux on it!
Flashing a Debian kernel and initramfs
See Installing Debian on the Linksys NSLU2
Put the NSLU2 in upgrade mode, as described into the HOWTO. Then run the following commands:
apt-get install upslug2 slugimage wget http://cyrius.com/debian/nslu2/files/sda1-2.6.18.dfsg.1-13etch2 upslug2 -i sda1-2.6.18.dfsg.1-13etch2
The above is an official Debian image, for a system installed onto /dev/sda1. Unfortunately it does not support the integrated Ethernet interface (Intel IXP4xx) because it needs a proprietary microcode to operate.
After flashing the firmware, we can prepare a Debian base system on and USB memory stick. I prepared a 2 Gb USB stick following this Manual install.
Flashing a Debian Installer
There is also an unofficial Debian installer NSLU image that can be found here: www.slug-firmware.net. This image contains a Debian installer that let you to start a standard installation. It contains also the microcode for the Ethernet port.
After flashing the Debian installer image you can login into the NSLU2 via ssh (login/password: installer/install):
ssh installer@192.168.1.77
Files
File | Note | Md5sum |
---|---|---|
debian-5.0beta1.zip web | Unofficial Debian installer based on Debian Lenny | d1101168a492f62810234b067724d3df |
debian-4.0r3.zip web | Unofficial Debian installer based on Debian 4.0 Etch | b8b9fe6389b04cf8520157010b1a0a8f |
sda1-2.6.18.dfsg.1-13etch2.bz2 web | Firmware for root on /dev/sda1 | 53566d5b06418128255d50cd8226f8be |
Note: I tried to install the Debian system on a 2Gb USB stick. I got problems using the debian-5.0beta1 installer: the system crashed several times at different stages of progress, so I was unable to complete it. I experienced some trouble also with the debian-4.0r3 installer: the program insists on crashing during partition format, so I pre-formatted the USB stick. During setup I loaded these modules:
- ext3-modules-2.6.18-6-ixp4xx-di
- partman-ext3
- usb-storage-modules-2.6.18-6-ixp4xx-di
Problem with halt and reboot
If you boot the NSLU2 with the serial line connected to an host (I use minicom to debug the boot process), then you will find that reboot
or halt
commands will be ignored.
I did not investigate much, just discovered that /etc/init.d/rc {0|6}
works.
Serial port pinout
Pin 1 | 3.3V (pin 1 has a white stripe next to it) |
---|---|
Pin 2 | RXD (from serial terminal program to NSLU2) |
Pin 3 | TXD (from NSLU2 to serial terminal program) |
Pin 4 | GND |
By default, RedBoot, APEX and the Linux kernel all use 115200,8,N,1 settings.
Customize the Debian Firmware
Install the slugimage package, download the original image and unpack it:
slugimage --unpack --input sda1-2.6.18.dfsg.1-13etch2
Several files will be extracted:
- apex.bin: second stage boot loader for ARM chip (little-endian image)
- ramdisk.gz: initramfs image (little-endian, gzip, cpio archive)
- RedBoot: RedBoot boot manager
- SysConf: Configuration of the NSLU2
- Trailer: Trailer
- vmlinuz: kernel image (little-endian image)
I changed the kernel image vmlinuz and the init ramdisk ramdisk.gz with customized versions
Note that the extracted files are little-endian, where the images provided by me are big-endian, so I byte-swapped them before packing back. Also note that the initramfs image must be padded to 4 Mb size.
dd if=ramdisk.gz of=ramdisk-pad.gz ibs=4M conv=sync byteswap.py vmlinuz vmlinuz-swap byteswap.py ramdisk-pad.gz ramdisk-pad.gz-swap slugimage --pack --output myfirmware-2.6.18-5-ixp4xx-1.bin -k vmlinuz-swap -r ramdisk-pad.gz-swap -L apex.bin
Do not use the --little
option of slugimage
to byte-swap kernel and initramfs images, because it swaps also the apex.bin
file.
Here it is the byteswap.py Python utility I used to byte-swap the files:
#!/usr/bin/python # swap every 32bit word in input and write it to output import array, sys if len(sys.argv) != 3: sys.stderr.write('Invalid arguments.\n') sys.stderr.write('Usage: %s <input> <output>\n' % sys.argv[0]) sys.exit(1) if sys.argv[1] == '-': file = sys.stdin else: file = open(sys.argv[1], 'rb') input = file.read() a = array.array('I') # add padding if needed a.fromstring(input + '\0' * (4-len(input)&3)) a.byteswap() if sys.argv[2] == '-': file = sys.stdout else: file = open(sys.argv[2], 'wb') a.tofile(file)
Always-On
The NSLU2 does not support the Always-On natively, there are several recipes to implement this feature, I choosed a simple one (a simple wire) from this page.
power restore | The NSLU2 power-on an boot as soon as the power is restored. |
---|---|
power button | When the power button is pressed: The system is going down for reboot NOW! |
reboot(8) | The NSLU2 properly reboots. |
poweroff(8) | The shutdown sequence is run, but power is not removed and LEDs stay on. You can restart by pressing the power button. |