[Python-Dev] [edk2] Official port of Python on EDK2

Christian Heimes christian at python.org
Wed Nov 1 08:46:27 EDT 2017

On 2017-11-01 10:07, Thiebaud Weksteen wrote:
> Hi,
> UEFI has become the standard for firmware (BIOS) interface. Intel has
> provided an open source implementation under the name EDK2 (part of
> the TianoCore initiative) [1] for some time. This implementation has
> evolved significantly and now provides the functionalities of a small
> OS with a standard library similar to POSIX.
> In 2011, a port of Python 2.7.1 was added to the EDK2 repository [2].
> This port then evolved to 2.7.2 which is still defined as the
> reference port [3]. In 2015, another port was added of Python 2.7.10
> in parallel of 2.7.2 [4]. Since then, both implementations have
> diverged from upstream and know vulnerabilities have not been fixed.
> I would like to bring support for edk2 in the official Python
> repository to remediate this situation, that is officially support
> edk2 as a platform. Technically, there would be three main aspects for
> the on-boarding work:
> 1) Fix headers and source to resolve definition conflicts, similarly
> to ABS definition in [5];

https://gist.github.com/tweksteen/ed516ca7ab7dfa8d18428f59d9c22a3e is a
low-hanging fruit, e.g. ABS() should be replaced with Py_ABS() from

Why did you have to replace non-ASCII chars in comments? Does your build
chain not support comments with UTF-8 chars?

> 2) Add the edk2module.c [6] to handle platform-specific
> functionalities, similarly to the posixmodule.c;

edk2module.c duplicates a lot of functionality that is also exposed by
posixmodule.c. We try to reduce duplicated code and functionality as
much as possible. IMO the edk2 module should be folded into posixmodule.c.

> 3) Add the build configuration file [7] and necessary modifications
> within Python to handle the edk2 toolchain;

Once you are able to build master for EDK2, we need to figure out how to
integrate the new build flavor into our CI and buildbot system. Is the
EDK2 build chain available for free on Linux?

> This work would target the master branch (that is Python 3). I would
> be interested in hearing your thoughts on this idea.

In general your proposal sounds like a good idea. A new platform may
require a PEP, though.

You can start now by submitting pull requests for the header fixes. Even
in the case we decide not to support EDK2, we make your life easier by
reducing the amount of extra patches.


More information about the Python-Dev mailing list