建立UEFI編譯環境- 安裝EDK2, UDK2017, Visual studio等步驟, 且編譯出python.efi

從這裡UDK2017 How to Build原文延伸如下, 這裡拿的UDK2017是什麼呢? 而什麼又是UDK呢?

UEFI全名為Unified Extensible Firmware Interface,目前由UEFI協會管理與制定規格。UEFI推出一套稱為EDK(EFI Development Kit,而穩定發佈版稱之為UDK)開放原始碼的開發套件,裡面除了已經定義好的標準外(如C的header file),還有許多被已被開發出的標準程式模組。任何人都能夠下載它並執行其模擬環境,在Windows底下提供了NT32的模擬器,可供使用者作些簡單的開發與測試。(引用自 LeonPhoenix )

介紹 UDK

(原文)
英文為UEFI Development Kit 表示是在做UEFI開發所需要的軟體套件, 然後UDK是在EDK2當中比較穩定的release, 因為UDK的releases 會透過Intel架構平台測試! UDK2017是基於經過驗證的EDK II快照的UDK版本。 之前的穩定分支是UDK2015。

UDK和EDK2的區別

EDKII是志願者參與開發的開源項目。 此項目的提示不斷更新,以進行修復和增強。而UDK版本代表了對英特爾架構平台進行測試的EDK II源特定修訂版的完全驗證實施。 UDK版本是可用EDK II軟件包的子集,因為並非所有軟件包都可在英特爾平台上進行驗證。 每個UDK版本都在發行說明中列出了相應的EDK II版本。 每個版本都以ZIP文件形式提供,並映射到EDK II github項目的一個分支(例如:https://github.com/tianocore/edk2/tree/UDK2017,適用於UDK2017)。

怎麼編譯UDK2017呢? How to Build UDK2017

第一步: UEFI Compiler environment setup step by step

#############################################################################
# #
# UEFI Compiler environment setup step by step (tool chain UDK2017 + Microsoft VS2015 Free) #
# #
#############################################################################

1. Install Microsoft Visual Studio 2015* in the build machine and make sure that AMD64 complier was selected when installing. (Download Visual Studio 2015 Community Edition (FREE) and Installed. https://go.microsoft.com/fwlink/?LinkId=532606&clcid=0x409 )

2. Create the full Source Code directory for the UDK2017 release
Create a working space directory in the build machine, for example, C:\MyWorkspace
Download the official UDK2017 release .zip file from the UDK2017 Release Page
Download – UDK2017 edk-vUDK2017 Workspace Source code (zip file)
Extract files in [edk2-vUDK2017] to the working space directory C:\MyWorkspace.

2.1 Download UDK2017 Tool kit (Choose one) and unzip to your WORKSPACE
SVN export http://edk2.svn.sourceforge.net/svnroot/edk2/branches/UDK2017

3. Download edk2-BaseTools-win32 and unzip to your
WORKSPACE\UDK2017\BaseTools\Bin\win32
SVN export https://svn.code.sf.net/p/edk2-toolbinaries/code/trunk/Win32

4. Download NASM 2.0.7 or later from http://www.nasm.us/ and install it to C:\Nasm. Make sure C:\Nasm is added to system environment variable ‘PATH’

5. Download and install Python2.7.x https://www.python.org/ for building the BaseTools Default install directory is: C:/Python27

5.1 Download VC compiler tools (這部分我覺得只要第一步有勾選如圖. 應可省略)
https://drive.google.com/file/d/0B-pcJAXauP7WRGFTYkZGYl9aRUk/view?usp=sharing
and override to your
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin

6.Compile the BaseTools
See: https://github.com/tianocore/tianocore.github.io/wiki/Windows-systems#compile-tools

Open a Microsoft Visual Studio* command prompt, type cd C:\MyWorkspace to enter the workspace directory
Compile the BaseTools C source tools

7. Build Steps *** NT32 ***

Open a Microsoft Visual Studio* command prompt, type cd C:\MyWorkspace to enter the workspace directory
Use edksetup.bat command to initialize the working environment. edksetup –nt32
Type following command to build Nt32 platform build -t VS2015x86
Upon the build completing successfully there should be the UEFI Application “HelloWorld.efi” in the C:\MyWorkspace\Build\MdeModule\DEBUG_VS2015x86\IA32 directory

或另一方式.
Setup your EDK2 compiler

Run build in VS command line at your WORKSPACE path.

第二步: build python

由於tianocore已經在 AppPkg 下放置了 Python 2.7.2 的 code
所以就直接看 D:\MyWorkspace\AppPkg\Applications\Python\PythonReadMe.txt

1. 編輯 AppPkg/AppPkg.dsc to enable (uncomment) the PythonCore.inf line
within the [Components] section.

2. 指令:
build -a X64 -p AppPkg\AppPkg.dsc -t VS2015x86

參考資料:
Github: UDK2017 How to Build
UEFI Application – Python 2.7.2 – 醉裡挑燈看Code

Python v.s UEFI EDK2 (EDKII) 小華的部落格

發表迴響