New IT forum
11 August 2022, 12:23:49 am *
Welcome, %1$s. Please login or register.

: GertDuino now in stock.
 
Pages: [1]

Author Topic: How to restore an eSATA Sheevaplug using Usb  (Read 7786 times)

Headworx

  • Newbie
  • *
  • Posts: 12
How to restore an eSATA Sheevaplug using Usb
« on: 24 April 2011, 07:43:40 am »

Hi, Is the procedure the same for the SeevaPlug eSata, or does it differ in some details?

TIA
Headworx

Note from Marcus:

I have edited this post in order to split the topic from How to restore a Guruplug using Usb, where it was originally posted.
« Last Edit: 25 April 2011, 10:03:40 am by NewIT_Marcus »
Logged

NewIT_Marcus

  • Hero Member
  • *****
  • Posts: 960
Re: How to restore an eSATA Sheevaplug using Usb
« Reply #1 on: 25 April 2011, 12:53:35 am »

Hi, Is the procedure the same for the SeevaPlug eSata, or does it differ in some details?

TIA
Headworx

It depends upon what is your starting point, and what is your desired end point.

eg are you wanting to restore an eSATA Sheevaplug to the ex-factory jffs2 filesystem, or are you aiming to restore a UBIFS file system? As a starting point, do you have a working U-Boot?

This probably belongs in a separate thread.
« Last Edit: 25 April 2011, 10:04:15 am by NewIT_Marcus »
Logged

Headworx

  • Newbie
  • *
  • Posts: 12
Re: How to restore an eSATA Sheevaplug using Usb
« Reply #2 on: 25 April 2011, 08:47:23 am »

Hi, I have a perfectly working uBoot with recover1, recover2 etc commands defined. Basically what I think I need are the images for the USB stick to populate the internal NAND from. If you can provide both UBIFS and jffs2, that would be great.

TIA,
Headworx
« Last Edit: 25 April 2011, 10:04:47 am by NewIT_Marcus »
Logged

NewIT_Marcus

  • Hero Member
  • *****
  • Posts: 960
Re: How to restore an eSATA Sheevaplug using Usb
« Reply #3 on: 25 April 2011, 10:55:49 am »

I have split this topic from the Guruplug / beginners board, where it was originally posted. I didn't do a very good job of it (not used to splitting topics), so I've also manually edited the title in all previously posted messages. Sorry for any confusion.

The answer to your question is simple. The "installer" that is available from plugcomputer.org is the tool that we use to put a new UBIFS rootfs onto the NAND. It has several components:

  • an openocd binary (used to rewrite U-Boot and new environment variables)
  • The new version of U-Boot
  • A set of files that are copied onto a USB stick

You won't need to re-run the first part of the flashing procedure, since you have a working U-Boot and all your environment variables are in good order.

After openocd rewrites U-Boot, the target plug reboots using run recover1. This actually executes the other recover commands:

Code: [Select]
recover1=setenv mainlineLinux yes; setenv arcNumber 2097; setenv bootcmd run recover2; saveenv; reset
recover2=run recover3; setenv bootcmd $(real_bootcmd); saveenv; setenv bootargs $(bootargs_console) $(mtdpartitions) root=/dev/ram0 rw ramdisk=0x01100000,8M install_type=nand; bootm 0x00800000 0x01100000
recover3=run recover4; nand erase clean 0x00100000 0x00400000; nand write.e 0x00800000 0x00100000 0x00400000
recover4=usb start; fatload usb 0 0x00800000 uImage; fatload usb 0 0x01100000 initrd

The most interesting part of this procedure is recover4: usb start; fatload usb 0 0x00800000 uImage; fatload usb 0 0x01100000 initrd - which causes the plug to boot from uImage and initrd on the USB stick.

That initrd (on the USB stick, provided as a part of the installer download package) erases and formats NAND, then extracts a kernel and writes it to partition #1 and extracts and writes the rootfs to partition #2. This is the key part that you want to re-run. In fact you'll do so by typing run recover2 on the U-Boot command line. So now you know that what you need is the files that should be placed on the USB stick. You can use those provided with the installer download; doing so will write Ubuntu 9.04 to your NAND, as UBIFS. But, because you have an eSATA plug, your eSATA won't work until you upgrade the kernel (which you can do separately, afterwards).

