
正文
移植Python2到TQ2440
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
环境
Python:2.7.13
开发板: TQ2440
工具链: arm-none-linux-gnueabi-gcc 4.8.3
概述
前面已经把Python3移植到TQ2440上面的,现在我们移植Python2,基本跟Python3移植步骤类似。
正文
一、工具链
参考 http://www.cnblogs.com/pengdonglin137/p/6740164.html#_lab2_2_0
二、配置
下面是配置脚本mk1_conf.sh:
#!/bin/bash /home/pengdonglin/disk_ext/Python/Python2/Python-2.7./configure --prefix=`pwd` \
--host=arm-linux \
--build=x86_64-linux-gnu \
--enable-ipv6 \
--enable-shared \
ac_cv_file__dev_ptmx="yes" \
ac_cv_file__dev_ptc="no" \
LDFLAGS="-L/home/pengdonglin/disk_ext/TQ2440/rootfs/SQlite3/lib \
-L/home/pengdonglin/disk_ext/TQ2440/rootfs/Readline/lib \
-L/home/pengdonglin/disk_ext/TQ2440/rootfs/Termcap/lib \
-L/home/pengdonglin/disk_ext/TQ2440/rootfs/Zlib/lib"\
CPPFLAGS="-I/home/pengdonglin/disk_ext/TQ2440/rootfs/SQlite3/include \
-I/home/pengdonglin/disk_ext/TQ2440/rootfs/Readline/include \
-I/home/pengdonglin/disk_ext/TQ2440/rootfs/Termcap/include \
-I/home/pengdonglin/disk_ext/TQ2440/rootfs/Zlib/include"\
LDLAST="-L/home/pengdonglin/disk_ext/TQ2440/rootfs/SQlite3/lib \
-L/home/pengdonglin/disk_ext/TQ2440/rootfs/Readline/lib \
-L/home/pengdonglin/disk_ext/TQ2440/rootfs/Termcap/lib \
-L/home/pengdonglin/disk_ext/TQ2440/rootfs/Zlib/lib"
配置完成之后,修改Modules/Setup,打开readline,将下面这行取消注释:
readline readline.c -lreadline -ltermcap
修改Makefile,将:
SVNVERSION=>---svnversion $(srcdir)
修改为:
SVNVERSION=
三、编译
下面是编译脚本mk2_mk.sh
#!/bin/bash make HOSTPYTHON=/home/pengdonglin/disk_ext/Python/Python2/x86_64/python \
HOSTPGEN=/home/pengdonglin/disk_ext/Python/Python2/x86_64/Parser/pgen \
BLDSHARED="arm-linux-gcc -shared" \
CROSS_COMPILE=arm-linux- \
CROSS_COMPILE_TARGET=yes \
HOSTARCH=arm-linux \
BUILDARCH=x86_64-linux-gnu \
-j4
四、安装
下面是安装脚本mk3_install.sh
#!/bin/bash make install HOSTPYTHON=/home/pengdonglin/disk_ext/Python/Python2/x86_64/python \
BLDSHARED="arm-linux-gcc -shared" \
CROSS_COMPILE=arm-linux- \
CROSS_COMPILE_TARGET=yes \
prefix=`pwd`
五、测试
[root@tq2440 ~]# python2 /usr/lib/python2./test/test___all__.py
test_all (__main__.AllTest) ... BaseHTTPServer
Bastion
CGIHTTPServer
ConfigParser
Cookie
DocXMLRPCServer
HTMLParser
MimeWriter
... ...
ok
----------------------------------------------------------------------
Ran test in .408s
OK
完。
[root@tq2440 ~]# python2 /usr/lib/python2./test/test___all__.py
test_all (__main__.AllTest) ... BaseHTTPServer
Bastion
CGIHTTPServer
ConfigParser
Cookie
DocXMLRPCServer
HTMLParser
MimeWriter
... ...
ok
----------------------------------------------------------------------
Ran test in .408s
OK






