Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

A complete tutorial on porting arm to Python

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

The first thing we need to note is that the source files you use need to be downloaded from the Internet.

Next, let's try the process of porting arm to python.

Prepare the file:

Python-2.7.13.tgz

Sqlite-autoconf-3200100.tar.gz

Python-2.7.13-xcompile.patch.tar.gz

-

Step 1. Prepare the environment

Tar xvf Python-2.7.13.tgz

Tar xvf sqlite-autoconf-3200100.tar.gz

Mkdir python2_7_13_for_x86_32

Mkdir python2_7_13_for_arm

Mkdir INSTALL

Mkdir sqlite3

-

Step 2. Install sqlite

Cd sqlite-autoconf-3200100

. / configure-- host=arm-arago-linux-gnueabi\

-- prefix=$PWD/../sqlite3

Make

Make install

-

Step 3. Install python2_7_13_for_x86_32

Cd.. / python2_7_13_for_x86_32/

Sed-i's/self.extensions.remove (ext) / print (ext.name) / g'.. / Python-2.7.13/setup.py

.. / Python-2.7.13/configure-- prefix=pwd

Make

Make install

-

Step 4. Patch

Cd..

Tar xvf Python-2.7.13-xcompile.patch.tar.gz-C Python-2.7.13

Cd Python-2.7.13/

Patch-p1 < Python-2.7.13-xcompile.patch

-

Step 5. Configure python2_7_13_for_arm

Cd.. / python2_7_13_for_arm/

.. / Python-2.7.13/configure-- prefix=pwd\

-- host=arm-arago-linux-gnueabi\

-- build=i686-linux-gnu\

-- enable-ipv6\

-- enable-static\

Ac_cv_file__dev_ptmx= "yes"\

Ac_cv_file__dev_ptc= "no"\

LDFLAGS= "- L$PWD/../sqlite3/lib"\

CPPFLAGS= "- I$PWD/../sqlite3/include"

-

Step 6. Compile python2_7_13_for_arm

MakeHOSTPYTHON=../python2_7_13_for_x86_64/python\

HOSTPGEN=../python2_7_13_for_x86_64/Parser/pgen\

BLDSHARED= "arm-arago-linux-gnueabi-gcc-shared"\

CROSS_COMPILE=arm-arago-linux-gnueabi-\

CROSS_COMPILE_TARGET=yes\

HOSTARCH=arm-arago-linux-gnueabi\

BUILDARCH=i686-linux-gnu

-

Step 7. Install python2_7_13_for_arm

Make installHOSTPYTHON=../python2_7_13_for_x86_64/python\

BLDSHARED= "arm-arago-linux-gnueabi-gcc-shared"\

CROSS_COMPILE=arm-arago-linux-gnueabi-\

CROSS_COMPILE_TARGET=yes\

Prefix=$PWD/../INSTALL

-

Step 8. Configuration after migration to the development board

Export PATH=/INSTALL/bin:$PATH

Python python2.7-config-prefix / INSTALL

Python python2.7-config-includes/INSTALL/include/

Python python2.7-config-libs / INSTALL/lib/

-

#

-

Install easy_install tools for Python

-

Step 1. Download setuptools-0.6c11-py2.7.egg

Wget https://pypi.python.org/packages/25/5d/cc55d39ac39383dd6e04ae80501b9af3cc455be64740ad68a4e12ec81b00/setuptools-0.6c11-py2.7.egg#md5=fe1f997bc722265116870bc7919059ea

-

Step 2. Install easy_install

/ bin/sh setuptools-0.6c11-py2.7.egg

-

#

-

Modify the version of the openssl.so library

-

Step 1. Download openssl-OpenSSL_1_0_1b.zip and extract it

Tar xvf openssl-OpenSSL_1_0_1b.zip

-

Step 2,

Mkdir arm_install

CC=arm-arago-linux-gnueabi-gcc

. / Configure linux-elf no-asm--prefix=$PWD/arm_install-- openssldir=$PWD--cross-compile-prefix=arm-arago-linux-gnueabi- shared

Make

Make install

Tar cvf arm_install.tar arm_install/

Mv arm_install.tar / media/BOOT/

-

Step 3. Operate on the development board

Mv / media/mmcblk1p1/arm_install.tar /

Tar xvf arm_install.tar

Cp-r / arm_install/lib/* / usr/lib

Cp / arm_install/bin/* / usr/bin/

-

Step 4. Cancel SSL global verification and verify easy_install

Vi / INSTALL/bin/easy_install

Increase

Import ssl

Ssl._create_default_https_context = ssl._create_unverified_context

Easy_install web.py

-

Step 5. Install the pip tool

Easy_install pip

/ / SSL authentication error will be reported when using pip tool at this time, and ntp network alignment needs to be installed.

-

#

-

Porting ntp network timing (335x does not need to be ported)

Wget http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-4.2.8p10.tar.gz

Tar xvf ntp-4.2.8p10.tar.gz

Cd ntp-4.2.8p10/

Mkdir arm_install

CC=arm-arago-linux-gnueabi-gcc

. / configure-- prefix=$PWD/arm_install--host=arm-arago-linux-gnueabi-- enable-static-- with-yielding-select=yes

Make

Make install

. / ntpdate time.buptnet.edu.cn

In this way, Python is successfully ported to arm.

I realized the above on the linux based on the sail-imx6q development board, and my friends can also check it out on this development board.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report