Mike Levin SEO

Future-proof your technology-skills with Linux, Python, vim & git... and me!

Unbrick SheevaPlug

by Mike Levin SEO & Datamaster, 09/08/2010

Dorothy, you’re not in BIOS anymore. Yep, I bricked my SheevaPlug. This happened somewhere along the line of debootstrapping onto an SD card, a process which in all other ways went butter smooth. I posted that video to make the details of interacting with these silly embedded system more clear.

This video has nothing to do with unbricking SheevaPlug, but if you’re playing with it, you might also like the Raspberry Pi

I have two five SheevaPlugs, and am experimenting around with them figuring out how best to guide people on turning them into general purpose “Shank Servers” and a nice bare-bones minimal system. There is a lot to work out. First of all, it’s on the ARM architecture as opposed to Intel-style x86 architecture. That means everything is just a little bit different. We are specifically on the Kirkwood version of the ARM technology purchased by the company called Marvell from Intel, when Intel divested itself of the XScale technology, previously created by DEC called StrongARM, licensed from ARM, founded in a collaboration between Acorn, VLSI and Apple as a response to Commodore’s 6502 domination over low-end CPUs, which they acquired from MOS, a chip-provider to HP that hired a Chuck Peddle who previously worked for Motorola to make a $25 CPU-for-the-masses alternative to the $300 Motorola 6800 chip.

Pshwew! So there’s some quick history of the direct and indirect legacy of the hardware of that little SheevaPlug. It represents an alternative, computers for the masses—not the classes, branch of computing, today picked up by Raspberry Pi as a charity-type thing in the UK by which an actual computer that encourages hacking and learning is cheaper than a textbook. The SheevaPlug was the precursor to this, and still quite viable as a “headless” tiny computer.

We are on a processor with a rich history, currently being sold by Marvell as “embedded systems”. I think it’s a great system to be on, because a whole bunch of stuff uses it, and the open source community are familiar with it. But things are different right down to the bootloader, so there’s some new stuff to learn. Making matters worse, there’s all these “embedded systems people” in the forums who already understand this stuff–making those of us just making the transition feel stupid. Even a basic system install is a struggle.

But I am on a mission to help others make this transition with a little less pain. I’m making a switch as a developer to open source embedded systems, and the SheevaPlug is the perfect way to do it.

On x86 hardware, the common bootloaders to get Linux loaded are Lilo and Grub. Lilo is the simple one that I chose for ShankServer on x86 hardware, and Grub is the fancy one that handles more operating systems and multi-boot situations. But on embedded systems, there’s another popular one called Das U-Boot (Universal Boot Loader). And just as with x86 hardware, the moment that the lightning hits the Frankenstein monster, the bootloader is responsible for breathing that spark of life into your hardware. After that, comes the loading of the Linux kernel, and after that, all the things that activate the device’s particulars, and I/O for network communication and the like.

Now because generic embedded systems like the SheevaPlug are designed to be turned into factory-prepared turnkey systems for other things (like the Pogoplug), they’re not designed to be particularly easy to use as general servers, which puts us plug computer users on the bleeding edge. Things aren’t all that stable yet, and there’s a fairly high chance you’re going to screw something up. So, it is necessary to know the process of re-installing or “flashing” a new bootloader into the solid-state internal hard drive, or NAND. At the time I am writing this, the newest Marvell version of U-Boot for the SheevaPlug is 3.4.27 and can be found at SheevaPlug U-Boot Upgrade page—probably the most authoritative guy writing on the subject these days, Martin Michlmayr. Read the comments below for more detailed instructions.

The next thing you need to know is that there are 3 ways of getting things onto the device: the network port, the SD card port, or USB. Of course the enormous temptation is to use the USB port with a thumb-drive, but the big thing to know here is that not all thumb-drives are made equal. In fact, I had to go through 5 until I found a good one. It’s an older 512MB one given out at a trade-show, which are of course hard to come by these days. I’m not sure if it’s how old the drive is or how small it is that makes it work, but the trail of periods that are the user feedback for success when flashing a new bootloader just zip by with this thumb-drive, and they get stuck and time-out with every other drive I’ve tried. Martin suggests using the network port, specifically having a TFTP server set up. And in the end this may be the easiest and most reliable method, and as I do more and more with embedded systems, I will be sure to set up a TFTP server.

