Now, imagine if we could have python bindings for EZX toolkit...
== How to crosscompile python for arm-linux ==
I will assume you have a working toolchain for crosscompilation of arm binary
for ezx platform, if not you can use the one on
http://lsb.blogdns.net/software and you can use the patch posted here:
http://www.motorolafans.com/index.ph...wnload&id=1244 to fix an issue that can lead to a broken limits.h
My toolchain is built in this directory:
~/EZX/crosstools/ezx-crosstool-0.5/gcc-arm-iwmmxt/gcc-3.3.6-glibc-2.3.2/arm-linux
so maybe you have to replace this location appropriately in the proceeding text.
Following there is a step-by-step guido to have our beloved python interpreter
running on our phones. ("guido" is a funny typo here, he he)
NOTE: when you see a \ at the end of the line you are in front of a multiline
command, so paste the following line, too.
=== Step by step
Python official distribution does not support yet crosscompilation, so we have
to apply a patch to the source.
1. Get the official source:
wget http://www.python.org/ftp/python/2.4.3/Python-2.4.3.tgz
2. Download the patch for crosscompiling:
wget "http://sourceforge.net/tracker/download.php?group_id=5470&atid=305470&file_id=97061&aid=1006238" -O python-patch.diff
3. Extract the tarball and apply the patch:
tar xzvf Python-2.4.3.tgz
cd Python-2.4.3
cat ../python-patch.diff | patch -p3
4. Rerun autoconf, since the patch touches configure.in
autoconf configure.in > configure
5. Configure python, but being in a directory parallel to the
extracted distribution. remembering to have the toolchain binaries in the
PATH:
cd ..
mkdir crossbuild-py2.4
cd crossbuild-py2.4
PATH=$PATH:~/EZX/crosstools/ezx-crosstool-0.5/gcc-arm-iwmmxt/gcc-3.3.6-glibc-2.3.2/arm-linux/bin \
../Python-2.4.3/configure --host=arm-linux
6. Build python:
PATH=$PATH:~/EZX/crosstools/ezx-crosstool-0.5/gcc-arm-iwmmxt/gcc-3.3.6-glibc-2.3.2/arm-linux/bin \
make
7. Installing, I use /opt/python-2.4 for instance:
PATH=$PATH:~/EZX/crosstools/ezx-crosstool-0.5/gcc-arm-iwmmxt/gcc-3.3.6-glibc-2.3.2/arm-linux/bin \
make install prefix=/opt/python-2.4
8. Strip binaries so to save some space:
PATH=$PATH:~/EZX/crosstools/ezx-crosstool-0.5/gcc-arm-iwmmxt/gcc-3.3.6-glibc-2.3.2/arm-linux/bin \
find /opt/python-2.4 -name "*.so" -or -name "python" -or -type f -name "lib*" -exec arm-linux-strip {} \;
9. Copy the files in /opt/python-2.4 on the phone with your preferred method.
I use to mount the "system" share via samba so i have access directly to the
/ mount point.
10. Test that it actually works, after telnetting to the phone:
# ./python
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python 2.4.3 (#1, Apr 5 2006, 20:09:52)
[GCC 3.3.6] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.uname()
('Linux', '(none)', '2.4.20_mvlcee30-mainstone', '#1 Jan 1,2003', 'armv5tel')
>>>
That's all, for now.
=== Problems ===
- The installation size is quite big even after stripping binaries, how to build
and install a minimal python distribution?
- There are problems building the zlib module, maybe because I do not have a
crosscompiled zlib?
Now, imagine if we could have python bindings for EZX toolkit...
hi!
@dsydsy, any news on this?
wonderfl
@latino18hvm
If you're interested in a python interpreter you can try scribi. It's an interpreter collection:
LINK
screen:
![]()
Last edited by BruceLee; 08-29-2008 at 05:59 PM.
yes, thanks for the link
thanks thanks thanks