6. Copying Files to the Psion and Making Partitions on the Compactflash Disk

6.1. Serial Ports, Minicom, and Comms

I call your attention to "irpsion5" which comes standard with the Linux irutils package. This utility lets you send files from the psion EPOC to a Linux box via IRDA.

The simplest way to copy a small file from the desktop computer to the psion is to execute "cat filename > /dev/ttyS0" on the desktop and log the output in comms on the psion. Similarly, you can send a file in comms (as ascii) and log the output on the desktop by "cat /dev/ttyS0 > filename" (^C when done). These assume that your psion is plugged into the /dev/ttyS0 serial port, of course.

[As an aside, note that you can print from EPOC on the psion to the serial port, and redirect the output from the serial port to the printer on the desktop by "cat /dev/ttyS0 > /dev/lp0". Start the redirect before printing, and ^C when done.]

All this assumes that you have your serial port properly set up for communication, which is the first thing to get working. The best way to go about setting this up is to use minicom on the desktop computer to verify the communication to comms on the psion - the right serial port to use (/dev/ttyS0 or /dev/ttyS1 usually) has to be determined and the baud rate has to be set right (115200 8N1 is usually best).

Once communication is working properly, you can send files back and forth between comms and minicom using xmodem, ymodem, zmodem, or ascii.

You can set the serial port baud rate manually using stty -F /dev/ttyS0 115200 (see the man page for stty for other options).

6.2. PLP Tools