We don't ever rewrite the jffs2 file system to NAND, since we consider that a downgrade. According to the comments in the initrd rcS, you can use the procedure to rewrite jffs2 (although the comments show that code changes must be applied). Like I say, we've never done it so I can't give you full details / examples.

Finally ... you'll need to format the USB stick (recommended that it be a 2G stick or less, but we've used 4G sticks without any problem) with FAT16 and place on it the following files:

  • Our Debian rootfs (or you can use the Ubuntu rootfs with the installer package)
  • Kernel (both uImage AND the -newit versions), modules, and initrd from here
  • The installer-autorun.txt file. This does not exist in the original installer package. For you, I think the procedure will run OK without it, but I've uploaded it anyway. (For us, it allows us to use a configuration file to choose between several rootfs's and uImages that may exist on the USB stick. For you, I think it will detect only one of each, and use it)

You MUST also download the md5s and copy them to the USB stick

Note that our initrd (and uImage) is different from that in the original installer. If you have a recent (A1 cpu) plug the new uImage is an essential component. Because you have an eSATA plug, the uImage-2.6.36-newit kernel is equally important. Additionally, our initrd will also regenerate your ssh keys (compared to the keys that are within the compressed rootfs) - you'll see this occur in the console. If you install Debian, you'll probably need to adjust the system clock after the final reboot.

So:
  • Format your USB stick as FAT16
  • Copy the files referred to above onto the USB stick
  • Power up your Sheevaplug and intercept U-Boot; type run recover2
  • Watch & wait for approximately 5 minutes

If you have any problems, please post any relevant error messages, and tell us your arcNumber.
« Last Edit: 25 April 2011, 04:30:35 pm by NewIT_Marcus »
Logged

Headworx

  • Newbie
  • *
  • Posts: 12
Re: How to restore an eSATA Sheevaplug using Usb
« Reply #4 on: 25 April 2011, 03:03:28 pm »

Wow what a comprehensive how-to. I am impressed :).

I think I did everything as you said. In the final moments after populating the ubifs partition, it reboots, so I removed the USB stick.

In the uBoot it thoiws a series of errors:

Code: [Select]
Hit any key to stop autoboot:  0
Error! cmd : 8, err : 0201
Error! cmd : 55, err : 0201
Error! cmd : 41, err : 0201
(...)
No MMC card found
** Bad partition 1 **
## Booting image at 00800000 ...
Bad Magic Number

And then proceeds booting from Flash. Are the errors the result of trying to boot from SD? I have been using SD card for GuiPlug setup on the same machine....

Other than that it seems the above procedure works fine!
Logged

NewIT_Marcus

  • Hero Member
  • *****
  • Posts: 960
Re: How to restore an eSATA Sheevaplug using Usb
« Reply #5 on: 25 April 2011, 03:17:53 pm »

The errors are attempts to boot from an SD card. They're completely OK to ignore. Bad magic number means that U-Boot checked memory for a valid kernel and found that the magic number wasn't right, ergo it didn't even attempt to boot from the kernel, which wasn't there to boot from.

If you keep your USB stick safe, you can re-use it if there is a next time. Or, if you had an ex-factory Sheevaplug you could flash it to UBIFS by:

  • Manually upgrading U-Boot (via tftp, form the U-Boot prompt)
  • Manually changing all the relevant U-Boot environment variables (a bit of a pain, but that's what copy & paste is for)
  • run recover1

The middle item would need some expanding - the format of the setenv commands sometimes needs to be changed, ie setenv variable_name 'this value has multiple spaces' (the single quotation marks are critical), and the longer ones can be tricky to input. But the principle is as simple as that. (The installer executable automates those steps and take 2.5 minutes to do so).
Logged

Headworx

  • Newbie
  • *
  • Posts: 12
Re: How to restore an eSATA Sheevaplug using Usb
« Reply #6 on: 25 April 2011, 03:33:06 pm »

Yes I'll keep the stick for the future and thanks a lot for thorough explanation!

Cheers,
Headworx
Logged
Pages: [1]
 
 

Powered by MySQL Powered by PHP SMF 2.0.10 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!