Don’t brick it; this process is quite straightforward

Step by step guide to unbricking a SheevaPlug. You may think your ‘Plug is dead, but if you can plug it into a computer you can resurrect it.

What on Earth is a SheevaPlug?

The SheevaPlug is a “ plug computer ” designed to allow standard computing features in as small a space as possible. It was a small embedded Linux ARM computer without a display which can be considered an early predecessor to the subsequent Raspberry Pi .

https://en.wikipedia.org/wiki/SheevaPlug

The SheevaPlug Dev Kit comes with a JTAG connection.

This connects the ‘Plug to a computer’s USB port and communicates via the serial console.

This is exactly the same way that an Arduino can send info to the outside world.

Unbricking a SheevaPlug – Installing a TFTP server

Rather that messing about with files on a USB, you can use a TFTP server (trust me, it’s a lot easier).

To install a TFTP server run the following in a Terminal:

sudo apt install tftpd-hpa

Then, check that it is running:

sudo systemctl status tftpd-hpa

Then, take ownership of the TFTP server directory:

sudo chown -R $USER /srv/tftp

Any files now placed in this directory will be available to pull onto the ‘Plug.

Unbricking a SheevaPlug – Recovery to a good u-boot after erasing NAND

The NAND contains three partitions:

  • MTD0 – u-boot, think of it as the grub of embedded systems
  • MTD1 – uImage, the kernel
  • MTD2 – rootfs, the filesystem

If you were tinkering and completely erased the NAND then there will be no u-boot, which will not process the kernel, which will not boot into the filesystem.

In other words; bricked, so the first step is to get a working u-boot.

For this you’ll need openocd, the Open On-Chip Debugger.

To install openocd run the following in a Terminal:

sudo apt-get install openocd

Install some needed tools:

sudo apt-get install telnet screen

Finally a valid u-boot.elf needs to be in the host home directory.

I have an ancient version archived away but there may be a newer version on the Internet somewhere.

Open three (3) Terminals.

I use Terminator which allows for window tiling and a whole host of things I have yet to discover.

In Terminal 1 run the following:

screen /dev/ttyUSB0 115200

Then, in Terminal 2 run the following:

sudo openocd -f /usr/share/openocd/scripts/board/sheevaplug.cfg -s /usr/share/openocd/scripts

Now, in Terminal 3 run the following:

telnet localhost 4444

Then:

reset;sheevaplug_init;load_image u-boot.elf;resume 0x00600000

Back in Terminal 1 something is happening!

u-boot

Das U-Boot (subtitled “the Universal Boot Loader” and often shortened to U-Boot; see History for more about the name) is an open-source boot loader used in embedded devices to perform various low-level hardware initialization tasks and boot the device’s operating system kernel.

https://en.wikipedia.org/wiki/Das_U-Boot

This process assumes that the new u-boot files are on the TFTP server.

The Bookworm version provided by Debian is here .

Power on the ‘Plug.

In a Terminal run the following:

screen /dev/ttyUSB0 115200

Interrupt the boot process to get to the ‘Plug command prompt.

Then, type the following to set the TFTP environment variables:

setenv serverip <Host_IP>
setenv ipaddr <SheevaPlug_IP>
setenv ethaddr 00:50:43:01:63:EA
setenv macaddr 00:50:43:01:63:EA
saveenv

saveenv stores the variables so they will not need setting again.

Then:

tftpboot 0x0800000 u-boot.kwb
nand erase 0x0 0x80000
nand write 0x0800000 0x0 0x80000
reset

This erases a the portion of NAND reserved for u-boot and writes the new version.

The ‘Plug will now reboot.

Interrupt the boot process to get to the ‘Plug command prompt.

Installing Debian to USB from the TFTP server

Now that the ‘Plug boots with an updated u-boot we can install Debian Bookworm.

The Bookworm installation files are on the Debian website .

Set the ‘Plug to use the files on the TFTP server.

tftpboot 0x00800000 uImage
tftpboot 0x01100000 uInitrd
setenv bootargs console=ttyS0,115200n8 base-installer/initramfs-tools/driver-policy=most
bootm 0x00800000 0x01100000

The Debian installer should now install Bookworm to the USB.

Boot to Debian from USB

Instruct the ‘Plug to boot from USB.

Power on the ‘Plug.

In a Terminal run the following:

screen /dev/ttyUSB0 115200

Interrupt the boot process to get to the ‘Plug command prompt.

setenv bootargs_console console=ttyS0,115200
setenv bootcmd_usb 'usb start; ext2load usb 0:1 0x00800000 /uImage; ext2load usb 0:1 0x01100000 /uInitrd'
setenv bootcmd 'setenv bootargs ${bootargs_console}; run bootcmd_usb; bootm 0x00800000 0x01100000'
saveenv
run bootcmd

As before, saveenv stores the variables so they will not need setting again.

If in the future the ‘Plug needs to boot from NAND or MMC this instruction will need revisiting.

To reboot

reset

And that is how you go about unbricking a SheevaPlug.

Finally

Read more about my ‘ Cupboard of Forgotten Tech ‘ misadventures.