You are here: Home / Attic / Sheevaplug Notes / sheevaplug rescue system

sheevaplug rescue system

This is a minimal kernel+initrd image. It can be booted on the plug via tftp (requires dhcp server and tftp server in the network). Once booted you will have a busybox, ubifstools and debootstrap.

With this you can try to revive an existing image in the flash, bootstrap a new one, pull a backup…

Booting

You need a tftp server and serial console to the plug. All changes to the u-boot are temporary. Start Plug and interrupt u-boot to get to the marvell prompt.

Marvell> setenv ipaddr 192.168.1.2
Marvell> setenv serverip 192.168.1.1
Marvell> setenv netmask 255.255.255.0
Marvell> setenv bootargs 'console=ttyS0,115200 ramdisk_size=16384 root=/dev/ram'
Marvell> tftp 0xe00000 uMulti
Marvell> TFTP from server 192.168.1.1; our IP address is 192.168.1.2
Filename 'uMulti'.
Load address: 0xe00000
Loading: ##################################################
         ...
         ###################################################
done
Bytes transferred = 5252797 (5026bd hex)
Marvell> bootm 0xe00000
Marvell>## Booting kernel from Legacy Image at 00e00000 ...
   Image Name:   description
   Image Type:   ARM Linux Multi-File Image (gzip compressed)
   Data Size:    5252733 Bytes =  5 MB
   Load Address: 00008000
   Entry Point:  00008000
   Contents:
      Image 0: 2696238 Bytes =  2.6 MB
      Image 1: 2556481 Bytes =  2.4 MB
   Verifying Checksum ... OK
## Loading init Ramdisk from multi component Legacy Image at 00e00000 ...
   Uncompressing Multi-File Image ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Linux version 2.6.34.1 (scorch@falcon) (gcc version 4.4.4 (GCC) ) #1 PREEMPT Sat Jul 17 15:13:14 CEST 2010
CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=00053977
CPU: VIVT data cache, VIVT instruction cache
Machine: Marvell GuruPlug Reference Board
Memory policy: ECC disabled, Data cache writeback
...
RAMDISK: gzip image found at block 0
...
bringing up the network
running dhcp
udhcpc (v1.16.2) started
Sending discover...
...
Lease of 192.168.1.2 obtained, lease time 86400
deleting routes
adding router 192.168.1.1
creating resolv.conf
setting hostname
WARNING NO HOSTNAME using heater
running boot scripts
starting syslog
root: starting ntpd
/etc/init/boot finished, login using ssh

heater login:

Using

mount flash using ubiattch, see Ubifs

Install new system

cdebootstrap --arch=armel squeeze /media http://ftp.de.debian.org/debian

pull a backup

on the server start a netcat listener

on the plug, mount filesystem, create tarball pipe to network

Modify

You need a Kernel, a rootfstarball, mkimage and genext2fs.

Kernel

If the kernel is a uImage we need to extract the raw kernel without the u-boot headers. Check if the Kernel is compressed using mkimage

mkimage -l /srv/tftp/uImage
        Image Name:   Linux-2.6.34.1
        Created:      Sat Jul 17 15:15:00 2010
        Image Type:   ARM Linux Kernel Image (uncompressed)
        Data Size:    2709828 Bytes = 2646.32 kB = 2.58 MB
        Load Address: 0x00008000
        Entry Point:  0x00008000

Extract the Kernel. The u-boot header is 64 bytes

dd if=/srv/tftp/uImage bs=64 skip=1 of=theKernel

Now, the kernel was uncompressed, (if it is already gzipped, skip this, just rename it).

gzip theKernel

Now you should have theKernel.gz

Filesystem

unpack the tarball, look around, modify at will. Prepare environment for the next commands

ROOTFS_DIR=rootfs
ROOTFS_SIZE=16384                  # size of file system image
ROOTFS_INODES=8000                 # number of inodes
ROOTFS_DEVICES=rootfs_devices.tab  # device description file

Using genext2fs we create a filesystem image of the rootfilesystem. Thanks to this step we do not require any root privileges (normally needed to create device nodes using mknod)

genext2fs -U \
      -d ${ROOTFS_DIR} \
      -D ${ROOTFS_DEVICES} \
      -b ${ROOTFS_SIZE} \
      -N ${ROOTFS_INODES} \
      ramdisk.img
gzip ramdisk.img

As root you could mount this image on your host using a loop-mount.

u-boot needs a header for every blob it loads.

If you only want to have a ramdisk

mkimage -A arm -T ramdisk -C gzip -n "description" -d ramdisk.img.gz uInitrd
cp uInitrd /srv/tftp/uInitrd

To build a combined image like this rescue system

# generate combined image
mkimage -A arm -O linux -T multi -C gzip \
        -n 'description ' \
        -a 0x00008000 -e 0x00008000 \
        -d theKernel.gz:ramdisk.img.gz \
        uMulti
cp uMulti /srv/tftp/uMulti