NSLU2-Linux
view · edit · print · history

To install Debian using this method you will need:

  • An NSLU2
  • A USB ethernet adapter
  • A thumbdrive or hard disk 512MB or larger
  • A Linux computer capable of utilizing the media
  • A TFTP server

Download the following files:

Optional:

Preparing the Disk
Start by plugging your media into your Linux computer. At the very least you will need to create 2 partitions on it. The first primary partition will be for Linux swap space. I recommend 96MB or more. Primary partition 2 will be your root ext2/3 filesystem. It is up to you if you wish to create other partitions, but for the sake of simplicity I will not cover those instructions.

Partition table using cfdisk:

                             cfdisk 2.11n

                         Disk Drive: /dev/sda
                        Size: 512483328 bytes
          Heads: 16   Sectors per Track: 63   Cylinders: 993

   Name       Flags    Part Type FS Type        [Label]      Size (MB)
 --------------------------------------------------------------------
   sda1                 Primary  Linux swap                      96.51
   sda2                 Primary  Linux ext3                     415.98

Next, format the partitions.
For swap:
mkswap /dev/sda1

For root:
mkfs -t ext3 /dev/sda2

Now you will need to mount up your root partition and extract the disk image.
mount -t ext3 /dev/sda2 /mnt
cd /mnt
tar xjvpf /tmp/debian.nslu2.tar.bz2

After extraction the image will occupy about 270MB of disk space. Currently, the disk image is using ext2 for compatibility. If you followed the instructions thus far you may wish to enable ext3. You can do this by editing the appropriate line in the /mnt/etc/fstab file. Perhaps also change the hostname found in /mnt/etc/hostname. You will also want to edit /mnt/etc/network/interfaces to configure the NSLU2 for your network. I wouldn't recommend DHCP for testing. You'll see why.

Sample interfaces file:

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.0.50
network 192.168.0.0
netmask 255.255.255.0
gateway 192.168.0.1

Once you are done with your editing, unmount the drive:
cd /
umount /mnt

Testing (Optional)
Attatch the drive and the USB ethernet adapter to the NSLU2, but plug the ethernet cable into the onboard ethernet port. Telnet into the NSLU2. The following directions will allow you to load the kernel image from your TFTP server and boot Debian WITHOUT flashing your firmware.

The first IP will be the NSLU2's new address. The second IP is the address of your TFTP server. After issuing this command you may need to telnet into your NSLU2 again using the new address.
ip_address -l 192.168.0.77 -h 192.168.0.100
load -r -v -b 0x01d00000 zImage-sda2.swap
exec 0x01d00000

At this point the NSLU2 should beep and be booting the kernel. Unfortunately, the indicator LEDs do not work under Debian yet. While it is booting carefully unplug the ethernet cord from the onboard adapter and insert it into the USB ethernet adapter (if you chose to use DHCP it may have tried to find a lease on the wrong interface). After a few minutes you should be able to SSH into the NSLU2. The initial root password is 'debian' and there is also a normal user named 'debian' with the same password.

Flashing
If you are satisfied with the results of the testing (or you are feeling adventurous) you can write the kernel to the NSLU2's internal flash. This will allow the NSLU2 to load the kernel and then boot from the disk using /dev/sda2 as the root partition. This operation WILL NOT destory RedBoot. Should you wish to go back to a different firmware it should be possible as long as they can be reloaded using RedBoot.

If you have your NSLU2 still booted from testing it, you should run the halt command and wait a minute for it to complete shutdown. Afterwards, disconnect the disk and ethernet adapter and plug the network cable into the onboard ethernet jack. Telnet into RedBoot and issue the following commands. It will ask for confirmation before writing the image.

ip_address -l 192.168.0.77 -h 192.168.0.100
load -r -v -b 0x01d00000 kernel.img
fis write -f 0x50060000 -b 0x01d00000 -l 0x100000
reset

The NSLU2 will attempt to reboot, load the kernel, and boot from disk. It is safe to turn the NSLU2 off and attach your disk and USB ethernet adapter. When you turn the NSLU2 on it should boot and run from the disk while using the USB ethernet adapter for connectivity.

FAQ
Q: Why must I use a USB ethernet adapter.
A: The ethernet driver is still in big endian format. The Debian kernel switches the CPU into little endian mode so that we can use standard Debian packages. To the best of my knowledge Intel has released new Access Libraries for this platform that now supports the onboard ethernet adapter in little endian mode. If someone compiles a working driver then we can proceed without the USB ethernet adapter.

Q: What is different between the zImage-sda2.swap kernel image and the kernel.img kernel image?
A: The zImage-sda2.swap image is a regular kernel image that has been byte-swapped for the NSLU2 to deal with endian issues. The kernel.img is the same image only with several bytes on the front of it so that it conforms to the NSLU2's flash partition specification. In my testing I was able to load kernel.img into RAM and boot it. We may be able to eliminate zImage-sda2.swap and just use kernel.img for testing and flashing. However, there may be some impact that I am not aware of.

Q: Who is responsible for making this work?
A: This Document is COMPLETELY based off work done by Peter Korsgaard using kernel patches based off work done by the OpenSlug team. This work is merely a re-package to act as an intermediary until better ways to install Debian without a serial port can be found.

view · edit · print · history · Last edited by Fox.
Based on work by Fox, tman, and Foxxz.
Originally by Fox.
Page last modified on September 13, 2005, at 08:25 PM