Linux on Psion Series 5

This page is about installing and running Linux on a Psion Series 5 pocket computer, or palmtop, if you like. The project is called Linux7k (its official homepage). Other info from Tom Stoneham.

The instructions here or somewhat brief and my setup is far from optimal. More importantly this page is meant only as an indication, do not rely on it too much. If you make anything better, please let me know.

Good luck and welcome to the club!

Motivation

Psion S5 is small (see some pictures) and light (about 300g) so you can carry it around much more than a laptop. Its battery life is also superior, depending on what you do, it should work 30 hours on two AA batteries. It has 8MB internal RAM and its computing power can be equaled to an Intel 486 processor, which is enough for anything except numerical computation. It uses Compact Flash cards for permanent storage, which are basically a solid-state hard-disk replacement. CF cards are available in sizes up to 128MB. Psion S5 is slightly larger than Palm Pilot and similar devices but it has a keyboard which makes it (at least for me), much more useful.

I want to run Linux on my Psion because I prefer the command-line interface, and I wanted to have access to all the applications I am using on my desktop Linux computer.

Installation

Prerequisites

In the following text, I describe what to do to get Linux running on my configuration: A Linux box on which you have a root access, serial cable to connect Psion to the desktop and a decent size CF card (say 32MB). If you have in addition an interface to connect the CF to your desktop, you can perform some steps on the desktop, thus saving a lot of time transferring files across the serial link. I am giving an edited account of what needs to be done. If you prefer, you can also have a look at my notes in their raw form.

Plptools

Get plptools from ftp.to.com. I am using version plptools-0.6-1. Grab either a RPM or compile from sources. This gives you the possibility of transferring files between Linux and Psion under EPOC. If you just install the rpm, an nfs-like server will be installed which permits you to see the Psion file hierarchy under /mnt/psion/. Equivalently, you can use the ncftp ftp-like tool.

Cross-compilation environment

If you ever want to compile your own programs or kernels, you need a cross compilation environment. You can find Debian and RPM packages for the 386->arm cross compilation chain by the Embedded Debian. Otherwise, the description of how to do it can be found in Werner's xdev-0.README. He even provides some binaries at Calcaria. I personally compiled from sources, using egcs-1.1b.tar.bz2 from ftp.fh-koblenz.de. As I see, it is no longer there, so you might have to shop around. The patches did not work with any other versions of egcs I tried.

I do not think there is any point in building the aout chain, now that we have a Debian elf glibc based distribution. I just compile everything as elf. Note that in this case, you may not use the aout libc, you need an elf version.

Distribution

I am using Debian packages as a basis. As I work on a RedHat based system, I converted all the packages to rpm using alien. Then you can unpack the package into some private subdirectory using for example rpm2cpio package.rpm | cpio -d and choose the files you want.

Kernel

If you do not want to compile your own kernels, use ones Werner compiled. I had a good experience with stable-221-cb23-519-psi.gz. Otherwise, follow on reading.

The current kernel I am using is based on linux-2.2.1. Uncompress linux-2.2.1.tar.gz (all the files can be obtained from Calcaria) and patch it with

zcat kernel/patch-2.2.1-rmk2.gz | patch -p0
zcat kernel/linux-2.2.1-philb-990208.gz | patch -p0
cd linux
zcat ../cb/crash+burn-23.patch.gz | patch -p1
Configure to your liking: I changed keyboard, enabled sysrq and suppressed everything I did not need. My current config.

make Image should give you Image in linux/arch/arm/boot/Image

Then there is a process called gluing. Download boot-13.tar.gz, unpack, make. The gluing of a kernel you just compiled is performed by e.g.:

cd  ../boot
./glue.pl ../linux/arch/arm/boot/Image >../images/kernjk7

Initrd

Grab Klaasjan's initrds2.gz. (Also locally). Ungzip, mount -o loop -t ext2 initrds2 /mnt/misc. Go to /mnt/misc/lib and add a link from libnsl.so.1 to libnsl-2.1.2.so. Optionally get stty from the shellutils-2.0-5 package and put it somewhere like /mnt/misc/bin. If you do not do it you will have to transfer files through the serial link at the default speed of 9600Bd. Unmount and compress the ramdisk, download it to Psion.

There is now a new version of the initrd, initrds3 on Klaasjan's Linux7k page which should fix the above mentioned problems. I have not had time to test it yet.

Arlo

Arlo is the program running under EPOC to boot Linux. See the Booting-HOWTO for details. You can also get Arlo 0.51 locally. Basically, you download Arlo.sis, INSTEXE.EXE, your chosen kernel and ramdisk to Psion using Plptools, double click on INSTEXE.EXE, double click on Arlo to install it and finally double click on Arlo to run it which should give you the prompt. Then you say something like
l wkern
l initrd.gz
b

Later, when you have repartitioned your CF, it is a good idea to copy C:\System\Libs files to the corresponding directories at drive D: (CF). In the root directory of D: I keep the Arlo application, kernel and ramdisk. This avoids me to reinstall Arlo every time I reboot. To boot Linux with a root on the second partition of the CF, I say something like the following on Arlo's prompt:

l d:kernjk8
o root=/dev/hda2
b

Busybox

