May 25, 2018

Un-Bricking Linux Plug Computers

uBoot, iBoot, We All Boot for uBoot

  • February 10, 2011
  • By Akkana Peck
Little Linux wall wart computers have a thousand and one uses. But what if you accidentally brick your little plug server? No worries, for Akkana Peck shows us how to un-brick them.
The last article on plug computers covered the basics of choosing a plug and talking to it over a USB-serial connection. But what if something goes wrong? Today's article will cover uBoot and how to "unbrick" your plug.


When you first power on your plug computer with the serial line connected, you'll probably see something like this:

U-Boot 2010.03-01161-gd91b0a9 (Apr 22 2010 - 03:24:41)

SoC:   Kirkwood 88F6281_A0
DRAM:  512 MB
NAND:  512 MiB
In:    serial
Out:   serial
Err:   serial
Net:   egiga0, egiga1
88E1121 Initialized on egiga0
88E1121 Initialized on egiga1
Hit any key to stop autoboot:  3 

The counter counts down from three to zero, so you have to be quick about hitting a key. That drops you into a prompt:

Now you're in uBoot, a boot loader similar to grub or syslinux, but optimized for small embedded Linux systems. It's used on a wide variety of small Linux systems: I've seen uBoot controlling Atmel circuit boards, Chumby toys and Android phones.

The uBoot environment -- especially details like where to find the kernel and the root filesystem -- varies quite a bit from one device to the next. Some plugs have a helpful collection of uBoot aliases built in; others don't. To see yours, type:

Marvell>> printenv
bootcmd=${x_bootcmd_usb}; ${x_bootcmd_kernel}; setenv
 bootargs ${x_bootargs} ${x_bootargs_root}; 
 bootm 0x6400000;
x_bootcmd_usb=usb start
x_bootcmd_kernel=nand read.e 0x6400000 0x100000 0x400000
x_bootargs_root=ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs

Environment size: 441/131068 bytes

Whenever you first start working with a new type of plug, I recommend you run printenv and save the results safely on another machine. It might save hassle later if you fiddle too much and break something.

If you need to change environment variables, use setenv:

Marvell>> setenv ipaddr
Marvell>> setenv serverip
Marvell>> setenv netmask

If you change something and want to make it permanent, saveenv saves the current settings to the plug's flash memory.

uBoot has a surprisingly good built-in help system: type help for a list of commands, and help command for more details. If you want more, you'll find a complete uBoot command list at the AVRFreaks uBoot Command Reference, and there's a nice overview of uBoot in this PDF presentation on uBoot.

Most Popular LinuxPlanet Stories

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.