Kludged Etch  (beta)


Kludged linux for the Psion 5mx  by Adrian Wells.
Based on Debian GNU Linux 4.0 “Etch” ARM port.

Installation

You will need:
1. A Psion 5mx 16M (not the Psion 5mx pro 32M)
2. A Compact Flash card of  2G
3.
A CF card to pcmcia adapter (for use with a laptop) or CF card to USB adapter
4.
A PC or laptop running linux although this could be a live CD distro such as Knoppix , SLAX or puppy linux

5. A CD containing the current kludged.tgz file and the files and directories to boot the kernel.
6. Fit the flash disk into the Adapter and plug it into the machine running linux.
7. Do not mount the drive which should show as an IDE drive (perhaps /dev/hde )
8. Type fdisk /dev/hde then type p to show the disk partitions status as it is now (which should be /dev/hde1 as vfat)
d to delete the current partition, and delete partition 1
n for a new partition.
p for primary partition
1 for partition hde1
for size choose 8M for hde1 and make it bootable (a) and type 4 (vfat) (t)
n for new partition
p for primary
3 for partition hde3
for size choose 64M for hde3 and make it type 82 (Linux swap) (t)
n for new partition
p for primary
2 for partition hde2
use all remaining size for hde2 and make it type 83 (linux ext2) (t)
p again to check the table is correct
w to write the table to disk.
q to quit.
9. Having prepared the disk partitions we now format these partitions.
mkswap /dev/hde3 and then mkfs.ext2 /dev/hde2 and then mkfs.msdos /dev/hde1
mount -t vfat /dev/hde1 /mnt/hde1
mount -t ext2 /dev/hde2 /mnt/hde2 (assuming both /mnt/hde1 and /mnt/hde2 exist)
cd /mnt/hde2
ls (this should show a subdirectory listed lost+found)
tar -zxvf /path to the kludged.tgz file (this will take several minutes and you should see the contents of the tar file being uncompressed and a file structure being written to the flash disk.)
10. When it has finished and returned to the prompt then umount /dev/hde2 and then copy over the files and directories in the folder (files) on the CD as they are. Then umount /dev/hde1 and remove the Flash disk
Installation is now complete, insert the card into the psion and navigate to D:\arlo\arlo.exe using the EPOC system and double click on arlo.exe to run it. If all went well the Psion 5mx should boot to a login prompt.

Setting up the system

Login as root with toor as the password. You will be forced to change this password.
Set the date and time by typing setdate then follow instructions.

Other users can be added by the adduser command. There is a guest account (password = password)Next setup ppp. This can be done by manually editing the files in /etc/ppp/ but note that for the psion you must use /dev/ttyAM1 for the comm port or /dev/ircomm0 for an IrDA modem.
Alternatively you can use wvdial: First connect your modem, (wvdial is a little more intelligent and so will auto detect the modem). If an IrDA modem is used then turn it on and type iron to connect the IrDA. Then run wvdialconf /etc/wvdial.conf to find the modem. After the modem has been detected, then the /etc/wvdial.conf can be edited  for :-

ISP phone number
Login name
Password.
After ppp has been setup manually, the command pon starts the dial up connection, and poff stops it.
To use the infra red port to connect to an IrDA mobile phone it must have a proper modem built in such as the Sony Ericsson's.  An infrared modem (such as the Psion dacom travel modem) can be used. Put /dev/ircomm0 as the port in place of the /dev/ttyAM1 in the ppp configuration files.
To enable the IR port type iron to disable the IR port type iroff.  To test if the other end port is found after the iron commands is run, type ifconfig which will show local irda0 interface (and traffic) and then cat /proc/net/IrDA/discovery to show some details about the remote equipment. Then for instance after configuring ppp, you can connect to your dial up ISP via an IrDA mobile phone by typing iron and then pon. At time to disconnect, type poff then iroff. For wvdial switch on/off the infrared port and then run wvdial to connect.
Note. You can not telnet or ftp into the Psion using the root logon, you must use an ordinary user account, after this however you can su to the root account.
Most of the PC keyboard functions have been met, but the 'F1 – F10' keys are achieved by Esc 1 – Esc 0, '` (back tick)' by Fn
Del and '| (pipe)' by Fn t. The backlight and contrast are controlled using the same keys as EPOC.
Typing reset resets the console display, clear clears it.
Terminals can be switched by menu 1, menu 2 etc. (multi user but only 3 user consoles are set up - come on it is only a PDA). You can however, telnet in to the Psion over the serial link (using PPP), and have many sessions running at the same time from a PC as a remote terminal.
Communications to a Linux PC is done using PPP. Copy over the files in the PC directory of the CD onto your Linux PC and put pcon and pcoff into /usr/bin on your Linux PC.
Add lines:
10.0.2.1 pc
10.0.2.2 psion
to the PC's /etc/hosts file.
Then to communicate between the Psion and the PC connect using the serial cable to PC com1 and type pcon on the PC and pcon on the Psion. The two are then connected by TCP/IP. use ftp or telnet ssh to talk to each other but note, user accounts must be set up on each as you cannot ssh telnet or ftp using the root as a user normally. So for instance typing telnet pc on the Psion will give you a console login for the PC and vice versa. If the PC is running a web server you can browse its pages using the lynx browser.
pcoff on both the PC and Psion ends the connection.

