Welcome! Log In Create A New Profile

Advanced

Rescue system for use with USB sticks and TFTP

Posted by Johannes 
Johannes
Rescue system for use with USB sticks and TFTP
October 22, 2010 05:54PM
I've made a few small changes to the buildroot configuration to produce a rescue system which runs in RAM and can be loaded from USB or the network. The zip file contains the kernel "uImage-rescue" and the root filesystem "uInitrd-rescue". It also contains the modified buildroot configuration and corresponding md5 hashes for file integrity verification.

Booting the rescue system is accomplished by using uBoot to load the kernel and the root filesystem into RAM and calling bootm with the two addresses. For example, the following sequence will load the rescue system from the root directory of an ext2 (or ext3) formatted USB stick (in position 1):
usb start
ext2load usb 0:1 0x800000 uImage-rescue
ext2load usb 0:1 0xe00000 uInitrd-rescue
setenv bootargs console=$console $mtdparts
bootm 0x800000 0xe00000

Another option is to simply rename the files to uImage and uInitrd and place them in the root directory of an ext2 (or ext3) formatted USB stick. Jeff's boot loader configuration will then load the rescue system like a normal USB-installed system.

The kernel supports network console. It is enabled like this:
setenv bootargs netconsole=6666@10.0.0.3/eth0,6666@10.0.0.2/12:23:34:45:56:67 $mtdparts
where 10.0.0.3 is the IP address of the Dockstar, 10.0.0.2 is the IP address of the machine which displays the console output and 12:23:34:45:56:67 is the MAC address corresponding to that machine. Replace these values with the ones which are right for your network.

Since the system runs completely in RAM, all changes are lost after a reboot. This includes password changes and the autogenerated SSH host keys. The result is that the only user "root" always uses the password "root" and the host keys are always different, which triggers a security breach warning in the SSH client. Under these circumstances, SSH can not prevent man-in-the-middle attacks and anyone who can guess the root/root login can get full control over your Dockstar. You should therefore not use this system when TCP port 22 on the Dockstar can be reached from a public network (the internet, open wireless LAN, etc.).

Get the RAM based rescue system here:
http://www.sendspace.com/file/d6ffyd
The md5 hash of the zip file is 7f225435709cd0ffbb3619f86af42986.
Re: Rescue system for use with USB sticks and TFTP
October 23, 2010 01:48PM
This is a great idea! I'd be happy to give you space on this site to host this. Send me an email and I'll get you an account.

-- Jeff
Johannes
Re: Rescue system for use with USB sticks and TFTP
October 23, 2010 02:37PM
Permission granted to download the file and host it here. It's all open source anyway. I only changed a few configuration options to get Initrd support and a cpio.gz of the root filesystem. I also removed two unneeded gettys and a useless tail process from inittab and /usr/sbin/debootstrap and /usr/share/debootstrap because they didn't work. Your debian installation script reinstalls working versions on demand. The modified buildroot configuration is in the archive.
Johannes
Re: Rescue system for use with USB sticks and TFTP
October 30, 2010 12:58PM
New version: http://www.sendspace.com/file/afgz0q
(MD5: 495a32cbb2818111d7dc437805d2630e)

The buildroot configuration now comes with a patch which must be applied to the buildroot environment to prevent it from overriding the initial ramdisk support in the kernel configuration. The only other change is that I added microperl to the selection of packages.

With microperl installed, debootstrap works without externally compiled package details. Debootstrap itself is not part of the rescue system. Download the deb package to /tmp and extract it manually:
cd / ; mount -o remount,rw / ; ar p /tmp/debootstrap*.deb data.tar.gz | tar xvz
Then follow any debootstrap tutorial you like.

How to use Knoppix 6.2 and buildroot-dockstar-rescue_2010-10-29.tgz to compile your own kernel/initrd: (some Unix knowledge required)

You'll need about 4GB of hard disk space and the computer will be busy for hours.

Knoppix 6.2 is based on Debian and comes with package management tools, but since it's tuned for live-CD usage, there's a little tweaking to be done beforehand.

First become root:

su

Then use your favorite editor to edit /etc/apt/apt.conf.d/00knoppix and add this "APT::Cache-Limit 40000000;" (without the quotes).
Then:

apt-get update
apt-get install flex bison uboot-mkimage