A better and more sophisticated way to get the files onto your Psion is to use Plp tools plptools. [Personally, I've found plptools to be a little tempermental...] Compile and install these, and then use this to transfer the necessary files onto the Psion's CF through EPOC. The information here is for the most part copied from the plptools documentation. Please read the man pages for ncpd(8), plpftp(1), and plpnfsd(8); these are the programs that make up plptools. The daemons set up an nfs-like connection to the psion, so that the psion's "D:" drive will be mounted to /mnt/psion/d:, similarly for the "C:" and "Z:" drives.

ncpd is the daemon which handles the serial link to your Psion. It listens at port 7501 for local connections and provides basic PLP/NCP services for the other two programs. It auto- connects to the psion, even after unplugging/switching off therefore it can run always in background (if you have a spare serial-device). If supplied, the -e option will cause ncpd to automatically exit when the connection to the Psion is lost.

plpftp is a FTP-like program for manipulating files on the Psion.

plpnfsd is a daemon, which provides NFS-like access to your Psion. It automatically makes the psion's filesystems available below an NFS-mounted directory (default /mnt/psion). By default, plpnfsd is installed suid-root, so any normal user can start it and get's the mounted directory owned by himself. As this program is usually used on single-user machines, this does not hurt security. Like the others, this program auto-reconnects after a link-failure, so you can keep the psion mounted all the time, even when it is not connected. Due to Rudol Koenig's clever error-handling, you don't need to worry about blocked io-processes if the psion isn't available. You simply will get an "device not configured" error, when accessing a file on a previously connected psion which has been disconnected. After that, the mount-point will appear empty. As soon as the psion is connected again, the subdirectories will reappear. (possibly with a few secs delay)

For example to copy the arlo.sis file onto the Psion's C: drive (ramdisk) you type the following command: cp arlo.sis /mnt/psion/c:

There is also a KDE-based interface to the programs above. See the plptools website or the package documentation for more information.

You may have to manually set the baud rate of the serial port before starting up ncpd and plpnfsd to get it to work. Try:

stty -F /dev/ttyS0 1:0:800018b2:0:3:1c:7f:15:4:5:1:0:11:13:1a:0:12:f:17:16:0:0:2f:0:0:0:0:0:0:0:0:0:0:0:0:0
to set the serial port speed, etc.

6.3. Partitioning the Compactflash using initrd

If you want to boot your system off a CF disk, you need to repartition it. These disks arrive from the store with a single Fat16 partition. You will need a reasonably-sized CF - 64MB or larger is preferred. A more effective way to repartition the compactflash disk is to plug it directly into a desktop or notebook computer, as described below. If you don't have this capability, then you can follow the procedure given next.

Begin by installing ARLO, a kernel and an initrd.gz onto the "C:" disk in EPOC (see the section Booting using ARLO). Then, boot into initrd.gz, using a kernel that supports CF disks. When this minimal linux system has booted up, execute "fdisk /dev/hda" to partition the drive and set the partition types. Partition your system so that you have a 4-6Mb Fat16 partition (or larger if you want a larger disk to use in EPOC) as /dev/hda1. Then make the rest of the disk (/dev/hda2) an ext2 partition for linux. For the Fat16 partition (/dev/hda1), use type 4, (FAT16 <32M) (assuming it's less than 32MB). Quit fdisk and format the ext2 filesystem ("mke2fs /dev/hda2"). You will probably have to boot into EPOC to format the "D:" disk (/dev/hda1) as an msdos filesytem (depending on how good your initrd system is...does it have mkdosfs?). When you have rebooted back into EPOC and formated the new, smaller "D:" drive, install ARLO, a kernel and an initrd on this Fat16 partition (the "D:" disk). Get ARLO properly set up, and now you don't have to re-install ARLO every time you reboot. You also have a larger disk to work with in linux.

To boot a CF based system, be sure to pass the appropriate option into the kernel (see Passing parameters into the kernel); this can now be set up using the ARLO GUI. Alternatively you can use the rdev command to alter the flags in your kernel (i.e., set the root device) before you "glue" it.

Additional pointers on installing a linux system without a desktop system can be found HERE.

6.4. Partitioning, Formatting, and Copying to Compactflash using a Desktop Computer

The quickest and simplest way to install OpenPsion, or to copy large files to the system, is to use a (US$10-20) pcmcia or USB adapter to plug your compactflash disk directly into a notebook or desktop computer. The basic installation is in two steps (1) format the compactflash disk to have a 3.5 MB (or larger) dos filesystem and an ext2 filesystem of the remainder of the disk and (2) to unpack tarballs such as "disk1.tar.gz" (for EPOC, ARLO, initrd, and kernel) and "disk2.tar.gz" (for the linux system) into those respective filesystems. If you don't have such disks, you will have to bring over the various bits over the serial line...try to get the tarballs.

STEP 1. With the compactflash inserted in your desktop or notebook computer, access it with fdisk; BE VERY SURE YOU ARE USING THE RIGHT DEVICE - YOU CAN TAKE OUT YOUR DESKTOP LINUX SYSTEM!. I used "fdisk /dev/hde", but you may need to use "/dev/sda" etc. - whatever device your system recognizes as your compactflash. Delete the dos partition on the compactflash. Make the first primary partition to be 3.5 MB or larger in size (cylinder 1 to +3500K), and set its type to dos fat16 (I used type 4). Make the second partition to be the remainder of the compactflash and leave it as an ext2/linux partition (unless you have a large disk and want swap space or a second partition for some reason). Make the dos filesystem on /dev/hde1 ("mkdosfs /dev/hde1" ***see large capitalized letters above***) and the ext2 filesystem on /dev/hde2 ("mke2fs /dev/hde2" ***ditto***). Done with step 1!

STEP 2. Mount the dos filesystem - "mount -t vfat /dev/hde1 /flash" (I used /flash but you can use any convenient mount point). Unpack the first disk tar package into /flash: "tar xfz disk1.tar.gz -C /flash". Unmount the dos filesystem "umount /flash". Mount the ext2 filesystem - "mount -t ext2 /dev/hde2 /flash". Unpack the second linux system disk tar package into /flash - "tar xfz disk2.tar.gz -C /flash". Note you are better off using tar this way, rather than untarring the package to a filesystem and copying the filesystem over, because tar preserves the links, while "cp" will make duplicate files of the links and so use up much more space (but perhaps there is a smarter way of using "cp"). [You can also untar this filesystem in a convenient isolated directory, and browse through it and/or modify it to your own purposes before putting it on the compactflash disk]. Unmount the ext2 filesystem "umount /flash". Done with step 2!

If you are using modules with your kernel, unpack the modules files to, e.g., /lib/modules/2.4.27-vrs1-5mx2 if your kernel is version 2.4.27-vrs1-5mx2 (found by "uname -a"). You may have to execute "depmod -a" after boot up before you can get the modules properly working.

After waiting for the compactflash disk to properly unmount from the desktop (or execute "sync" before unmounting), take the disk out of the computer and put it in the psion. To boot up linux, start up ARLO (this used to be: highlight "arloapp.exe" on the "D:" disk and hit return, but now there is a nice ARLO GUI - see the section Booting using ARLO) and boot linux. You will likely get a LILO-like menu of flavors of systems to boot up. For example, Hit 1 for the normal multiuser system. Hit 2 for the normal single user system. Hit 3 for a system using the initrd.gz file, e.g. for system maintenance. Other options may be to boot with the console on the serial port, so that the psion can be accessed from e.g., minicom from the desktop. Normal use will probably be use compactflash disk and LCD. Without fuss or muss, when linux boots up you should get a login prompt - enter "root". In all likelihood no passwords required.

If you have large files or sets of files that you need to get onto the compactflash, you are probably better off plugging it into the notebook or desktop computer, mounting the disks there, and copying things directly. The compactflash disks are very fast; far faster than 115200 baud!

6.5. Using RSH/RCP and PPP Between the Desktop and OpenPsion

Once you have OpenPsion installed, your serial ports set up, and PPP working between the psion and the desktop computer, you can use rsh/rcp to copy things back and forth. Be sure rsh-server, rsh-clients and inetd or xinetd are installed. If you have set your system up to avoid using passwords, be sure the /etc/pam.d directory is deleted after installing rsh. If "openpsion" is the hostname of your psion, then from the desktop rcp filename openpsion: will copy filename over to the psion. Similarly, ssh can be used, although it will be a little slower because of the encryption overhead.

See the documentation for rsh or ssh on configuration, and see the additional notes in the section on Serial Ports and PPP.