There is a script setdev which can be run if you have any problems with some of the device files in /dev notably /dev/ttyAM0, /dev/ttyAM1, /dev/dsp, /dev/ppp There seems to be an issue with selinux not creating these files on first boot.

4.2. Applications.

Text Editors                 vi, pico, mcedit or aee
Type Setting                 halibut, antiword
Spreadsheet                 sc
File Manager                midnight commander
Browser                       lynx
Communications           minicom
Servers                         telnetd, ftpd, micro_httpd, lpd
Networking                  netcat, ftp, telnet, ssh, centericq
Database/PIM              index, ccal
Calculator                     calc, units, bc
Games                          hangman, freesweep

For E mail, pine can be used to directly use your pop mailbox as its “Inbox Folder” by using the following configuration setup:
personal-name    = your name
user-id                = popuserid
user-domain        = yourisp.com
smtp-server        = smtp.yourisp.com
nntp-server         = nntp.yourisp.com
inbox-path          = {pop.yourisp.com/pop3/user=popuserid}inbox

First you should login as another user, pine sets itself up to send mail as user@domain so for instant if my ISP email address is adrian@isp.com then I create a user account adrian on my psion, login and then run pine in this account. setting the domain as isp.com. This will have the correct replyto setup in pine. Remember to run ppp as root then su to the user account to run pine.

For applications help, use the console man command, there are also some links at  http://www.ajwells.net.

Mounting System Partitions


System mounts are specified in /etc/fstab and are mounted during system startup:
Default System Mounts
Mount Point             Mounted Filesystem Description
/                               /dev/hda2 Second (Linux) partition on CF card
/msdos                     /dev/hda1 First (EPOC) partition on CF card
/proc                        proc Kernel data filesystem
The EPOC partition uses the same format as DOS/Windows hard disk - the FAT filesystem. Mounting it as /msdos means that you can access any files you put on it from Linux as well as EPOC. This proves a useful way to transfer files.


 The Keyboard and Setting Keys

The Psion 5mx keyboard is very different from the standard PC keyboard. We use the following special key assignments (UK keyboard):

Psion Key Function

PC Key

Fn 

Alt Gr

Menu 

Alt

Fn-T  

| (pipe)

Fn-Del    

‘ (backtick)

Menu-1, Menu-2 etc

Alt-F1 (VT1) Alt-F2 (VT2) etc

Ctrl-Menu-,  

SysRq

Ctrl-Menu-Del 

Ctrl-Alt-Del (Reboot)

Fn-Space

Backlight on/off

Fn-Esc

Power on/off

Fn-M  

Reduce Contrast

Fn-. 

Increase contrast

Esc-1, Esc-2 etc 

F1, F2 etc


Linux provides several virtual terminals that can be selected using Menu-1, Menu-2, etc. You can go back and forth between the various screens at will, and so multi-process. Kludged linux has 3 virtual terminals (this saves memory over the usual 6). /etc/inittab controls how many VTs are started.
Advanced Info: The command dumpkeys > filename will dump out a set of key mappings that you can take a look at. loadkeys filename will then load in that keymap (with whatever modifications you have made to it). If you have trouble saving your special keys functionality, you can comment out or delete the lines for the special keys (e.g., the space key) to preserve their special functions (e.g., the backlight).

Sleeping when not in use

The Esc/On key will take your Psion in and out of sleep mode just as it does for EPOC. If this doesn’t work then by far the most likely reason is the irattach daemon (which deals with infrared connections). If this is running it wakes the machine up again immediately so you can’t sleep. Until this is fixed you need to kill it in order to sleep the machine. Do this with iroff.

