Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Installing Perl on the Sharp Zaurus PDA

by davido (Archbishop)
on Aug 24, 2003 at 19:08 UTC ( #286241=perlmeditation: print w/ replies, xml ) Need Help??

Installing Perl on the Sharp Zaurus PDA

Introduction

The 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 installation

First, 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:

export LC_ALL = C

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....

cd ../samba/SD_Card md usr cd usr md bin md local md lib md share

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:

/usr/bin/perl /usr/bin/perldoc /usr/share/perl/ /usr/share/doc/ /usr/lib/perl/

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.

Summary

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.

Dave

"If I had my life to do over again, I'd be a plumber." -- Albert Einstein

Comment on Installing Perl on the Sharp Zaurus PDA
Select or Download Code
Re: Installing Perl on the Sharp Zaurus PDA
by Juerd (Abbot) on Aug 25, 2003 at 05:52 UTC

    Here's what I did with my Zaurus SL5600: The Zaurus has a web browser (Opera) and has a TCP/IP stack. I set up my Linux desktop machine as a simple router and set up the USB network connection. I downloaded the ipk file into the Zaurus' internal flash and clicked the file, then clicked "Install".

    I don't know the differences between the SL5500 and the SL5600, but I didn't need a terminal to install the package. The terminal application does come in handy when actually *using* Perl, of course :)

    Oh, about those modules: haven't needed many, yet. And those that I did need, were pure-perl and easily copied via scp.

    I'm not really giving any thought to memory usage. The SL5600 has 64 MB flash memory and 32 MB SDRAM. I have some CompactFlash cards ranging from 32 to 256 MB, but I use those only for MP3, photos and backups.

    Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }

      I've got a 5500, and i got perl working by "syncing" the ipk with my w2k machine, and just using the gui package manager.. no worries at all.

      OAN, I've owned two pda's (both palm), and the Z is my fav, even over friends with linux IPAQ's. It the k/b that does it for me.

Re: Installing Perl on the Sharp Zaurus PDA
by moxliukas (Curate) on Aug 25, 2003 at 07:05 UTC

    /me sighs...

    Are there any Perl ports to the PalmOS? There haven't been any the last time I looked (well, there was an empty sourceforge project IIRC, but it seemed dead for a long time).

      It hasn't been done yet, and I don't know if it ever will be done. The PalmOS provides programs with something like 2K of stack (that may not be the number, but it was definitely something ridiculous). PalmOS applications also have a very small amount of RAM allocated for their use, something like a few hundred K. Most perl programs can't handle these kinds of constraints.

      Also, the entire PalmOS API is non-standard - malloc and free are replaced with Mem* functions; any math functions have to be used from MathLib, which has to be dynamically loaded in, and which may or may not be available on the user's machine. Further, there's no filesystem per se on the Palm platform - just a bunch of databases. Accessing distinct records from a Perl application would probably require some kind of modification of Perl, or at the very least an ugly hack.

      So in other words, don't hold your breath. :)

      BTW, if any of those memory figures were incorrect, please let me know.


      it says she can do math, but will she recognize 8 / 0?

      We can only hope they've put in those safeguards.

      Worst case scenario: She succeeds in dividing by zero, and suddenly little Tiphany-Amber's bedroom becomes the center of a howling vortex of nonspace, frying the neighborhood with sparkling discharges of zero-point energy.

      - slashdot
