Installing Debian Jessie on a Sheevaplug (into internal memory)

Installing Debian 8 (or Jessie if you like) on a Sheevaplug consists of several steps. At least that’s how I managed to install it.

  • Install Debian 8 on a USB drive or a SD card
  • Copy the contents of the USB drive to internal memory
  • Edit the configuration on the internal memory
  • Set up U-Boot to boot your fresh install

Installing Debian 8 on a USB drive

Martin Michlmayr wrote a very detailed tutorial how to get this done. So I won’t repeat everything here. Just follow his tutorial until he describes how to set up U-Boot. We don’t want to do this part since we don’t want to use this installation permanently.

Installation tutorial:

Copy the contents of the USB drive to internal memory

First we need to boot our new installation on the USB drive. Type the following lines at the U-Boot 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'
run bootcmd

This should boot your new system and let you log in. Log in as root as we need root permissions for the following steps. Then we need to install the tools to manipulate UBI filesystems

apt-get install mtd-utils

to set up and boot the internal memory as follows

ubiformat /dev/mtd2 -s 512
ubiattach /dev/ubi_ctrl -m 2
ubimkvol /dev/ubi0 -N rootfs -m
mkfs.ubifs --compr=zlib /dev/ubi0_0
mount -t ubifs ubi0:rootfs /mnt

This mounts our internal flash storage in the directory /mnt. That’s where we want to copy our install to:

mkdir /tmp/rootfs
mount -o bind / /tmp/rootfs/
cp -a /tmp/rootfs/* /mnt/
cp -a /boot /mnt/

Grab a cup of coffee since this takes a while.

Edit the configuration on the internal memory

As soon as the copying is done, we need to edit the configuration of the new system. We have to tell it to mount the internal flash memory instead of the USB stick as root filesystem. We also want to move /tmp to RAM as tmpfs since the lifetime of your internal memory is limited and we don’t want to waste those write cycles on temporary stuff. So edit the file /etc/fstab as follows:

# /etc/fstab: static file system information.
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).

ubi0:rootfs  /               ubifs   defaults,noatime,rw                    0 0
tmpfs        /tmp            tmpfs   defaults,nosuid,nodev                  0 0

Make sure you remove all the other lines since you don’t want you system to go and try mounting the USB drive as root fs. Now it’s time to save the file and reboot your system with a reboot or shutdown -r NOW if you feel more unixy right now.

Set up U-Boot to boot your fresh install

Now all that’s left to do is making you system boot the new install. So back at the U-Boot console enter the following lines:

setenv mtdids nand0=orion_nand
setenv mtdparts mtdparts=orion_nand:0xa0000@0x0(u-boot),0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs)

setenv bootargs_ubi 'console=ttyS0,115200 ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs'
setenv bootcmd_ubi 'ubi part nand0,2; ubifsmount ubi0; ubifsload 0x1100000 /boot/uInitrd; ubifsload 0x800000 /boot/uImage'
setenv bootcmd 'setenv bootargs ${bootargs_ubi}; run bootcmd_ubi; bootm 0x00800000 0x01100000'


Now your brand new shiny Debian Jessie installation should boot from the internal storage. Don’t forget to remove the USB drive to make sure it doesn’t interfere in any way with your new installation.


I basically figured none of this out by myself. With a few minor adaptions this is just the content of those two tutorials:

Even though there are a few minor adaptions you have to make for it to work with Debian 8.