+++ /dev/null
- EDK II Python\r
- ReadMe\r
- Version 2.7.2\r
- Release 1.02\r
- 18 Jan. 2013\r
-\r
-\r
-1. OVERVIEW\r
-===========\r
-This document is devoted to general information on building and setup of the\r
-Python environment for UEFI 2.3, the invocation of the interpreter, and things\r
-that make working with Python easier.\r
-\r
-It is assumed that you already have either UDK2010 or a current snapshot of\r
-the EDK II sources from www.tianocore.org, and that you can successfully build\r
-packages within that distribution.\r
-\r
-2. Release Notes\r
-================\r
- 1) All C extension modules must be statically linked (built in)\r
- 2) The site and os modules must exist as discrete files in ...\lib\python.27\r
- 3) User-specific configurations are not supported.\r
- 4) Environment variables are not supported.\r
-\r
-3. Getting and Building Python\r
-======================================================\r
- 3.1 Getting Python\r
- ==================\r
- For development ease, a subset of the Python 2.7.2 distribution has been\r
- included in the AppPkg source tree. If a full distribution is desired, the\r
- Python-2.7.2 directory can be removed or renamed and the full source code\r
- downloaded from http://www.python.org/ftp/python/2.7.2/.\r
-\r
- A. Within your EDK II development tree, extract the Python distribution into\r
- AppPkg/Applications/Python. This should create the\r
- AppPkg/Applications/Python/Python-2.7.2 directory.\r
-\r
- B. Copy the files from PyMod-2.7.2 into the corresponding directories within\r
- the Python-2.7.2 tree. This will overwrite existing files with files\r
- modified for UEFI usage.\r
-\r
- 3.2 Building Python\r
- ===================\r
- A. Edit Efi/config.c to enable the built-in modules you need.\r
- Mandatory Built-in Modules:\r
- edk2 errno imp marshal\r
-\r
- Additional built-in modules which are required to use the help()\r
- functionality provided by PyDoc, are:\r
- _codecs _collections _functools _random\r
- _sre _struct _weakref binascii\r
- cStringIO gc itertools math\r
- operator time\r
-\r
- B. Edit AppPkg/AppPkg.dsc to enable (uncomment) the PythonCore.inf line\r
- within the [Components] section.\r
-\r
- C. Build AppPkg, which includes Python, using the standard "build" command:\r
- For example, to build Python for an X64 CPU architecture:\r
- build -a X64 -p AppPkg\AppPkg.dsc\r
-\r
-4. Python-related paths and files\r
-=================================\r
-Python depends upon the existence of several directories and files on the\r
-target system.\r
-\r
- \EFI Root of the UEFI system area.\r
- |- \Tools Location of the Python.efi executable.\r
- |- \Boot UEFI specified Boot directory.\r
- |- \StdLib Root of the Standard Libraries sub-tree.\r
- |- \etc Configuration files used by libraries.\r
- |- \tmp Temporary files created by tmpfile(), etc.\r
- |- \lib Root of the libraries tree.\r
- |- \python.27 Directory containing the Python library\r
- | modules.\r
- |- \lib-dynload Dynamically loadable Python extensions.\r
- |- \site-packages Site-specific packages and modules.\r
-\r
-\r
-5. Installing Python\r
-====================\r
-These directories, on the target system, are populated from the development\r
-system as follows:\r
-\r
- * \Efi\Tools receives a copy of Build/AppPkg/DEBUG_VS2005/X64/Python.efi.\r
- ^^^^^ ^^^^^^^^^^\r
- Modify the host path to match the your build type and compiler.\r
-\r
- * The \Efi\StdLib\etc directory is populated from the StdLib/Efi/StdLib/etc\r
- source directory.\r
-\r
- * Directory \Efi\StdLib\lib\python.27 is populated with packages and modules\r
- from the AppPkg/Applications/Python/Python-2.7.2/Lib directory.\r
- The recommended minimum set of modules (.py, .pyc, and/or .pyo):\r
- os stat ntpath warnings traceback\r
- site types copy_reg linecache genericpath\r
-\r
- * Python C Extension Modules built as dynamically loadable extensions go into\r
- the \Efi\StdLib\lib\python.27\lib-dynload directory. This functionality is\r
- not yet implemented.\r
-\r
-\r
-6. Example: Enabling socket support\r
-===================================\r
- 1. enable {"_socket", init_socket}, in Efi\config.c\r
- 2. enable Python-2.7.2/Modules/socketmodule.c in PythonCore.inf.\r
- 3. copy socket.py over to /Efi/StdLib/lib/python.27 on your target system.\r
- 4. Make sure dependent modules are present(.py) or built in(.c):\r
- functools, types, os, sys, warnings, cStringIO, StringIO, errno\r
-\r
- 5. build -a X64 -p AppPkg\AppPkg.dsc\r
- 6. copy Build\AppPkg\DEBUG_VS2005\X64\Python.efi to \Efi\Tools on your\r
- target system. Replace "DEBUG_VS2005\X64", in the source path, with\r
- values appropriate for your tool chain and processor architecture.\r
-\r
-\r
-7. Running Python\r
-=================\r
- Python must currently be run from an EFI FAT-32 partition, or volume, under\r
- the UEFI Shell. At the Shell prompt enter the desired volume name, followed\r
- by a colon ':', then press Enter. Python can then be executed by typing its\r
- name, followed by any desired options and arguments.\r
-\r
- EXAMPLE:\r
- 2.0 Shell> fs0:\r
- 2.0 FS0:\> python\r
- Python 2.7.2 (default, Oct 13 2015, 16:21:53) [C] on uefi\r
- Type "help", "copyright", "credits" or "license" for more information.\r
- >>> exit()\r
- 2.0 FS0:\>\r
-\r
- NOTE:\r
- Python, as distributed, sends its interactive prompts to stderr. If\r
- STDERR isn't enabled in UEFI Setup so that it's output goes to the\r
- console, it may appear that Python hangs on startup. If this happens,\r
- one may be able to rectify the condition by typing "exit()" followed\r
- by <enter> to exit out of Python. Then, type "exit" at the Shell prompt\r
- which should enter Setup where you can use the Boot Maintenance\r
- Manager to modify your Console settings.\r
-\r
- NOTE:\r
- Some platforms don't include the Setup utility, or don't allow STDERR to\r
- be modified. In these cases, Python may be started with the '-#' option\r
- which will cause stderr to be the same as stdout and should allow\r
- Python to be used interactively on those platforms.\r
-\r
- Depending upon the version of Shell you are using, it may be necessary\r
- to escape the '#' character so that the Shell doesn't interpret it as\r
- the start of a comment. The escape character is '^'.\r
- Example:\r
- python -^# -V\r
-\r
-8. Supported C Modules\r
-======================\r
- Module Name C File(s)\r
- =============== =============================================\r
- _ast Python/Python-ast.c\r
- _bisect Modules/_bisectmodule.c\r
- _codecs Modules/_codecsmodule.c\r
- _codecs_cn Modules/cjkcodecs/_codecs_cn.c\r
- _codecs_hk Modules/cjkcodecs/_codecs_hk.c\r
- _codecs_iso2022 Modules/cjkcodecs/_codecs_iso2022.c\r
- _codecs_jp Modules/cjkcodecs/_codecs_jp\r
- _codecs_kr Modules/cjkcodecs/_codecs_kr\r
- _codecs_tw Modules/cjkcodecs/_codecs_tw\r
- _collections Modules/_collectionsmodule.c\r
- _csv Modules/_csv.c\r
- _functools Modules/_functoolsmodule.c\r
- _heapq Modules/_heapqmodule.c\r
- _io Modules/_io/_iomodule.c Modules/_io/*\r
- _json Modules/_json.c\r
- _md5 Modules/md5module.c Modules/md5.c\r
- _multibytecodec Modules/cjkcodecs/_multibytecodec.c\r
- _random Modules/_randommodule.c\r
- _sha Modules/shamodule.c\r
- _sha256 Modules/sha256module.c\r
- _sha512 Modules/sha512module.c\r
- _socket Modules/socketmodule.c\r
- _sre Modules/_sre.c\r
- _struct Modules/_struct.c\r
- _symtable Modules/symtablemodule.c\r
- _weakref Modules/_weakref.c\r
- array Modules/arraymodule.c\r
- binascii Modules/binascii.c\r
- cmath Modules/cmathmodule.c\r
- cPickle Modules/cPickle.c\r
- cStringIO Modules/cStringIO.c\r
- datetime Modules/datetimemodule.c\r
- edk2 Modules/Efi/edk2module.c\r
- errno Modules/errnomodule.c\r
- future_builtins Modules/future_builtins.c\r
- gc Modules/gcmodule.c\r
- imp Python/import.c\r
- itertools Modules/itertoolsmodule.c\r
- marshal Python/marshal.c\r
- math Modules/mathmodule.c Modules/_math.c\r
- operator Modules/operator.c\r
- parser Modules/parsermodule.c\r
- select Modules/selectmodule.c\r
- signal Modules/signalmodule.c\r
- strop Modules/stropmodule.c\r
- time Modules/timemodule.c\r
- xxsubtype Modules/xxsubtype.c\r
- zipimport Modules/zipimport.c\r
- zlib Modules/zlibmodule.c Modules/zlib/*\r
-\r
-\r
-9. Tested Python Library Modules\r
-================================\r
-This is a partial list of the packages and modules of the Python Standard\r
-Library that have been tested or used in some manner.\r
-\r
- encodings genericpath.py sha.py\r
- importlib getopt.py SimpleHTTPServer.py\r
- json hashlib.py site.py\r
- pydoc_data heapq.py socket.py\r
- xml HTMLParser.py SocketServer.py\r
- abc.py inspect.py sre.py\r
- argparse.py io.py sre_compile.py\r
- ast.py keyword.py sre_constants.py\r
- atexit.py linecache.py sre_parse.py\r
- BaseHTTPServer.py locale.py stat.py\r
- binhex.py md5.py string.py\r
- bisect.py modulefinder.py StringIO.py\r
- calendar.py ntpath.py struct.py\r
- cmd.py numbers.py textwrap.py\r
- codecs.py optparse.py token.py\r
- collections.py os.py tokenize.py\r
- copy.py platform.py traceback.py\r
- copy_reg.py posixpath.py types.py\r
- csv.py pydoc.py warnings.py\r
- dummy_thread.py random.py weakref.py\r
- fileinput.py re.py xmllib.py\r
- formatter.py repr.py zipfile.py\r
- functools.py runpy.py expat\r
-\r
-# # #\r