Getting back to EPOC

The Linux system can be halted by the command shutdown –h now and rebooted by shutdown –r now or by cntl - menu - del combination. In use all the commands have the same effect, they return the machine to EPOC and on doing this the Psion automatically runs the arlo.exe program (giving the boot menu) by a file /system/data/wsini.ini
After each reboot the time and date lag by the duration that the system was down as to keep the time approximately correct on reboot time is written to a file which is read again on startup. Hence occasionally after several reboots or a lengthy shutdown, the time with need to be adjusted using the script 'setdate'.
If the Compact flash is to be removed or the batteries changed, then power off the machine during the 5 seconds  it displays this menu using (Fn – off) and then do it. If you replace the CF card and power on, the menu may continue as normal, or you may need to select the exit option from the menu and try again.
If your machine is hung for some reason and you need to reset it manually, then:
Open the backup battery door and locate the small copper coloured circle near the battery, using a partly unfolded paperclip or similar, gently press in the copper coloured circle. Now close the backup battery door, and hit the Esc/on key. The machine should beep twice and then display the Psion splash screen. On the 5mx there is a delay while EPOC reads its system out of ROM and reloads it into RAM.
Note: While pressing the Esc/on key you may need to holding down both shift keys to encourage EPOC to
clear all memory, but this is not usually needed.

If the Compact Flash disk has been corrupted it can cause the reboot to fail - remove the disk to allow EPOC to start, and then reinstall your system to the disk.

Installing New Packages

Packages can be installed from the Debian Etch packages http://packages.debian.org/stable (arm architecture) with varying degrees of success. To install a package xxx.deb type
dpkg -i xxx.deb
To remove a package type
dpkg -r xxx or to completely remove all config files dpkg –purge xxx
The apt package has been removed to save disk space. It needed more than 16M RAM to run anyway unfortunately.
There are also some arm binaries available here http://www.handhelds.org/download/misc/linux/arm/netwinder-rpms/RPMS/dm/3.1-15/
But these are rpm files and would need to be extracted using some other linux machine and then installed manually.

System Control

The kernel provides various ways of interacting with the special features of the Psion hardware. For example it flashes the ’recording’ LED during CPU activity so you can see how much work the system is doing by looking at the flash rate. The LED normally flashes quickly. When it is running flat out the LED is almost permanently on. When sleeping the LED doesn’t flash at all. Most of the other items such as the case opening status, and backlight, and accessed via the /proc filesystem. This gives you access to an enormous amount of information about the kernel and running application, networking status etc, but the bit which concerns the Psion hardware is the /proc/psionw directory. The name comes from Psion Windermere, which is the codename for the 5mx/5mx-Pro hardware. In here we have the following files:
backlight
State of the backlight - 1 is on, 0 is off. Read/write. Writing 1 will turn the backlight on , writing 0 will turn
if off.
case
State of the case switch - 1 is open, 0 is closed. This is read-only.
contrast
Current contrast setting for the display. Read-only.
cpu
CPU is the CPU speed in Mhz. Read-only.
lcd
Display power status - 1 is on, 0 is off. Read/write. Writing 0 will turn the display off, writing 1 will turn it
back on.
mains
Mains power status - 1 is mains present, 0 is mains disconnected. Read-only
sleep
Sleep status - 1 is sleeping, 0 is running. Read/write. Writing 1 to this file will cause the machine to sleep.
state
uart1
uart2
These all contain 0 or 1 except contrast and cpu. Set a writeable value to 1 like this: echo "1" > backlight

Sound

Sound is supported. cat /dev/dsp > soundfile.al will record from the microphone and cat soundfile.al > /dev/dsp will play it. A mixer will need to be installed to vary volume.

Printing

You can print directly from the Psion to a serial or infra-red printer (or via a serial-to-parallel converter), or you can print to a network printer over the PPP network connection. The lpr, enscript and magicfilter packages are installed and the lpd daemon running, also /dev/lp0 and /dev/lp1 symlinked to /dev/ttyAM1 -  this means text files can be printed directly to a parallel printer when connected to the serial port via a null modem lead and serial to parallel converter cable. A Patton 2029 cable was used during testing. Magicfilter seems to handle the format of printing well with text, certainly to the printers I tested it with. 
Use the command lpr filename to print,  lpq to show a print queue and lprm to  remove  items from the queue.