Mast Kalandar

bandar's colander of random jamun aur aam

Mon, 12 May 2008

Recovering from a corrupted flash on Debian SLUG

debian, floss, slug [link] [comments ()] [raw]

My slug was temporarily bricked for a few days due to a mistake on my part. Fortunately, numerous write-ups by Martin Michlmayr and others helped me. Here I am adding one more source of the same information!

The following assumes that you have a backup.img which contains bootable Debian firmware for the slug but has the wrong kernel and initrd. One can probably use the Debian firmware that is the Debian Installer image otherwise --- but I have not tested this!

Moreover, I also assume that you have the full system installed on a USB disk which you have mounted on your regular desktop at /mnt.

Copy the kernel and initrd

We just create an new "recovery" directory and copy boot/ over from the mounted USB disk.

mkdir recover; cd recover
cp -a /mnt/boot .

At this point you can un-mount the USB disk and keep it ready to connect it to the slug.

Extract the files from the slug image

Next we extract the files from the slug backup image into another directory.

mkdir files; cd files
slugimage -u -i ../../backup.img

(Here you must use the actual path to the backup image file)

Replace initrd and vmlinuz by new ones

We first pad the initrd

dd if=../boot/initrd.img of=new-ramdisk ibs=4M conv=sync

(here you must you the actual file name of the initrd.img that you want to use to boot the slug) ... and then swap bytes

devio '<< new-ramdisk; xp $ 4' > ramdisk.gz 
rm new-ramdisk 

Next we swap bytes for the kernel as well

devio '<< ../boot/vmlinuz; xp $4' > vmlinuz 

(again you must use the actual file name of the kernel image in place of ../boot/vmlinuz above).

Actually build the image

This is just a single command

slugimage -L apex.bin -r ramdisk.gz -k vmlinuz -p -o ../../new.img

Put the slug in "firmware upload mode"

  1. Put the slug off and disconnect everything from it.

  2. Connect an ethernet cable 1 between your desktop and the slug. Connect the power plug for the slug but do not switch it on yet.

  3. Push a pin into the hole marked RESET at the back of the slub. Keep the pin pressed, while pressing and releasing the power button on the slug. Wait with the pin pressed until the top light on the slug turns red and the instantly release the pin.

You slug is now reset and waiting for a firmware upload.

Upload the firmware

On your desktop run the command

sudo upslug2 -i ../../new.img -d eth0

(Here ../../new.img should be replaced by the path for the image created above and eth0 should be the name of the ethernet interface on the desktop to which you connected the other end of your lan cable.)

This step takes a short while but shows you some progress information.

All systems "Go!"

If all went well you have rejuvenated your slug. You can now reconnect your USB disk to your slug and the system should boot as usual.

  1. You may need a cross-over cable if your desktop lan card is really old.


< May 2008 >
     1 2 3
4 5 6 7 8 910

2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1997, 1995,