NSLU2 Diagnostics with qemu

About

When using your NSLU2 with an alternate firmware, you may encounter problems. I'm facing the problem, that my Slug won't boot anymore and I don't have a RS-232 converter at the moment to connect to my Slug via serial port.
One solution I came to is booting your slugs OS through qemu. I used a 4GB USB-Stick to store my Debian installation.

Kernel resource

http://www.aurel32.net/info/debian_arm_qemu.php is a very good resource, I'm using the kernel and initrd images from this site.

How-To

This section is under construction.

Make a copy of the USB-Stick

Assuming your USB-Stick's device node is /dev/sda:

dd if=/dev/sda of=sda bs=512

Also make a backup, we will overwrite the current content of the USB-Stick later. You also could store the partition table, if you are planning to change your image without qemu.

/sbin/cfdisk -P t /dev/sda >partitiontable.txt

The output cat partitiontable.txt

Partitionstabelle von /dev/sda

         ---Anfangs----      -----End------   Anfangs-   Anzahl der
 # Flags Kopf Sekt Zyl.  ID  Kopf Sekt Zyl    Sektor     Sektoren
-- ----- ---- ---- ---- ---- ---- ---- ---- ----------- -----------
 1  0x00    1    1    0 0x83  254   63  479          63     7711137
 2  0x00    0    1  480 0x82  254   63  497     7711200      289170
 3  0x00    0    0    0 0x00    0    0    0           0           0
 4  0x00    0    0    0 0x00    0    0    0           0           0

Booting your NSLU2 using single user mode

We need to disable the LED activation scripts, otherwise the system won't boot completely.

qemu-system-arm -M versatilepb -m 256 -hda sda \
-kernel vmlinuz-2.6.18-5-versatile -initrd initrd.img-2.6.18-5-versatile \
-append "root=/dev/sda1 single"

a more elegant way is following way to run your configuration

qemu-system-arm -M versatilepb -m 256 -hda sda -nographic \
-kernel vmlinuz-2.6.18-5-versatile \
-initrd initrd.img-2.6.18-5-versatile \
-append "root=/dev/sda1 console=ttyAMA0 single"

This will use your terminal window for output, this should be more comfortable than a 80×25 wide display.
This will boot your actual DebianSlug installation in single user-mode.

After a while he finished the boot process and asks for your root password.

Starting the network device

During boot you may noticed a message, that eth0 has been renamed to eth2. To bring up your network, just execute:

dhclient eth2

Writing back to USB

To copy all your changes back to the USB-Stick, you could do a

dd if=sda of=/dev/sda bs=512

Before running this command please ensure, that this device is your USB-Stick. Overwriting a wrong device damages your partition table and could result in data-loss!

Trouble Shooting

During working with qemu and my Slug image I encountered following problems

Activity LED for disk 2 doesn't turn on

Turn it on by running

leds disk-2 on

to turn it of again

leds disk-2 off
Is it possible to mount the generated image?

You can mount the image by using a loop-device. There is a little need of a calculation, so if you have dumped the partitiontable to partitiontable.txt, look up the Start-Sector of the partition you want to mount.
Partition one starts at sector 63 and the blocksize is 512 in this example. The offset will be at:

63 * 512 = 32256

Mounting the loop device:

losetup /dev/loop/0 -o 32256 sda
mount /dev/loop/0 /mnt/misc/

Umounting the loop device:

umount /mnt/misc/
losetup -d /dev/loop/0

Could not load /lib/modules/2.6.18-5-versatile/modules.dep

FIXME

timestamp YYYY-MM-DD hh:mm:ss is <large_number> in the future

set your time be using date or run a ntp client. I have ntpd installed, so executing

ntpd -s

should fix your time.

Disclaimer

And before someone tries to blame me for any damage or data-loss. I don't take any responsibility for any mistakes you make.

Discussion

Enter your comment
If you can't read the letters on the image, download this .wav file to get them read to you.
 
 
linux/nslu2/firstaid.txt · Last modified: 2007/11/28 18:03 by jpk
Recent changes RSS feed Creative Commons License Valid XHTML 1.0 Valid CSS Driven by DokuWiki