Cross-compilation of the Xiaomi router mini python (MIPS)

Source: Internet
Author: User

Read a lot of articles, or said to use opkg to install Python, or to say that the millet router cross-compiling, there is no mini. Learned this article (http://me.deepgully.com/post/5638916786880512), compiled the Xiaomi Route mini Python.

Compiled: http://download.csdn.net/detail/kowity/9611919

Xiaomi routing mini version of the route is MIPS, and Millet routing arm version is not the same, so the script made some changes. First download the Xiaomi router mini version of the development package, there is a compilation tool chain: Http://bigota.miwifi.com/xiaoqiang/sdk/tools/package/sdk_package_r1c.zip. Copy the toolchain inside the compressed package to the/opt/xiaomi

Compile the dependent libraries first

[Plain]View PlainCopy 
  1. #!/bin/bash
  2. # Rm-r-f/opt/xiaomi
  3. # wget-c Http://bigota.miwifi.com/xiaoqiang/sdk/tools/package/sdk_package_r1c.zip
  4. # Unzip Sdk_package_r1c.zip
  5. # cp-r-F sdk_package_r1c/include/* sdk_package_r1c/toolchain/include/
  6. # cp-r-F sdk_package_r1c/lib/* sdk_package_r1c/toolchain/lib/
  7. # mv-f Sdk_package_r1c/toolchain/opt/xiaomi
  8. Export Xiaomi_root_path=/opt/xiaomi
  9. Export path= "${xiaomi_root_path}/bin:${path}"
  10. Rm-r-F readline-4.2
  11. Wget-c http://ftp.gnu.org/gnu/readline/readline-4.2.tar.gz
  12. Tar xvzf readline-4.2.tar.gz
  13. CD readline-4.2
  14. Export CC=MIPSEL-OPENWRT-LINUX-UCLIBC-GCC ranlib=mipsel-openwrt-linux-uclibc-ranlib AR= Mipsel-openwrt-linux-uclibc-ar
  15. ./configure--host=mipsel-openwrt-linux-uclibc--build=mipsel-linux--prefix=${xiaomi_root_path}
  16. Make
  17. sudo make install
  18. Mipsel-openwrt-linux-uclibc-ranlib ${xiaomi_root_path}/lib/libreadline.a
  19. Cd..
  20. Rm-r-F libffi-3.1
  21. Wget-c ftp://sourceware.org/pub/libffi/libffi-3.1.tar.gz
  22. Tar xvzf libffi-3.1.tar.gz
  23. CD libffi-3.1
  24. ./configure--host=mipsel-openwrt-linux-uclibc--build=mipsel-linux--prefix=${xiaomi_root_path}
  25. Make
  26. sudo make install
  27. Mipsel-openwrt-linux-uclibc-ranlib ${XIAOMI_ROOT_PATH}/LIB/LIBFFI.A
  28. Cd..
  29. Rm-r-F termcap-1.3.1
  30. Wget-c http://www.mirrorservice.org/sites/ftp.gnu.org/gnu/termcap/termcap-1.3.1.tar.gz
  31. Tar xvzf termcap-1.3.1.tar.gz
  32. CD termcap-1.3.1
  33. Export CC=MIPSEL-OPENWRT-LINUX-UCLIBC-GCC ranlib=mipsel-openwrt-linux-uclibc-ranlib AR= Mipsel-openwrt-linux-uclibc-ar
  34. ./configure--host=mipsel-openwrt-linux-uclibc--build=mipsel-linux--prefix=${xiaomi_root_path}
  35. Make
  36. sudo make install
  37. Mipsel-openwrt-linux-uclibc-ranlib ${xiaomi_root_path}/lib/libtermcap.a
  38. Cd..





Compile Python again

[Plain]View PlainCopy 
  1. #!/bin/bash
  2. Wget-c http://www.python.org/ftp/python/2.7.5/Python-2.7.5.tar.bz2
  3. Rm-r-F Python
  4. mkdir python
  5. CD python
  6. Cp.. /python-2.7.5.tar.bz2.
  7. TAR-JXF python-2.7.5.tar.bz2
  8. Wget-c Http://bugs.python.org/file31991/Python-2.7.5-xcompile.patch
  9. CP Python-2.7.5-xcompile.patch PYTHON-2.7.5/
  10. Wget-c Http://7xrt07.com1.z0.glb.clouddn.com/setup.py.2.5.xcompile.patch
  11. CP Setup.py.xcompile.patch PYTHON-2.7.5/
  12. mkdir Backup
  13. CD Python-2.7.5
  14. Make Distclean
  15. RM-RF Python_for_build Parser/pgen_for_build
  16. CP Makefile.pre.in. /backup/
  17. CP Modules/setup.dist. /backup/modules/
  18. CP Configure. /backup/
  19. CP setup.py. /backup/
  20. Unset CC
  21. Unset CXX
  22. ./configure
  23. Make--jobs=2 python Parser/pgen
  24. MV Python Python_for_build
  25. MV Parser/pgen Parser/pgen_for_build
  26. CP Python_for_build. /backup/
  27. CP Parser/pgen_for_build. /backup/
  28. Patch-p3 < Python-2.7.5-xcompile.patch
  29. Patch < Setup.py.xcompile.patch
  30. Make Distclean
  31. Rfs=/opt/xiaomi
  32. Export path= "${rfs}/lib:${rfs}/usr/lib:${path}"
  33. Export ldflags= "-l${rfs}/usr/lib-l${rfs}/lib"
  34. ./configure--HOST=MIPSEL-OPENWRT-LINUX-UCLIBC--build=mipsel-linux--prefix=/\
  35. --disable-ipv6 Ac_cv_file__dev_ptmx=no Ac_cv_file__dev_ptc=no Ac_cv_have_long_long_format=yes
  36. If [$?! = 0]; Then
  37. echo "(E) Configure failed!"
  38. Exit 5
  39. Fi
  40. Make--jobs=2 \
  41. cflags= "-g0-os-s-i${rfs}/include-i${rfs}/usr/include-l${rfs}/usr/lib-l${rfs}/lib-fdata-sections- Ffunction-sections "\
  42. Ldflags= "-l${rfs}/usr/lib-l${rfs}/lib"
  43. If [$?! = 0]; Then
  44. echo "(E) Make failed!"
  45. Exit 5
  46. Fi
  47. Mipsel-openwrt-linux-strip--strip-unneeded python
  48. echo "(I) Installing Python ..."
  49. sudo make install Destdir=${rfs}/python path= "${path}"
  50. If [$?! = 0]; Then
  51. echo "(E) installation failed!"
  52. Exit 5
  53. Fi
  54. Rm-r-F ${rfs}/python/lib/python2.7/test
  55. Rm-r-F ${rfs}/python/lib/python2.7/unitest
  56. Rm-r-F ${RFS}/PYTHON/LIB/PYTHON2.7/LIB-TK
  57. Rm-r-F ${rfs}/python/lib/python2.7/idlelib
  58. Rm-r-F ${rfs}/python/lib/python2.7/2to3
  59. echo "(I) Python cross-compilation and installation is done!"
  60. Exit 0

Copy the generated Python directory to the Xiaomi router and it's OK.

http://blog.csdn.net/kowity/article/details/52302849

Cross-compilation of the Xiaomi router mini python (MIPS)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.