Re: Installing Perl on the Sharp Zaurus PDA
by allolex (Curate) on Aug 25, 2003 at 13:09 UTC

    Installing Perl is a bit easier to do if you flash your Zaurus (mine is a SL-5500) with one of the OpenZaurus Project's ROMs. The installation of the Embedix kernel and OS is much more true to Linux. So installing Perl to the SD flash card is as easy as getting the familiar package (*.ipk), and typing ipkg -t sd install perl.ipk. (-t uses a non-default installation target).

    Vim, kate, and MicroEmacs are all available for the Zaurus and syntax highlighting is available for all of them. (gcc also works on the Zaurus, but don't hold your breath waiting for stuff to compile...).

    In addition to the excellent links in the root node, anyone interested in learning more about the Zaurus (or about their Zaurus) should have a look at the unofficial Zaurus FAQ.

    --
    Allolex

Re: Installing Perl on the Sharp Zaurus PDA
by davido (Archbishop) on Aug 25, 2003 at 16:30 UTC
    On August 24th (yesterday, at time of this post) Perl 5.8.0 became available for the Sharp Zaurus SL-5500 / SL-5600 series PDA's. I am working on downloading and installing it. Once I've got the installation to my liking, I'll edit my original post in this thread.

    Anyone interested in trying the latest version for the Sharp Zaurus, you can download it here: Perl_5.8.0_arm.ipk.

    There is a good discussion on the development and hosting of this latest port on the Zaurus Development Forum, here: Notes on Perl 5.8.0.

    UPDATE: So far I've been unable to get the existing Perl_5.8.0_arm.ipk file to install. There seem to be several issues; a number of tar files with bad headers, and probably most importantly, the ~/tmp directory (in Internal Memory) fills up before the 34mb install is shifted off to SD. I'm working on getting in touch with the person who ported it to see if I can bring the issues to his attention. Hopefully it won't be long before we've got a *full* albiet *big* implementation of Perl on the Zaurus. Until then, use Perl 5.6.1 as described in my root node for this thread.

    Good luck, and let me know any comments you have so that I can get them into a subsequent edit of this thread's root document.

    Dave

    "If I had my life to do over again, I'd be a plumber." -- Albert Einstein

      I'll check this out and see how it runs under OZ. Maybe we won't have the same problems.

      Watch this space

      Update 2003-09-01 23:33:45 CEST: I considered deleting that bit above, but I really don't have much to report. I tried the installation, but ipkg is flaking on me, so no-go so far. I think I may go ahead and re-flash my SL-5500 and try to install Perl as the first package.

      --
      Allolex

      The author of the port has spoken by posting the instructions for installation at The Zaurus Software Index where he says:

      This is a build of Perl 5.8.0 for thr Sharp Zaurus SL-5500. At ~34Mb it takes a lot of space and is best installed onto either an SD (mnt/card)or CF card (mnt/cf). I use it installed into an NFS filesystem, mounted as /mnt/pkgs. With the way "ipkg" works, you'll also need another ~34Mb at install time for temp's. It's best installed manually as (for example) #ipkg -d /mnt/card install Perl_5.8.0_arm.ipk and SD->SD took about 3 hours! It creates a ./pkgs directory (if necessary) to install itself into - a technique familiar to users of the UNIX "graft" facility.

      However, I can add that the ipkg -d /mnt/card install.... or its equivilant for Sharp ROM 3.10, ipkg -d /usr/mnt.rom/card install ..... doesn't work, because the temporary files fill up 100% of internal storage before the package is installed to SD. A workaround must exist, and I'm currently looking for a way to move the ipkg temp files to CF during the install.

      The other point that the author of the port made in a separate discussion thread at Zaurus Developers Forum was that the SD card needed to use the ext-2 filesystem. Instructions for converting from FAT to ext2 are available by searching the abovementioned website. When I get the whole thing to install properly I'll edit the original root node of this thread with new instructions and post a followup to alert people.

      Dave

      "If I had my life to do over again, I'd be a plumber." -- Albert Einstein

Re: Installing Perl on the Sharp Zaurus PDA
by Ryszard (Priest) on Aug 27, 2003 at 11:40 UTC
    I just noticed today that perl 5.8.0 has been made available for the Z. I've not installed it or used it in anyway, only noticed its available
Re: Installing Perl on the Sharp Zaurus PDA
by halley (Prior) on Aug 27, 2003 at 13:56 UTC
    This was the first non-standard package I put onto my Zaurus 5500. Yet I hardly use it. I might be more interested if there were modules and bindings for the gui toolkits, but I haven't found any.

    --
    [ e d @ h a l l e y . c c ]

Re: Installing Perl on the Sharp Zaurus PDA
by wolfger (Deacon) on Aug 27, 2003 at 15:27 UTC
    Not to sound redundant, but...
    I have the Zaurus 5500, running OpenZaurus, and installing perl (5.1.6) was as easy as transferring the ipk to a flash card and using the installer program. I even installed it to "ROM", which is possible using OpenZaurus (not possible with the factory load from Sharp).
    It's also worth noting that Konsole comes with OpenZaurus (Sharp's load had no term program!)

    I also noticed that 5.8 is out now, but I've haven't gotten around to installing it yet.

    Believe nothing, no matter where you read it, or who said it - even if I have said it - unless it agrees with your own reason and your own common sense. -- Buddha
Perl 5.8.0...
by strredwolf (Chaplain) on Jan 18, 2005 at 07:13 UTC
    I noticed that the ipk was out, and then noticed the complaint that the bruser would take up all of /tmp and flake out. So, we'd need to net-mount /tmp (or /var/tmp in this case) to an NFS share, and then ipkg install it.

    Of course, unarchiving the ipkg and doing a manual install may help...

    --
    $Stalag99{"URL"}="http://stalag99.keenspace.com";

      Okay. Setup:

      One 5500SL, flashed w/OpenZaurus
      One 128 MB SD
      One Linux box that has NFS installed, is connected to said Zaurus, and configured to talk to it.

      Create and export a directory to mount.
      SSH into your Zaurus and mount it. I use /mnt/net.

      Then: ipkg -d sd -t /mnt/net/tmp install Perl_5.8.0_arm.ipk

      The "-t" flag specifies a temporary directory. This means /tmp... errr... /var/tmp doesn't get touched. ...and it doesn't install right. Okay, let's see what this thing is.... ooooo, it's a gzipped tarball (unlike ar archives) and we can pull the files out of the "data.tar.gz" that it has. Inside, there's a ./perl/perl-5.8.0/(bin|lib) set. Eazy. Copy and symlink.

      --
      $Stalag99{"URL"}="http://stalag99.keenspace.com";

Re: Installing Perl on the Sharp Zaurus PDA
by g0n (Priest) on May 11, 2005 at 08:36 UTC
    I too was unable to install the ipk of perl 5.8. But, if you install zaurus-debian a full install of 5.8.4 comes along with it. That only works while you are chroot'd into debian of course.

    I've got 5.6 installed for little bits & pieces when running in PDA mode, for anything more serious I can start up an X server and run in debian.

    (C1000 with 1GB SD card & sharp rom)

    --------------------------------------------------------------

    g0n, backpropagated monk

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://286241]
Approved by ybiC
Front-paged by bart
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2014-07-23 07:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (136 votes), past polls