|Perl Monk, Perl Meditation|
Installing Perl on the Sharp Zaurus PDAby davido (Archbishop)
|on Aug 24, 2003 at 19:08 UTC||Need Help??|
Installing Perl on the Sharp Zaurus PDA
IntroductionThe Sharp Zaurus series of PDA's (particularly the SL-5500, and SL-5600) have caught on among techies, being one of a very small number of PDA's capable of running Linux as their operating system. The Sharp Zaurus series, in fact, is currently the only line of PDAs that ships with Linux right from the factory, though the iPaq can be converted over to Linux with a custom flash-rom.
It stands to reason that with a Linux environment, it would only be a matter of time before someone got around to porting Perl over to the Zaurus. That time has come (and in fact came awhile ago). It should be noted that I am not the person who went to all the work of porting Perl to the Sharp Zaurus. Fortunately that work has already been done for us, and we (Zaurus users) are all grateful. Therefore, the intent of this post is to explain where to obtain it, how to install it, and how to take this existing port and maximize its effective use without using up all your internal storage space.
Why this discussion is necessary
Before I go into explaining how to install it and such, I wanted to first explain the constraints which hinder bringing Perl to the Zaurus. The Sharp Zaurus PDA has 64MB of internal memory, plus 16MB of firmware flashable ROM. The 64MB internal memory is divided up into operating RAM and file storage space. Various revisions of Sharp's firmware (as well as open-source firmware, 3rd party commercial firmware, and 3rd party custom ROMs) take an assortment of approaches toward dividing the internal memory between RAM and Internal Storage space. The latest official Sharp ROM as of the time of writing of this post is Sharp ROM version 3.10. That version divides the internal memory in half; half for RAM and half for storage.
Of the approximately 32MB of storage space, a substantial portion is used for the storage of operating system and standard software applications that ship with the Zaurus. After all is said and done, the user has about 15MB of internal storage left for loading applications. The Sharp Zaurus SL-5600 has 32mb of RAM, and 64MB of internal storage space, so internal memory isn't such a scarce resource on that unit. Nevertheless, it doesn't hurt to keep as much of it open for applications that require it as possible. And this document will walk you through it.
The Perl 5.6.1-7 port for the Zaurus consumes about 4MB of internal storage space, without loading POD's and a few of the core modules! Perl isn't a storage hog on a big system, but in the context of a PDA, it's quite large.
Those constraints understood, let's move on to what you need, and the steps I use to maximize my installation of Perl 5.6.1-7 for the Sharp Zaurus. These steps assume that you wish to stay with Sharp's ROM, or a custom ROM that remains similar to Sharp ROM 3.10 or later.
What hardware you need:
You need a Sharp Zaurus SL-5500 or SL-5600. I own an SL-5500, and this post is known specifically to be applicable to the 5500. But 5600 owners can probably adapt everything here to their system too.
I also strongly recommend that you get a 128mb (or larger) SD card. Starting with Sharp ROM version 3.10, the SD and CF cards can be mounted directly on the Sharp Zaurus's filesystem, and thus become an integral part of the filesystem. The result is that you can move applications and data from where they are expected to be, in internal storage, off to the SD card, and then just provide symbolic links in internal storage. I recommend using the SD card for additional storage space on the Zaurus, because currently the Zaurus only recognizes SD memory cards. Whereas there is a multitude of non-memory devices in Compact Flash form factor, which the Zaurus can use. The point being, use SD for memory, and CF for other gadgets. More on the use of SD for storing Perl later.
Additional items of convenience and intrigue include getting a CF modem, and/or a CF WiFi card so that the Zaurus can become a part of your home and office network. With WiFi, you can mount your desktop's filesystem on the Zaurus, and the Zaurus's filesystem on your desktop. You can telnet into the Zaurus, and all sorts of other trickery. People have even run apache webserver from the Zaurus along with a WiFi card. The Zaurus lends itself well to geeky things like that.
Step 1: Get the latest Sharp Firmware and Terminal accessory.
Visit the Sharp Zaurus website and follow the links to download the latest ROM version (3.10 at the time of this writing) as well as the latest version of the Sharp tools for your desktop. ROM version 3.10 mounts the external memory cards right into the internal filesystem as samba drives. This is a powerful feature, and critical in maximizing your Perl installation.
You will also need to install Sharp's Terminal application, available from the same website. As an alternative, you may download and install 3rd party terminal applications, with an assortment of enhancements, from the Zaurus Software Index repository.
Step 2: Move some applications to the SD card
This step isn't vital, but if you want to free up more internal storage space, beginning with Sharp ROM version 3.10, you can choose to install some of the standard suite of Sharp and Hancom applications that come with the Zaurus ROM on SD or CF rather than coveted Internal Memory. Install as many of them as you can to the SD card. When I did this, I found that instead of 15MB of free internal storage space, I had about 18MB free. That's significant in such a tiny environment.
Step 3: Obtain and install the Perl .ipk distribution
You may obtain perl_5.6.1-7.arm.ipk from This feed . If that feed ever disappears, notify me and I'll see if I can find an alternate source, or if I can mirror the particular installation file myself.
UPDATE: I have just become aware of a new port of Perl 5.8.0, which preports to be complete!. The porter describes it as being "big big big", in the context of a Sharp Zaurus environment. Once I download and install it, I will update this document to include instructions on making the most of the new Perl 5.8.0 port for the Zaurus.
Send the .ipk over to the Zaurus's internal storage via IR transfer, WiFi, or USB Cradle, as you would any other .ipk, or install it through the network. And install it from within the "Settings" tab of the Qtopia GUI on the Zaurus.
People have tried to use the command line version of ipkg install from the Zaurus Terminal window to automatically install Perl to the SD card. This technique appears to fail with most ROM's, though I'm told that it works with Opie (open source) ROM. But there's still a way for the rest of us to install Perl to the SD card. It's just a little more involved. Read on.....
You now have a working version of Perl on your Sharp Zaurus. As mentioned before, this is version 5.6.1. This port lacks POD's (except for the obligatory credits and copywrite info), and lacks some of the core modules. The person who ported Perl to the Z had to make some decisions to get it to fit. And he did so in a time prior to Sharp ROM v3.10, which made possible our next step: moving Perl to the SD card. Thus, things were left out of the port that, now that ROM v3.10 is out there, didn't have to be left out. More on that later.
Step 4: Optimizing the installationFirst, if you type the following, you'll notice an immediate problem:
perl -e 'print "Hello world!\n"'
The Zaurus's bash startup scripts aren't setting the environment variable LC_ALL. You need to do this. I found it helpful to modify several files. On the Zaurus, you may use vi, from the terminal window, to edit text files.
Edit the copy of .profile found both in /home/root and /home/zaurus, by adding the following command at the end of each file:
Now when you restart the terminal window and execute a Perl script, you won't get the barrage of warning messages about unset environment variables.
Next, you want to free up some space in Internal Storage. It's always my goal to keep that space as free as possible. You may do the following:
from the home directory....
The next set of substeps require that you switch to 'su' from within the terminal window. There are inherent risks any time you act as superuser. Be careful not to delete or break anything. It is assumed that you know your way around Linux, and know how to respect 'su'.
Next, with the mv command, move the following files and directories into the appropriate directories under usr on the SD card:
For the first two items listed above, you're just moving files (the Perl and Perldoc executables). For the rest of the items, you're moving directory structures with all their contents.
Next, create symbolic links to the new locations for all of the preceeding items. You'll be symbolically linking /usr/bin/perl (the file) to /home/samba/SD_Card/usr/bin/perl, and /usr/lib/perl (the directory to /home/samba/SD_Card/usr/lib/perl (the directory), for example.
Exit 'su' mode: exit.
Test your installation by running it through a few paces. Do a Perl one-liner. Test a simple script, etc.
You've now installed the latest Sharp firmware, plugged in an SD card, installed Terminal (from Sharp), used vi to edit your .profile scripts that start when Terminal is started, moved as much stuff as possible, including Perl, to your SD card, and created symbolic links to Perl's new home on your SD card, in /usr..... How does it feel?
There are a few known problems: First, some core modules are missing. The second problem compounds the first. The Zaurus doesn't ship with 'make', so I have yet to be able to install any CPAN, or the missing core modules, even though I have plenty of room on my SD card for some of that stuff. gcc, available on the Zaurus Software Index has a version of make, but installing gcc on the Zaurus requires the use of yet another custom ROM; one that provides a lot more free memory by moving all file stuff onto the SD card. Since I haven't installed gcc, I can't bring new modules over to the Zaurus. Second, I consider it a real problem that the perldocs aren't part of the distribution. Now that you've moved Perl over to your SD card, wouldn't it be nice to have access to the perldocs too? It's not a complete implementation without them. Third, vi is the only terminal (or shell) based editor on the Zaurus. Others have been written, but they're buggy. You can buy 3rd party GUI based editors, or download opie Open Source text editor. My preference is either Opie, or simply telnetting into the Zaurus from my desktop system when I want to make a simple change here and ther.
Additional Sources of Information
It is recommended that you check the following excellent resources for additional information and software downloads for the Sharp Zaurus:
Zaurus Software Developer's Discussion Forum: A forum open to anyone, with many discussion topics, mostly geared toward techies.
Zaurus Software Index: An index of hundreds of Zaurus software applications for every interest, from development to end user.
Zaurus's user support forum.: Download the latest ROM here, and other goodies.
I hope you find this brief tutorial helpful. Please post comments, or get in touch with me directly. If you have suggestions for improvement or corrections I'd like to hear.
"If I had my life to do over again, I'd be a plumber." -- Albert Einstein