Installation on internal NAND flash memory
Table of Contents
Scope
This document covers the installation of ArchMobile? onto a SheevaPlug? from an existing Arch Linux system. It will probably work from other distributions of Linux as well, but I haven't tested any others. The recovery tool I use to install Arch will also run on Windows, but once again, I haven't tested this. A similar procedure will probably work there as well.
Getting the Pieces
First, download the latest release of the Sheevaplug (re)installation tool from this wiki page. This tool completely wipes your Sheevaplug and uses the JTag interface to flash a new OS onto it. It also changes the root filesystem from a ramdisk to a UBIFS, which lets you run your plug directly from the flash memory.
Second, get the latest snapshot of ArchMobile? from here. We will need to modify a few files to get this to boot on the Sheevaplug, but it's far easier to extract a snapshot than to do a full install.
Modifying the Snapshot
The snapshot is designed for use on a Freerunner (or at least I think it is), so a few things have to be changed. The image comes with SSH installed, and it starts an SSH server at boot time, so that's all good for the Sheevaplug, but we need to set up a console on the serial port for disaster recovery and we need to fix /etc/fstab so the root filesystem is mounted correctly.
To make these changes, you should probably extract the snapshot to a directory of your choice, edit the files, then zip the archive back up. It's also possible to extract just the files you need and then put them back with some 'tar' magic, but because the snapshot comes as a tar.bz2 and the result needs to be a tar.gz, that approach doesn't have much of a benefit.
Firstly, the fstab:
# # /etc/fstab: static file system information # # <file system> <dir> <type> <options> <dump> <pass> none /dev/pts devpts defaults 0 0 none /dev/shm tmpfs defaults 0 0 ubi0:rootfs / ubifs defaults,noatime 0 0 tmpfs /var/lock tmpfs defaults,size=50m,mode=0755 0 0 #tmpfs /var/log tmpfs defaults,size=50m,mode=0755 0 0 tmpfs /var/run tmpfs defaults,size=50m,mode=0755 0 0 tmpfs /tmp tmpfs defaults,size=100m,mode=1777 0 0 /tmp /var/tmp bind defaults,bind 0 0
There are a few interesting things here, and I'll go through them one at a time. The first two lines are pretty much standard. The third line mounts a root filesystem on a UBIFS partition called "rootfs." This partition is created and named by the installer we're about to use. The fourth and sixth lines create temporary filesystems (that are lost on reboot) for /var/run and /var/lock. This is normal and accepted behavior. The fifth line creates a temporary filesystem for /var/log, which keeps the onboard flash from being overwritten every time something is recorded in the logs, but it also causes logs to be lost on reboot. This line is optional and its use must be left to user discretion. The last two lines set up a temporary filesystem for both /tmp and /var/tmp.
Furthermore we should include the changes of the Sheevaplug Postinstallation wiki page to the snapshot.
Putting it All Together
Okay, so you should now have an extracted snapshot of ArchMobile? that's ready to run on your Sheevaplug. Don't recompress it yet because we have to recompress it into the right format.
Extract that installer you downloaded earlier and go into the "installer" directory. We're going to replace rootfs.tar.gz with our rootfs. Head back over to the extracted snapshot, recompress it into a tar.gz, and replace installer/rootfs.tar.gz with the resulting archive. Now, when you run the installer, it will extract an ArchMobile? image instead of the default Ubuntu image.
At this point, you should be able to run "runme.sh" in the base directory of the installer, which should guide you through the rest of the process. Once you're done, your SheevaPlug? should reboot into a working ArchMobile? system. If it doesn't for some reason, please tell us about it by filing a bug report or telling us about it on the mailing lists or IRC (more information at WikiStart).