Okay, so basically just like Martin says, you download the latest compiled U-Boot for SheevaPlug, rename it uboot.bin, put it on the smallest, oldest USB thumb-drive you have, put it into the USB port of the SheevaPlug, connect over serial, and type off a few commands. Be sure to type version before and after to be sure that it took. For me right now, the line indicating that I did it correctly is:

U-Boot 1.1.4 (Dec 23 2009 - 13:32:43) Marvell version: 3.4.27

I’ve literally spent days trying to unbrick SheevaPlugs, Googling and combing over the results for the magic instructions, trying to avoid buying things and setting up new computers just to have the right operating system for running external tools. Theoretically, all you should need is any external system that can write to a FAT32 formatted USB stick, and can run serial terminal software like PuTTY. But the “official” SheevaPlug 1.0 installer page only tells you how to copy the correct files to the USB and either running a .exe or a .php file from a Windows or Linux host, respectively. That seems pretty friggin ridiculous to me, and I’m putting dissecting the runme.php on my to-do list, so I can do the process manually in the future.

But right now, because unbricking these things is such a compelling priority, I’m going to go with the graphical user interface that’s becoming popular these days for embedded systems in general to save you all this typing. It’s called ESIA at sourceforge.net, or Embedded System Easy Installer. http://sourceforge.net/projects/esia/ The thing to be sure of here (with the SheevaPlug) is that you’ve already updated the U-Boot bootloader, and I would suggest doing it manually (not through ESIA) by way of testing the reliability of your USB drive. If all goes well, you should see the line above, or else you will get an error about being stuck at 8% Starting on-board installer (turns out you’ll get it anyway, but no matter). After 3 days of struggling with these things, this ESIA thing was about the fortieth thing I tried, and being stuck at 8% with only vague answers at the plugcomputer.org forums is what got me to take a step back and systematically build it up, evaluating every weak link in the chain right down to the quality of the USB drives.

Okay, so you absolutely need a solid, tested, proven USB drive on the SheevaPlug. You can confirm this with a successful bootloader upgrade, per these instructions which was supposed to take care of having the latest bootloader to fix the problem being stuck in ESIA at 8%, but it didn’t. However, the install still succeeds. So, if you get suck at 8%, don’t despair!

[Update: refer to the comment below for a solution to this 8% problem]

Next, be sure to get the Linux distro you want. It seems that the trend is towards Debian Squeeze, even though the SheevaPlug ships with Ubuntu. But the instructions for the official installer rely on running an .exe that always fails, or a .php that always fails. And until I dissect the php to trigger these commands over serial, ESIA appears to be the best bet. And I’m totally cool with going with Debian over Ubuntu, in the spirit of staying closest to the basis for all other distributions. Chances are much higher that support for things hits Debian before Ubuntu, since Ubuntu is based on Debian.

So download and unarchive Debian Squeeze from sourceforge.net which is the file Debian_Squeeze_usb_app.tar.bz2 Copy Devbian directory onto your reliable USB drive. Keeping the Deiban_Squeeze directory is important for ESIA to detect is as an “Application”. Download the ESIA installer file setupESIA-2.0.5.exe from sourceforge.net. Connect your SheevaPlug to your PC and confirm you have a serial connection using PuTTY or such. Quit out of PuTTY so that you’re not locking ESIA out from serial port access, and run ESIA. If you forgot to quit out of PuTTY, no big deal. Just quit, and tell ESIA to rescan. You should be able to click on the MAC number that it shows, and confirm that even ESIA knows your U-Boot version 3.4.27.

If so, pop in your prepared USB stick containing the Debian files. Hit Rescan.

And now, go ahead and tell it to install onto Nand. Whatever it’s doing here is the ESIA alternative to running the runme.exe or runme.php from the official installer. It’s surely just triggering off a series of bootloader commands, and learning how to do this manually will eliminate the need for any special tools other than a serial terminal.

If it goes correctly, it will barely take an instant…

Ugh! Still stuck at 8%. But the threat at http://plugcomputer.org/plugforum/index.php?topic=1400.90 says that only U-Boot Marvell version 3.4.16 is known to get 8% in the ESIA requestor, but if you just let it sit for like 5 minutes, you can quit out of ESIA and go back into PuTTY, connect, and hit Enter on your keyboard… and voila! There you have it, the unbricked SheevaPlug.