Busybox (the Lineo site does not seem to be accessible at the moment, so you might want to try a different source) is a single binary containing simplified versions of many small utilities. Greatly reduces memory usage. I compiled my own so that I can add modules to it. I had to add "ARCH=arm" and "CC=arm-linux-gcc" to the Makefile as well as to change strip to arm-linux-strip.

Slip

I chose to use SLIP as a protocol to run across the serial line because it is small. I just followed instructions in slip-1.tar.gz from Calcaria which gave me two binaries, one for the desktop, one for the Psion.

Making a filesystem

My strategy is to make a master copy of the Psion filesystem on the desktop machine. I made a script to do this. It needs to be run as root. Please read it and understand it before you run it. It will need some editing. It supposes you have downloaded the necessary packages and converted them to rpm, and have a compiled version of busybox somewhere. (If you do not, you can use the one in Klaasjan's initrd.) It currently installs bash as shell, jed as an editor Python as the scripting language, remind as the calendar program and some other utilities. The filesystem takes about 8MB uncompressed. It creates a directory with the master copy of the generated filesystem and a tar archive.

Repartitioning and populating your CF

Boot Linux on Psion with the ramdisk. Repartition your CF using fdisk /dev/hda. I created the first partition of type 6 FAT16 4MB, second partition (the rest) Linux ext2 filesystem. mke2fs -v -m 0 /dev/hda2 formats the new partition and mount -t ext2 /dev/hda2 /mnt mounts it. The first partition will have to be formated under EPOC next time you boot into it. Go to the mnt directory. On the desktop, stop plptools, set serial speed with stty 115200 -crtscts clocal </dev/ttyS0 and prepare a command sz psionfs.tgz </dev/ttyS0 >/dev/ttyS0 (do not press Enter yet) to transfer the tar archive of the master filesystem to Psion using ZMODEM on the first serial port. On the host, set serial speed with stty 115200 </dev/ttyS0, start receiving with rz </dev/ttyS0 >/dev/ttyS0, fire the command on the desktop. The transfer should start and take a few minutes. Uncompress the tar on the Psion using gunzip -c psionfs.tgz | tar -xvf - (alternative syntax might not work), remove psionfs.tgz, go to the top directory and unmount the CF. You can now reboot your Psion. I do not know how to do it properly, so normally I just kill the init process. Format the first partition of the CF under EPOC, restart plptools on master, transfer there your kernel and Arlo (see above). If you are cautious, transfer your initrd as well. If all goes well, you should be able to boot with /dev/hda2 as your root

Running Linux

Once you have Linux running from your CF, you can work as you would using Linux on any other platform. Currently, my setup gives you four virtual consoles (change with Menu+number) with root prompts.

Synchronization

When I connect Psion to the desktop, I set up the connection from the desktop side by
stty 115200 -crtscts clocal </dev/ttyS0
/home/jkybic/psion/slip/slip.host </dev/ttyS0 >/dev/ttyS0 &
ps -ef | grep slip
ifconfig sl0 10.0.0.1 pointopoint 10.0.0.2
# set date
tinyrsh strider date -s `date +%m%d%H%M%Y`
where the last line sets the correct time and date on the Psion, using tinyrsh, a client program for tinyrshd, a very simple server I added to busybox permitting to execute commands remotely. Beware, it is not safe at all.

On the client side, I invoke masterconnect

stty 115200 </dev/ttyS0
slip </dev/ttyS0 >/dev/ttyS0 &
ifconfig sl0 10.0.0.2 pointopoint 10.0.0.1
/sbin/tinyrshd &
Then I run rsync on the desktop in a server mode using configuration file /etc/rsyncd.conf containing lines such as
[psion]
path=/home/jkybic/psion/env/root_mkpsionfs
use chroot=yes
read only=yes
To download all the changes from the desktop to the Psion, I just say rsync -avz --delete --exclude "/proc/**" --exclude "/dos/**" 10.0.0.1::psion . from the root directory. If you are afraid, do not use --delete. This way, if I for example add some program to my master copy, only the files changed are transfered. To upload files, I also use rsync.

When you are done with the connection, kill the slip programs at both sides, as well as the tinyrshd daemon.

My troubles with the CF

My CF card did not want to work properly when woken up from standby. It gave me error messages and I regularly ended up with corrupted filesystems. As a temporary remedy, I switched off the automatic power management in etc/init.d/rcS by
echo "manual" >/proc/pm/cpu
echo "manual" >/proc/pm/cf
I also disabled switching off by the Off key by changing the function psion_off in drivers/char/kbd_psion.c to switch only on. Additionally, I added mdelay(1000) to the pm_complete function, but this is probably redundant. Now the only way to put the machine to sleep is to invoke the following shell script I called /bin/off
#!/bin/bash
echo Remounting root read-only
sync
mount -n -o remount,ro,noatime /
if [ $? -ne 0 ] ; then
    echo Remounting root read only failed
    exit 1 
fi 
e2fsck -p /dev/hda2
sleep 1
echo "Switching off"
echo "state 0" >/proc/pm/cpu
echo "Waking up"
echo Reinitializing cf
echo "state 0" >/proc/pm/cf
echo "state 1" >/proc/pm/cf
sync
echo Remounting root read-write
mount -o remount,rw,noatime /
echo Done
which takes the appropriate precautions. No processes may access the CF when off is invoked.

This seemed to have solved my problem. I would have loved to have a more elegant solution, doing all this in the kernel, I just do not know how.


[Home page]