December 17, 2018

Un-Bricking Linux Plug Computers - page 2

uBoot, iBoot, We All Boot for uBoot

  • February 10, 2011
  • By Akkana Peck
The most common reason for talking to uBoot is "unbricking". In other words, you've done something to your plug that keeps it from booting properly, so it's no better than an expensive brick until you can fix the problem. Fortunately, bricking is almost never permanent.

You will need a serial cable and some files: at minimum, a kernel (named uImage) and the modules for it (modules.tar.gz). With any luck you have them on the CD that came with your plug; for a GuruPlug without a CD, a good source is plugcomputer.org's download section; or you can get newer kernels from sheeva-with-linux.com. (No, I don't know how to stop that annoying animated favicon.)

Some plugs make unbricking easy. For instance, the Ionics Stratus comes with a uBoot environment that gives an easy recovery from USB. Mount a USB stick (VFAT-formatted is fine) on your computer and copy the uImage and modules.tar.gz to it, along with two other files from the CD: rootfs.tar.gz and initrd.

Unmount the USB stick from your computer and insert it in the plug. Power up the plug, hit a key to get to the uBoot prompt, and type:

run recover2

If you're curious what that really does, type printenv on an Ionics. You'll be amazed!

Other plugs make it harder, and you might have to experiment a bit. For a Guruplug, I found it worked to copy uImage and modules.tar.gz to the USB stick, get to the uBoot prompt, then type:

usb start
fatload usb 0 0x00800000 uImage
nand erase clean 0x00100000 0x00400000
nand write.e 0x00800000 0x00100000 0x00400000
bootm 0x00800000 0x01100000
These commands are a simplified form of the run recover2 sequence Ionics uses. Once it boots, log in as root, cd / and extract modules.tar.gz from the USB stick using tar xvf.

Whew! As you see, plug wrangling requires a mixture of black magic and fearlessness.

uBoot can also load a kernel and initrd from an SD card, or over the net using the tftp protocol. On Ubuntu, the tftp package is broken, so try apt-get install xinetd tftpd then follow these tftp instructions, or try the tftpd-hpa or atftpd package.

Alternative unbrickers

You may read about two easier ways to unbrick a plug computer, though I didn't have much luck with either one.

One is a program called ESIA. It has a lovely Qt GUI that leads you through the unbricking process. Sounds great, but it never worked for me.

ESIA depends, among other things, on your Linux machine having the right version of openocd installed. If you run an old distro, or 64-bit Linux, it may help to build your own openocd from source.

Openocd talks to the plug over the serial cable using an interface called JTAG. This uses a Linux driver called ftdi_sio, which can get confused and not work properly unless you specify your plug's vendor and product ID. Here are the commands to use for a Guruplug:

$ sudo rmmod ftdi_sio
$ sudo modprobe ftdi_sio vendor=0x1c0c product=0x0102

If ESIA doesn't work, you might try the Sheevaplug Installer. It's a PHP script (there's also a Windows binary). Unfortunately, it has a tendency to bomb out with PHP errors, though a few people found solutions in this thread.

There's also an unbricker made specially for GuruPlugs (are you getting the impression that GuruPlugs are problem children?): GuruPlug Installer. It's a simple shell script, but like ESIA it depends heavily on openocd and ftdi_sio, so if one doesn't work the other probably won't either.

Don't Panic!

I hope I haven't scared you off completely. Plug computers can be a lot of fun. Just don't panic when your plug doesn't boot ... and don't put too much trust in the fancy unbricking scripts. Stick to uBoot and you'll get your plug working again.

Next time: tips on building kernels and other software for plug computers.

Akkana Peck is a longtime Linux programmer and is currently Chief Plug Wrangler at a startup. She's also the author of Beginning GIMP: From Novice to Professional

Most Popular LinuxPlanet Stories