The Sheeva plug is a relatively old ARM-based (ARMv5, Kirkwood/Feroceron CPU) “plug-style” Linux box, with 512Mb NAND flash, an SDCard reader, and an ethernet port. The configuration and handling is rather obscure and I tend to forget it - and the information is spread in different corners of the darknet. This is a guide to reinstall/modify/etc any Sheeva or similar device (such as Guru, Pogo plugs).
Preparing a “recovery” bootstick
- Get a USB stick, anything above 512Mb will do.
- Format it FAT32.
- Copy a Linux kernel for Kirkwood (uImage) and associated initrd (for ex take uImage and initrd from: archlinux).
- Copy a recent version of uboot for Sheeva plugs (for ex: u-boot).
- Copy a root filesystem tarball of the OS compiled for ARMv5 or Kirkwood you want to install (for ex: archlinuxarm).
- Plug the stick in the Sheeva, plug the USB cable in the Sheeva to your computer and ensure you have the correct serial drivers (See Amahi).
If using MacOSX, while patching the info.plist ensure the USB ProductID and VendorID are correct. The one from the page may be incorrect. You can check with the command
system_profiler SPUSBDataType as root.
Booting the Sheeva
With everything plugged in, start a terminal on the USB-emulated serial console, either with PuTTY (Windows), minicom, screen, etc. For example with screen:
# MacOSX $ screen /dev/cu.USB-XXXXXX 115200 # Linux $ screen /dev/ttyUSBxxxx 115200
Restart the Sheeva, you should see the boot/POST. Interrupt the boot process by hitting any key.
You are now in uboot, the boot loader.
Using uboot, the bootloader
uboot is a fairly powerful bootloader. You can find help on uboot commands with
You can find your current boot environment with
It’s likely that you want the latest version of uboot, as it can handle corrupted NANDs and other niceties better than the stock version installed. This will erase all your boot environment, so you might want to save some of it. It’s not required as we will recreate it.
Marvell>> usb start Marvell>> fatload usb 0:1 0x0800000 u-boot.kwb Marvell>> nand erase 0x0 0x60000 Marvell>> nand write 0x0800000 0x0 0x60000 Marvell>> reset
This will start USB, load the u-boot.kwb from the stick into RAM, erase the old bootloader, and finally write the bootloader from RAM to nand flash. Reset reboots, interrupt boot again by pressing any key.
You can see the new environment with ‘printenv’ and the new bootloader version with
This will default with a static ethernet address. Look at the MAC address of your Sheeva on the plug sticker, and add it back. You’ll also want a couple more settings to tell the Linux kernel about your board.
Marvell>> setenv ethaddr 00:50:43:... Marvell>> setenv mainlineLinux yes Marvell>> setenv arcNumber 2097 Marvell>> saveenv
For more information, see uboot-upgrade.
Load and boot your kernel
We’re going to load the kernel and initrd into memory:
Marvell>> usb start Marvell>> fatload usb 0:1 0x00800000 uImage Marvell>> fatload usb 0:1 0x01100000 initrd
If using the Debian/Ubuntu initrd linked in the previous steps, also add:
Marvell>> setenv bootargs console=ttyS0,115200n8 base-installer/initramfs-tools/driver-policy=most
Boot ‘em kernel and initrd:
Marvell>> bootm 0x00800000 0x01100000
kernel should boot and give you a prompt
Format/mount the NAND
You should now be in Linux.
Formatting the NAND
# mdev -s # ubiformat /dev/mtd2 -s 512 # ubiattach /dev/ubi_ctrl -m 2 # ubimkvol /dev/ubi0 -N rootfs -m
Mounting the NAND
# mdev -s # ubiattach /dev/ubi_ctrl -m 2 # mount -t ubifs ubi0:rootfs /mnt
Install Linux on the NAND
Mount the USB stick, then unpack the rootfs on the NAND.
# mkdir mnt2; mount /dev/sda1 /mnt2 # cd /mnt # tar xzf /mnt2/yourrootfs.tar.gz
Copy the kernel into the specific NAND-area:
# cat /mnt/boot/uImage > /dev/mtdblock1
Reboot, you’re done!
Misc: I want to boot on the sdcard, usb, etc.
To boot on the sdcard, you need to format the MMC (=sdcard) and copy a rootfs on it. Once copied, your bootloader bootcmd has to include the MMC initialization:
Marvell>> mmc init # Find the old bootcmd to edit Marvell>> printenv bootcmd Marvell>> setenv bootcmd <older args>; mmc init; ext2load mmc 0:1 0x6400000 /uImage <other args, such as bootm>
You can then instruct it to mmcload the uImage.
Similarly with USB, you’ll want to use ‘usb start’ and ‘ext2load usb …’:
Marvell>> setenv bootcmd_usb 'usb start; fatload usb 0:1 0x6400000 /uImage'
Run ‘saveenv’ when done, and ‘reset’ to reboot. If you’re unsure, you can run ‘bootm 0x00800000’ instead of ‘saveenv’ and the environment won’t be saved at reboot.
Errors when copying the kernel/no kernel on NAND mtb block 1
We will erase the kernel NAND area from the bootloader, mark it all zeros, load a new kernel image in memory, and write this kernel back to the NAND:
Marvell>> nand erase 0x100000 0x400000 Marvell>> nand scrub 0x100000 0x400000 Marvell>> fatload usb 0:1 0x00800000 uImage Marvell>> nand write 0x800000 0x100000 0x40000