|
| 1 | +Python for Windows ARM32 |
| 2 | +================================= |
| 3 | +.. contents:: |
| 4 | + |
| 5 | +Prerequisites |
| 6 | +------------- |
| 7 | + |
| 8 | +- `Microsoft Visual Studio 2017 <https://visualstudio.microsoft.com/downloads/>`_ (tested with version 15.9.4) |
| 9 | +- `Git for Windows <https://git-scm.com/downloads>`_ |
| 10 | +- Perl 5 (for OpenSSL Configure) |
| 11 | +- `CPython 3.5 or newer (add Python to the path) <https://www.python.org/>`_ |
| 12 | + |
| 13 | +Get the CPython on Windows ARM32 code |
| 14 | +------------ |
| 15 | + |
| 16 | +Check out the Windows ARM32 code for CPython and populate the external dependencies:: |
| 17 | + |
| 18 | + git clone https://github.com/ms-iot/cpython.git |
| 19 | + cd cpython |
| 20 | + git checkout win-arm32-master |
| 21 | + .\PCbuild\get_externals.bat |
| 22 | + |
| 23 | +Get OpenSSL for Windows ARM32 |
| 24 | +----------------------------- |
| 25 | + |
| 26 | +Build OpenSSL binaries for Windows ARM32:: |
| 27 | + |
| 28 | + cd .. |
| 29 | + git clone https://github.com/openssl/openssl.git |
| 30 | + cd openssl |
| 31 | + git checkout -b win-arm32 OpenSSL_1_1_0i |
| 32 | + |
| 33 | +Start a build environment with vcvarsamd64_arm.bat and apply required patch:: |
| 34 | + |
| 35 | + cmd /k "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsamd64_arm.bat" |
| 36 | + |
| 37 | + REM apply patch required for successful ARM32 build |
| 38 | + git am < ..\cpython\tools\winiot\OpenSSL-for-Windows-ARM32.patch |
| 39 | + |
| 40 | + |
| 41 | +When running ``perl Configure`` ignore this error:: |
| 42 | + |
| 43 | + It looks like you don't have either nmake.exe or dmake.exe on your PATH, |
| 44 | + so you will not be able to execute the commands from a Makefile. You can |
| 45 | + install dmake.exe with the Perl Package Manager by running: |
| 46 | + ppm install dmake |
| 47 | + |
| 48 | +| Configure the OpenSSL makefile for Windows ARM32 |
| 49 | +Run ``nmake`` to build OpenSSL:: |
| 50 | + |
| 51 | + perl Configure VC-WIN32 no-asm |
| 52 | + nmake |
| 53 | + |
| 54 | +Exit cmd.exe started with ``cmd /k`` above:: |
| 55 | + |
| 56 | + exit |
| 57 | + |
| 58 | +Copy OpenSSL files for Windows ARM32 to cpython externals:: |
| 59 | + |
| 60 | + md ..\cpython\externals\openssl-bin-1.1.0i\arm32\include\openssl |
| 61 | + copy LICENSE ..\cpython\externals\openssl-bin-1.1.0i\arm32 |
| 62 | + copy include\openssl\*.h ..\cpython\externals\openssl-bin-1.1.0i\arm32\include\openssl |
| 63 | + copy ms\applink.c ..\cpython\externals\openssl-bin-1.1.0i\arm32\include |
| 64 | + copy *.lib ..\cpython\externals\openssl-bin-1.1.0i\arm32 |
| 65 | + copy libcrypto-1_1.dll ..\cpython\externals\openssl-bin-1.1.0i\arm32 |
| 66 | + copy libcrypto-1_1.pdb ..\cpython\externals\openssl-bin-1.1.0i\arm32 |
| 67 | + copy libssl-1_1.dll ..\cpython\externals\openssl-bin-1.1.0i\arm32 |
| 68 | + copy libssl-1_1.pdb ..\cpython\externals\openssl-bin-1.1.0i\arm32 |
| 69 | + |
| 70 | +Return to the Python clone root:: |
| 71 | + |
| 72 | + cd ..\cpython |
| 73 | + |
| 74 | +Build CPython and stage files for xcopy install |
| 75 | +----------------------------------------------- |
| 76 | + |
| 77 | +Building using Tools\winiot\build.bat requires CPython 3.5 or greater to be on the path. |
| 78 | + |
| 79 | +To build a retail image:: |
| 80 | + |
| 81 | + Tools\winiot\build.bat -arm -r -c |
| 82 | + |
| 83 | +To build a debug image with test files:: |
| 84 | + |
| 85 | + Tools\winiot\build.bat -arm -r -c -d -t |
| 86 | + |
| 87 | +Copy debug files to Windows IoT Core device and run tests |
| 88 | +--------------------------------------------------------- |
| 89 | + |
| 90 | +Map a drive and copy the files:: |
| 91 | + |
| 92 | + net use Q: \\<device ip address>\c$ /user:\administrator |
| 93 | + robocopy /S PCbuild\iot\arm32\Debug\ Q:\pythond |
| 94 | + |
| 95 | +Connect via `ssh <https://docs.microsoft.com/en-us/windows/iot-core/connect-your-device/ssh>`_ and run the standard library tests:: |
| 96 | + |
| 97 | + ssh administrator@<device ip> |
| 98 | + |
| 99 | + set PATH=%PATH%;c:\pythond;c:\pythond\scripts |
| 100 | + set PYTHONHOME=c:\pythond |
| 101 | + |
| 102 | + REM fix case of TEMP directory variable for tests |
| 103 | + set TEMP=C:\Windows\Temp |
| 104 | + |
| 105 | + REM Run tests |
| 106 | + python_d -m test -j3 |
| 107 | + |
| 108 | + REM Run ssl tests with network resources enabled |
| 109 | + python_d -Werror -bb -m test -u urlfetch -u network -v test_ssl |
| 110 | + |
| 111 | +Copy release files to device |
| 112 | +---------------------------- |
| 113 | + |
| 114 | +Map a drive and copy the files:: |
| 115 | + |
| 116 | + net use Q: \\<device ip address>\c$ /user:administrator |
| 117 | + robocopy /S PCbuild\iot\arm32\Release\ Q:\python |
| 118 | + |
| 119 | +Connect via `ssh <https://docs.microsoft.com/en-us/windows/iot-core/connect-your-device/ssh>`_ and test install:: |
| 120 | + |
| 121 | + ssh administrator@<device ip> |
| 122 | + |
| 123 | + set PATH=%PATH%;c:\python;c:\python\scripts |
| 124 | + set PYTHONHOME=c:\python |
| 125 | + |
| 126 | + python -c "print ('Hello, ARM32!')" |
| 127 | + |
| 128 | +Installing pip |
| 129 | +-------------- |
| 130 | + |
| 131 | +To install pip run the ensurepip module and then check for upgrades:: |
| 132 | + |
| 133 | + python -m ensurepip |
| 134 | + python -m pip install --upgrade pip |
0 commit comments