Now you'll need to mount a filesystem with at least 4GB of free space. For example, mkdir /buildroot ; mount /dev/sda1 /buildroot ; cd /buildroot. If you're using a fresh virtual hard disk in a VM, you'll have to use fdisk and mkfs with appropriate parameters first.

Get the ZIP linked at the top of this comment and unpack it: unzip dockstar-rescue-system_2010-10-29.zip
Get the buildroot distribution from http://buildroot.uclibc.org/downloads/buildroot-2010.08.tar.gz
and unpack it: tar xzf buildroot-2010.08.tar.gz
cd buildroot-2010.08
Unpack the buildroot configuration: tar -xzf ../buildroot-dockstar-rescue_2010-10-29.tgz. That will give you a subfolder called "custom". Apply the patch: patch -p1 -i custom/buildroot-patch
Copy the configuration: cp custom/buildroot-config .config

The next step (literally) takes hours and fills 4GB of hard disk space: make

When it's all done, the kernel is in output/images/uImage (in ready-to-use uboot kernel image format) and the other files in output/images are the root file system in various forms. The rootfs.cpio.gz one is almost ready to be used as ramdisk. To use it with uboot, add the necessary header:
mkimage -A arm -O linux -T ramdisk -C gzip -a 0 -e 0 -n initramfs -d output/images/rootfs.cpio.gz output/images/uInitrd

Alternatively you can use bzip2 on rootfs.cpio and turn the result into an initrd image:
mkimage -A arm -O linux -T ramdisk -C bzip2 -a 0 -e 0 -n initramfs -d output/images/rootfs.cpio.bz2 output/images/uInitrd

That's all.
SebastianG
Re: Rescue system for use with USB sticks and TFTP
November 15, 2010 02:40PM
Thx! This modified rescue system for USB and tftp recently saved my ass (and quite a lot of work) ;)
Martin
Re: Rescue system for use with USB sticks and TFTP
February 25, 2011 03:30PM
Hi, I was wondering if I could get a little help, I am fairly lost.

I have installed openwrt (with their bootloader) but can't get it to work the way I wanted so I decided to switch to debian, however I can't seem to install your uboot that uses usb so I'm trying to do this restore so that I can run dockstar.debian-squeeze.sh

I have transferred the rescue files to an ext3 usb drive but it doesn't seem to be able to access the files, though it does show that it can see the partition so I tried doing wget from dropbox but I just get all these errors, my goal is to just get the correct bootloader and get squeeze on so I can run usbip on my dockstar.

This is the error I get when I try to run uInitrd-rescue


root@OpenWrt:/tmp# wget http://dl.dropbox.com/u/839/uInitrd-rescue
Connecting to dl.dropbox.com (184.72.226.9:80)
uInitrd-rescue 100% |********************************************************| 17009k 00:00:00 ETA
root@OpenWrt:/tmp# chmod +x uInitrd-rescue
root@OpenWrt:/tmp# ./uInitrd-rescue
./uInitrd-rescue: line 3: Ĥ: not found
./uInitrd-rescue: line 3: VØÏþ© Å\ÅSØinitramf¿uÁLÜKs#GrGò®µ,íz²9ÉyØ@#DJþ°u³ÕvXm²sû¶ÕM¨G´ó9-v: not found
./uInitrd-rescue: line 1: syntax error: unexpected word (expecting ")")
root@OpenWrt:/tmp# PuTTYPuTTY

