Zaurus Python Image
Background
Python is an excellent "environment" for creating Zaurus applications. With it's bindings to the Qtopia user interface (
PyQt) it's possible to greate native graphical Zaurus applications quite easily. And because there's no compilation step with Python apps, you can develop on a Windows, Linux, or Mac desktop without the hassle of setting up a cross-development environment. You can even develop directly on the Zaurus! In fact, the first version of
PyqPlayer has been developed entirely on the Zaurus.
The downside of using Python on the Zaurus is that Python is
big! We're talking 30+
MiB for a relatively complete Python installation. It is possible to chop that up into different packages and install only the minimum necessary for the app(s) you want to run (as the excellent
Python for arm-linux project has done). However, Python developers aren't used to restricting themselves to just a small set of Python functions so to support a large interactive Python application, you'll end up with most of the Python packages installed. Another problem with the Python for arm-linux stuff is that the packages compatible with a standard Sharp ROM are a bit incomplete and outdated.
To make matters worse, on a Sharp or Sharp-compatible ROM, you need to install the Python packages into internal memory or an ext2/ext3 formatted memory card for everything to work properly. Sacrificing 30+
MiB of internal memory is tough for SL-C7X0/SL-C860/SL-6000 owners and it's virtually impossible for other less memory endowed Zaurus models. And reformatting your memory card to ext2/ext3 makes it unusable in a lot of other devices.
To deal with these problems, I've come up with a a compressed "image" of a relatively complete Zaurus Python installation that you can actually use directly from a FAT formatted memory card (SD or CF)! Through the magic of Linux loop devices, you can trick the Zaurus into thinking the whole thing is installed to internal memory. Since the "image" itself contains a complete Linux ext2 filesystem, you can use it on SD or CF cards that are formatted FAT16 or FAT32. The whole Python tree will appear as just a (large) single file on your memory card.
Upgrading
The Python Zaurus Image and the Python Zaurus IPK are a matched set. Upgrading one will generally require upgrading the other. When upgrading, you must always complete the following steps in the order listed:
- Use the Add/Remove Software utility on the Zaurus to uninstall
python-exe
.
- Copy the
python24.img
or python24.ex2
file to the Zaurus.
- Use the Add/Remove Software utility on the Zaurus to install the new
python-exe
package.
See the Installation instructions below for details on performing the last two steps.
Installation
You'll need to download two packages from the
downloads page - The
Python Zaurus Image and the
Python Zaurus IPK. Once you have both packages, follow these steps:
- Install the
python24.img
or python24.ex2
file. Make sure you put the file in the correct location!
- If you're using
python24.img
you must copy it to the root directory of an SD card or to the Zaurus' "Main_Memory" (/home/zaurus/Documents). Note that the file will take up about 9 MiB of space. The file should not be installed to a CF card or hard disk!.
- If you're using
python24.ex2.gz
you must first uncompress it (turning it into python24.ex2
) then copy the uncompressed file to one of the following locations (note that the file will take up about 48 MiB of space):
- the root directory of a CF or SD card
- the Zaurus' "Main_Memory" (/home/zaurus/Documents)
- the root directory of one of the Zaurus SL-3000 hard disk partitions
- Copy the
python-exe_2.4.0-1_arm.ipk
file to any location on your Zaurus that will allow the Add/Remove Software utility to find it (CF or SD card or /home/zaurus/Documents in internal memory).
- Run the Add/Remove Software utility and use it to install
python-exe
to internal memory. Don't worry, this is not the complete Python image ... just the 1.2 MiB executable and some scripts. You must install the python-exe package to internal memory -- it will not work from SD or CF!
- When the installation is complete, exit the Add/Remove Software program and then use the Reboot application to do a full reboot of your Zaurus.
- If you wish to avoid the reboot, you can go to a shell prompt (console), log in as root (
su
), and issue the command /etc/rc.d/init.d/mntpython start
- Test your Python installation.
- Simply run
python
from a shell prompt and you should get a Python interpreter prompt.
- Enter the command
print "hello, world!"
and you should see the text "hello, world!" printed.
- Type
CTRL-D
(on non-clamshell Zaurus that's Fn-Shift-D
) to exit the Python interpreter.
Please follow the instructions above
carefully. We've tried hard to make this installation process as simple as possible, but there are still plenty of places to make mistakes.
How it Works
Coming soon.