July 23, 2014
 
 
RSSRSS feed

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.

uBoot

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)
Marvell-GuruPlug

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:
Marvell>> 

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;
bootdelay=3
baudrate=115200
x_bootcmd_usb=usb start
x_bootcmd_kernel=nand read.e 0x6400000 0x100000 0x400000
x_bootargs=console=ttyS0,115200
x_bootargs_root=ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs
ethaddr=02:50:43:16:d0:2b
ethact=egiga0
eth1addr=02:50:43:fb:31:71
bootargs=rootwait
stdin=serial
stdout=serial
stderr=serial

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 192.168.1.55
Marvell>> setenv serverip 192.168.1.1
Marvell>> setenv netmask 255.255.255.0

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.

Sitemap | Contact Us