and the error I get when I try to run uImage-rescue (sorry I didn't know which one to run first or... exactly what I was supposed to be doing)


0
./uImage-rescue: line 23: ºÿ0âeP
âUáèÿÿ:: not found
./uImage-rescue: line 24: ç
0 á: not found
./uImage-rescue: line 25: 0Øå4À
./uImage-rescue: line 26: syntax error: unexpected "("
root@OpenWrt:/tmp# PuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYP
uTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTY
Martin
Re: Rescue system for use with USB sticks and TFTP
February 25, 2011 08:21PM
please disregard my last message (I don't see a way to delete it)

I solved my issues by installing mtd-utils in my openwrt installation which finally allowed the uboot sh script script to change things inside of openwrt, then went in with a serial connection and got the rescue system running in memory and then got debian installed with the sh script.

Thank you for providing such excellent tools
Re: Rescue system for use with USB sticks and TFTP
May 01, 2011 08:08AM
I received a refurbed (and not properly booting) dockstar off ebay, got it hooked up to serial and want to load the rescue system in memory so that I can then install it onto the flash but I am receiving this error when the ram rescue image boots


done, booting the kernel.

Error: unrecognized/unsupported machine ID (r1 = 0x0000020f).

(I assume this is the best method to eventually get to the point that I can run debian from a flash drive, the dockstar currently won't get past the original uboot, but stops with some crc error when it tries to boot pogoplug, this is how I received it.)



Edited 1 time(s). Last edit at 05/01/2011 08:10AM by a5m0.
Re: Rescue system for use with USB sticks and TFTP
August 27, 2011 07:07PM
To start this rescue system from a tftp server, here are the commands to execute from uboot, assuming your tftp server is hosting both uinitrd & uImage and is accessible @192.168.1.1

setenv ipaddr 192.168.1.50
setenv netmask 255.255.255.0
setenv serverip 192.168.1.1

tftp 0x800000 uImage-rescue
tftp 0xe00000 uInitrd-rescue

setenv bootargs console=$console $mtdparts
bootm 0x800000 0xe00000
Re: Rescue system for use with USB sticks and TFTP
August 28, 2011 06:34PM
tsunulukai Wrote:
-------------------------------------------------------
> To start this rescue system from a tftp server,
> here are the commands to execute from uboot,
> assuming your tftp server is hosting both uinitrd
> & uImage and is accessible @192.168.1.1
>
> setenv ipaddr 192.168.1.50
> setenv netmask 255.255.255.0
> setenv serverip 192.168.1.1
>
> tftp 0x800000 uImage-rescue
> tftp 0xe00000 uInitrd-rescue
>
> setenv bootargs console=$console $mtdparts
> bootm 0x800000 0xe00000


thanks those were how I had gotten to the previous point, meaning after I ran bootm, then I received the error about unsupported machineid
Re: Rescue system for use with USB sticks and TFTP
August 30, 2011 11:05AM
Then you have to enter one of the following commands before "bootm" :

setenv arcNumber 2097
setenv arcNumber 2998
setenv arcNumber 3089

Those 3 arc numbers are respectively the "Generic Pogoplug ID", which doesn't support the dockstar led, the "Dockstar ID" and the "Goflex Net ID". The last two only works with newer kernels that now have support for those arcNumbers.

It should normally always work using the first one. The latter can only be used if you can provide a recent kernel.

Greetz,
Re: Rescue system for use with USB sticks and TFTP
September 22, 2011 05:39PM
Sweet - nice job!

I will take delivery of my Pogoplug EO2 (Kirkwood) in just a few days, and I must say that I'm happy with what you all have done here...
Re: Rescue system for use with USB sticks and TFTP
August 24, 2013 02:04PM
I know this is old but there might be some others with the same problem. I was having a weird time getting an updated uboot on my dockstar. I could only get the original -- everything else failed to run. Until I tftp'd Davys uboot from uboot. This got me a usb bootable device where I loaded this rescue disk.

I want to report that prior to that I had tried to load the ram version via the above tftp instructions and was hitting the same error regarding "unsupported" hardware. That's when it dawned on me that I should try tftp instead of jtag to update the uboot.

I had no fs on the unit so everything had to be done via the available channels.

I thought there was something wrong with the files because when I untarred the uboot it didn't match the description. But it still worked!

Thanks everybody for the great work!

Paul
Michael
Re: Rescue system for use with USB sticks and TFTP
December 27, 2013 06:25PM
Dear all,

I have really tried hard to get my dockstar work again, but i'm a linux newbie. I'm sorry. I messed up pogoplug FW, I couldn't find the dockstar via Ethernet, but I'm lucky that I can login via serial TTL cable to the newly flashed and working uboot.


U-Boot 2011.12 (Feb 12 2012 - 21:33:07)
Seagate FreeAgent DockStar

SoC:   Kirkwood 88F6281_A0
DRAM:  128 MiB
WARNING: Caches not enabled
NAND:  256 MiB
In:    serial
Out:   serial
Err:   serial
Net:   egiga0
88E1116 Initialized on egiga0
Hit any key to stop autoboot:  0

NAND read: device 0 offset 0x100000, size 0x300000
 3145728 bytes read: OK
## Booting kernel from Legacy Image at 00800000 ...
   Image Name:   Linux-2.6.22.18
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1978544 Bytes = 1.9 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

But now I tried to flash the rescue system above via tftp but it does not work.
What do i do wrong?
Would you please help me? Thank you!!!

Bytes transferred = 17417628 (109c59c hex)
u-boot>> setenv bootargs console=$console $mtdparts
u-boot>> bootm 0x800000 0xe00000
## Booting kernel from Legacy Image at 00800000 ...
   Image Name:   Linux-2.6.32.18-dockstar
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3185880 Bytes = 3 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 00e00000 ...
   Image Name:   initramfs
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    17417564 Bytes = 16.6 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux.......................................................................................................................................................................................................... done, booting the kernel.

Error: unrecognized/unsupported machine ID (r1 = 0x00000bb6).

Available machine support:

ID (hex)        NAME
00000690        Marvell DB-88F6281-BP Development Board
00000691        Marvell RD-88F6192-NAS Development Board
00000692        Marvell RD-88F6281 Reference Board
0000078c        Marvell 88F6281 GTW GE Board
00000831        Marvell SheevaPlug Reference Board
0000085b        QNAP TS-119/TS-219
00000915        Marvell OpenRD Base Board

Please check your kernel config and/or bootloader.

What can I do?
Re: Rescue system for use with USB sticks and TFTP
December 29, 2013 10:10PM
Michael,

Your installed rescue system does not support the Dockstar machid 0x00000bb6 (arcNumber 2998). You need to set arcNumber to 2097 (machid 0x00000831) to be able to boot.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Hi!

I stumbled to this thread after some very serious Googling about "How to UnBrick Dockstar".

Happened so far:

I got this Seagate DockStar from friend, who tried to install Debian into it but failed and was not any more interested to try again - so he gave this little gadget to me. I have no idea what he has done, but it seems that the DS is very dead :-(

I read this forum "from cover to cover" to learn what's going on with the box.

So, I hooked my serial adapter to it and started poking around.

The system:

After power on:
U-Boot 2011.12 (Feb 12 2012 - 21:33:07)
Seagate FreeAgent DockStar

SoC:   Kirkwood 88F6281_A0
DRAM:  128 MiB
WARNING: Caches not enabled
NAND:  256 MiB
In:    serial
Out:   serial
Err:   serial
Net:   egiga0
88E1116 Initialized on egiga0
Hit any key to stop autoboot:  0
u-boot>>

Version:
U-Boot 2011.12 (Feb 12 2012 - 21:33:07)
Seagate FreeAgent DockStar
arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2009q3-67) 4.4.1
GNU ld (Sourcery G++ Lite 2009q3-67) 2.19.51.20090709

Environment:
u-boot>> printenv
arcNumber=2097
baudrate=115200
bootcmd=usb=start
bootdelay=3
console=ttyS0,115200
ethact=egiga0
ethaddr=00:10:75:1A:DC:0E
force_rescue=0
force_rescue_bootcmd=if test $force_rescue -eq 1 || ext2load usb 0:1 0x1700000 /rescueme 1 || fatload usb 0:1 0x1700000 /rescueme.txt 1; then run rescue_bootcmd; fi
led_error=orange blinking
led_exit=green off
led_init=green blinking
mainlineLinux=yes
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
partition=nand0,2
pogo_bootcmd=if fsload uboot-original-mtd0.kwb; then go 0x800200; fi
rescue_bootcmd=if test $rescue_installed -eq 1; then run rescue_set_bootargs; nand read.e 0x800000 0x100000 0x400000; bootm 0x800000; else run pogo_bootcmd; fi
rescue_installed=0
rescue_set_bootargs=setenv bootargs console=$console ubi.mtd=2 root=ubi0:rootfs ro rootfstype=ubifs $mtdparts $rescue_custom_params
stderr=serial
stdin=serial
stdout=serial
ubifs_bootcmd=run ubifs_set_bootargs; if ubi part data && ubifsmount rootfs && ubifsload 0x800000 /boot/uImage && ubifsload 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; fi
ubifs_mtd=3
ubifs_set_bootargs=setenv bootargs console=$console ubi.mtd=$ubifs_mtd root=ubi0:rootfs rootfstype=ubifs $mtdparts $ubifs_custom_params
usb_boot=mw 0x800000 0 1; ext2load usb $usb_device 0x800000 /boot/uImage; if ext2load usb $usb_device 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; else bootm 0x800000; fi
usb_bootcmd=run usb_init; run usb_set_bootargs; run usb_boot
usb_device=0:4
usb_init=run usb_scan
usb_root=/dev/sda1
usb_rootdelay=10
usb_rootfstype=ext3
usb_scan=usb_scan_done=0;for scan in $usb_scan_list; do run usb_scan_$scan; if test $usb_scan_done -eq 0 && ext2load usb $usb 0x800000 /boot/uImage 1; then usb_scan_done=1; echo "Found bootable drive on usb $usb"; setenv usb_device $usb; setenv usb_root /dev/$dev; fi; done
usb_scan_1=usb=0:1 dev=sda1
usb_scan_2=usb=1:1 dev=sdb1
usb_scan_3=usb=2:1 dev=sdc1
usb_scan_4=usb=3:1 dev=sdd1
usb_scan_list=1 2 3 4
usb_set_bootargs=setenv bootargs console=$console root=$usb_root rootdelay=$usb_rootdelay rootfstype=$usb_rootfstype $mtdparts $usb_custom_params

Environment size: 2225/131068 bytes

As you can see, after the initial power on the system does not boot in any way, just sit's in the uboot prompt flashing the green led (initializing phase?). I do not know if my friend destroyed the original firmware (done something with the NAND) or has he altered the environment parameters.

Anyway, I then found this forum post about rescue system than can be run from TFTP! Great, as I do have serial connection, TFTP server and all needed files downloaded from the link in the original post.

Let's go:
u-boot>> setenv ipaddr 192.168.1.50
u-boot>> setenv serverip 192.168.1.1
u-boot>> tftp 0x800000 uImage-rescue
Using egiga0 device
TFTP from server 192.168.1.1; our IP address is 192.168.1.50
Filename 'uImage-rescue'.
Load address: 0x800000
Loading: #################################################################
         #################################################################
         #################################################################
         #######################
done
Bytes transferred = 3185944 (309d18 hex)
u-boot>> tftp 0xe00000 uInitrd-rescue
Using egiga0 device
TFTP from server 192.168.1.1; our IP address is 192.168.1.50
Filename 'uInitrd-rescue'.
Load address: 0xe00000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################
done
Bytes transferred = 17417628 (109c59c hex)
u-boot>> setenv bootargs console=$console $mtdparts
u-boot>> setenv arcNumber 2097

So far so good, let's boot:
u-boot>> bootm 0x800000 0xe00000
## Booting kernel from Legacy Image at 00800000 ...
   Image Name:   Linux-2.6.32.18-dockstar
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3185880 Bytes = 3 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 00e00000 ...
   Image Name:   initramfs
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    17417564 Bytes = 16.6 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux.......................................................................................................................................................................................................... done, booting the kernel.

Error: unrecognized/unsupported machine ID (r1 = 0x00000bb6).

Available machine support:

ID (hex)        NAME
00000690        Marvell DB-88F6281-BP Development Board
00000691        Marvell RD-88F6192-NAS Development Board
00000692        Marvell RD-88F6281 Reference Board
0000078c        Marvell 88F6281 GTW GE Board
00000831        Marvell SheevaPlug Reference Board
0000085b        QNAP TS-119/TS-219
00000915        Marvell OpenRD Base Board

Please check your kernel config and/or bootloader.

Errr... W0T?!

I do have the ID set to "2097" as can be seen in the environment print out.

While trying to understand what went wrong I noticed there are updated files available also for this TFTP rescue, or not "File not foud" when trying to download.

I'm stuck - so, are there newer post somewhere deep inside this forum that I just not haven't found that could help me more? Or is there another way to restore full original DockStar firmware, environment setting, kernel and all nand partition so that I could start over without trying to figure out what the heck has this little gadget done.

Any,I mean A N Y info would be great!

Br: Mac
Oops! I made it to the rescue prompt!!

I continued to read this (absolutely excellent) forum and saw Bodhi's reply to some other user and got an idé to try this with my system:

"Your uBoot envs look good, except that the machid is still set to dd6, while arcNumber is 2097. Without USB attached, try setting it again to 831 in serial console"

Hey hey hey, it booted to the rescue system!

Next step - to learn how to rescue the system and boot it from USB again :-)

As before, any info/hints are more than welcome!

Br: Mac
Re: Rescue system for use with USB sticks and TFTP
February 11, 2014 10:46AM
Mac,

Get the latest rootfs (link in my signature) and put it on USB, boot with it.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Bodhi, Thank you!

I have now fully working, booting system! This whole process took some 2 days & nights, but I'm very very satisfied :-)

-Mac
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: