NSLU2-Linux
view · edit · print · history

If the Debian Installer does not support your device (as is the case for the Iomega NAS100d and Freecom FSG-3 currently), you can use debootstrap to install Debian instead.

The following assumes that you are starting with some other compatible little-endian operating system on the device (this may be the vendor's firmware, or some other firmware distribution like SlugOS/LE).

Partition the hard drive and create filesystems

Partition your hard disk if you haven't already, assuming you have a empty (unpartitioned) drive.
To delete partitions, type "d" inside fdisk and remove the existing partitions one by one.

fdisk /dev/sda
n  #(add new partition)
p  #(primary)
1  #(1st partition)
1  #(start sector)
+3G  #(end sector/partition size; this adds a partion of 3GB size which will be mounted as /)
n
p
2  #(2nd partition)
1
+512M  #(our swap partition (512MB should be enough))
t  #(change type of partition)
2  #(2nd partition)
82 #(change type to 82 - swap)
w  #(write partition table)
q  #(quits fdisk)

Adjust the partition size to fit your needs. You might have to reboot if fdisk gives you a warning message saying that the partition table could not be re-read.

Setup the filesystem and swap:

mkfs.ext3 /dev/sda1 # ext3 is a safe choice
mkswap /dev/sda2
sync; sync; sync
swapon /dev/sda2

Mount the hard drive(s) filesystem:

mkdir /mnt/debinst
mount /dev/sda1 /mnt/debinst
mkdir /mnt/debinst/work
cd /mnt/debinst/work

Get and run the bootstrap utility, debootstrap

Grab the debootstrap .udeb from a Debian mirror (remember to look for a mirror close to you that carries the arm distribution):

wget http://ftp.au.debian.org/debian/pool/main/d/debootstrap/debootstrap-udeb_0.3.3.2etch1_arm.udeb

Extract the debrootstrap udeb:

ar -x debootstrap-udeb_0.3.3.2etch1_arm.udeb
tar xzvf data.tar.gz

Run debootstrap with your choice of Debian distro and mirror:

export DEBOOTSTRAP_DIR=`pwd`/usr/lib/debootstrap
./usr/sbin/debootstrap --arch arm etch /mnt/debinst http://ftp.au.debian.org/debian

Depending on your network connection, this will take at least 50 minutes (even with a broadband connection), because this downloads and installs many Debian packages.

Important: The bootstrap is not completed successfully until the last line is: I: Base system installed successfully.
If you do not get this line, you will not have a successful build. Error messages may be found in /mnt/debinst/debootstrap/debootstrap.log.

Final configuration

Copy in some important configuration files:

cd ..
cp /etc/resolv.conf etc/resolv.conf
cp /etc/hosts etc/hosts
cp /etc/hostname etc/hostname
cp /etc/network/interfaces etc/network/interfaces
cp /lib/firmware/NPE-B lib/firmware/

Notice: you may only needed to copy /etc/hosts into etc/hosts for DHCP configuration.

Mount the proc filesystem:

mount -t proc proc /mnt/debinst/proc

Now chroot into your new Debian environment for the final steps:

cd /
chroot /mnt/debinst

Then select the correct timezone:

dpkg-reconfigure tzdata

Set the date correctly here.

date MMddHHmmYYyy

If hwclock doesn't work, then do the following first:

rm /dev/rtc
mknod /dev/rtc c 254 0

Then save the correct time into the hwclock:

hwclock -w

Put a working fstab file into place (you may need to tweak this config and add extra partitions depending on your partition layout):

proc            /proc           proc    defaults        0  0
/dev/sda1       /               ext3    defaults        1  1
/dev/sda2       swap            swap    defaults        0  0

Edit the inittab file. Type: nano /etc/inittab and disable the tty[1-6] entries by prefixing the entries with "#". Then add the following serial console entry:

S0:2345:respawn:/sbin/getty 115200 ttyS0

For more detailed setup of the network, read man interfaces and edit /etc/network/interfaces.

Update the Debian distro and install cron, nslu2-utils and popularity-contest. Popularity-contest reports what architecture and packages you are using back to the Debian community anonymously to help in deciding where to put developer effort. In order to promote nslu2 and arm you are kindly requested to say "yes" to enabling popularity-contest.

Notice: you must set the current date before running apt-get update. Otherwise gpg signature checking will fail.

To install these packages, type:

apt-get update
apt-get -y dist-upgrade
apt-get -y install anacron popularity-contest nslu2-utils

Install the latest kernel image:

echo "do_initrd = Yes" >> /etc/kernel-image.conf
apt-get -y install initramfs-tools
scp buildhost:linux-image-2.6.22-rc4-ixp4xx_2.6.22~rc4-1~experimental.1_arm.deb .
dpkg -i linux-image-2.6.22-rc4-ixp4xx_2.6.22~rc4-1~experimental.1_arm.deb

Copy the kernel and initrd, and use whatever means is usual for your device to flash these files into the appropriate partitions.

Now configure the passwd package, set the password for root and install openssh-server, so you will be able to log into your device after the reboot. First, configure passwd and enable the shadow passwords when asked.

dpkg-reconfigure passwd

Now install openssh-server. This takes a couple of minutes, because it will generate the necessary host keys. Install will fail if /etc/shadow is missing. It will also fail if you don't install "adduser-ng" package before installing openssh-server.

apt-get -y install openssh-server 

To get rid of the annoying LC_ALL, LANG etc. errors when running perl and other apps, install locales:

apt-get install locales
dpkg-reconfigure locales

Finally, type ^D (control-D) or exit to drop out of the chroot done a lot earlier.

Unmount your filesystems:

umount /mnt/debinst/proc
killall syslogd anacron
umount /mnt/debinst

Additional docs

  • When your Debian installation has booted, read /usr/share/doc/nslu2-utils/README.Debian
view · edit · print · history · Last edited by rwhitby.
Originally by rwhitby.
Page last modified on June 28, 2008, at 11:19 PM