Windows systems - Wayne777Chiu/Chinese_Practice_about_TianoCore GitHub Wiki
(2019/03/08)
本頁提供單步指示來建立一個在 Windows 系統上的 EDK II 建置環境。
內容表格
- GitHub Help
- 如何建置 EDK II 樹
- 下載 從 Github 去 checkout EDK II 源碼樹
- 編譯工具 建置 Windows 上的 EDK II BaseTools (基礎工具)
- 建置 EDK II
GitHub (https://help.github.com/index.html) 提供了使用者註冊和 GitHub 支援的基本功能的單步指示。
- 給 Windows 系統 的 Git 可在此找到: (http://git-scm.com/download/win)
- 給 Windows 系統 的 TortoiseGit 可在此找到 (https://tortoisegit.org/download/)
- EDK II 專案倉儲可被找到於 https://github.com/tianocore/edk2 。
注意:以下步驟將從 edk2 master 分支拉取最新的的源碼。 要在穩定發行版下作業,請參考 UDK2017 Microsoft Windows 建置步驟: 如何建置 UDK2017 在 Windows 系統
假如你的區域網路使用一個有網路代理的防火牆,那麼你可能需要去設定代理伺服資訊給各種的命令列應用程式去作業。 你能需要諮詢你的區域網路管理者去為代理伺服器的設定找出電腦名稱和連接埠來使用。以下是一般 Git Bash 如何藉著設定環境變數來設定你的代理伺服器組態組態的例子:
$git config --global https.proxy <proxyname>.domain.com:<port> $git config --global thhp.proxy <proxyname>.domain.com:<port>
注意: 以下的一些例子使用了多重工作區 (Multiple Workspace) 功能區去組態 EDK II BaseTools (基礎工具)。 更多資訊關於多重工作區功能能透過以下路徑。
下載/查驗 EDK II 源碼樹透過 Github
- 下載 EDK II 專案
- 在瀏覽器上開啟網址 https://github.com/tianocore/edk2
- 點擊 Clone or Download 按紐 (右邊 綠色)
- 點擊 Download ZIP
- 解壓縮到 C 槽
- 更改 “edk2-master” 目錄名稱成 “edk2”
- 克隆 EDK II 專案倉儲
- 開啟 Git GUI
- 使用 Clone Exiting Repository 利用源碼所在 https://github.com/tianocore/edk2.git
- 選擇目標路徑到 C:/edk2
- 勾選 Recursively clone submodules too (也遞迴性克隆子模組)
- 點擊 Clone 按鈕
假如你使用的是命令列版本,那麼你能容易地用以下 git 命令去查找 (checkout) edk2 到 C:\edk2 目錄: 主要倉儲: https://github.com/tianocore/edk2
$git clone https://github.com/tianocore/edk2
- 創造一個工作區目錄
- 切換工作區目錄
- 克隆 EDK II 專案倉儲 (參見其上方的 下載 章節)
- 例子: git clone https://github.com/tianocore/edk2
- 安裝 Python37 或之後板本 (https://www.python.org/) 來運行從源碼來的 python 工具
- 編譯 基礎工具 C 源碼工具
- Inside Bit Bash
$ git clone https://github.com/tianocore/edk2
例如:
- 開啟命令提示視窗和 進入(CD) C:\edk2
C:\edk2> set PYTHON_HOME=C:\Python27 C:\edk2> edksetup.bat Rebuild
C:\\Users\MySid> CD \edk2 C:\edk2> edksetup
你將需要編輯 Conf\target.txt 檔。 首先, 改變 ACTIVE_PLATFORM 成 MdeModulePkg:
C:\edk2> notepad Conf\target.txt
ACTIVE_PLATFORM 在 Conf\target.txt (檔案裡)應該像這樣:
ACTIVE_PLATFORM = MdeModulePkg/MdeModulePkg.dsc
在 target.txt 裡,修改 TOOL_CHAIN_TAG 成在你系統裡的安裝好的(那個)工具鏈。 有很多選項,因此檢視 tools_def.txt 去找出你系統裡適當的工具鏈。 在 tools_def.txt 檔裡搜尋 'Supported Tool Chains' 去看可用的選項給 TOOL_CHAIN_TAG。
TOOL_CHAIN_TAG = VS2015x86
也可參照: Windows-systems-ToolChain-Matrix 看如何改變工具鏈標籤屬性 (Tool Chain Tag)。
當然,也可以藉由改變 在target.txt 檔裡的 TARGET_ARCH 的值來審思是否你要建構其他處理器架構。 請認知某些工具鏈只支援建構某些處理器架構。
現在你應該能夠簡單運行建置命令來編譯 MdeModulePkg。
C:\edk2> build
當建置的明確結果出來,你應該會有一個 HelloWorld UEFI 應用程式。 假如你有一個 UEFI 系統符合你所建置的處理器架構,那麼這應用程式應該能夠正確地運行在 shell 下。
C:\edk2> dir /s Build\MdeModule\DEBUG_...\IA32\HelloWorld.efi
建置 OVMF (選項)
一旦你的建置環境被設定成功,你可能會有興趣去建置 OVMF 平台,這已包含在主 edk2 源碼樹中。 利用 OVMF 建置一個完整系統韌體映像檔,這對 UEFI 系統韌體開發者而言是有趣的。
This page provides step-by-step instructions or setting up a EDK II build environment on Windows systems.
Table of Contents
- GitHub Help
- How to Setup the EDK II Tree
- Download Checkout EDK II source tree from Github
- Compile Tools Build EDK II BaseTools for Windows
- BUILD EDK II
GitHub (https://help.github.com/index.html) provides step-by-step instructions for user registration and basic features supported by GitHub.
- Git for Windows OS is available at: (http://git-scm.com/download/win)
- TortoiseGit for windows OS is available at (https://tortoisegit.org/download/)
- The EDK II project repository is available at https://github.com/tianocore/edk2.
Note: the steps below will pull the latest code from edk2 master. To work from a stable release, please refer to the Microsoft Windows build steps for UDK2017: https://github.com/tianocore/tianocore.github.io/wiki/UDK2017-How-to-Build#how-to-build-windows-system
If your network utilizes a firewall with a web proxy, then you may need to configure your proxy information for various command line applications to work. You may need to consult with your network administrator to find out the computer name and port to use for proxy setup. The following commands are common Git Bash examples of how you would configure your proxy by setting an environment variable:
$ git config --global https.proxy <proxyname>.domain.com:<port> $ git config --global http.proxy <proxyname>.domain.com:<port>
Note: Some of the following examples use the Multiple Workspace feature to configure the EDK II BaseTools. More information on the Multiple Workspace feature can be found at the following location.
Download/Checkout the EDK II source tree from Github
- Download EDK II Project
- Open https://github.com/tianocore/edk2 in web browser
- Click on the Clone or Download button (Right Green)
- Click on Download ZIP
- Unzip to C:/
- Rename directory “edk2-master” to “edk2”
- Clone the EDK II project repository
- Open Git GUI
- Use Clone Exiting Repository with Source location https://github.com/tianocore/edk2.git
- Select a Target directory C:/edk2
- Check Recursively clone submodules too
- click Clone button
If you use the command line version, then you can easily checkout the edk2 to the C:\edk2 directory with the following git command: Main repository: https://github.com/tianocore/edk2
$git clone https://github.com/tianocore/edk2
Continue to Compile Tools and then BUILD sections
- Create a workspace directory
- Change to the workspace directory
- Clone the EDK II project repository (See Download section above)
- Example: git clone https://github.com/tianocore/edk2
- Install Python37 or late version (https://www.python.org/) to run python tool from source
- Compile BaseTools C source tools
- Inside Git Bash
$ git clone https://github.com/tianocore/edk2
Example:
- Open Command prompt and CD C:\edk2:
C:\edk2> set PYTHON_HOME=C:\Python27 C:\edk2> edksetup.bat Rebuild
- Set up the Nasm open source assembly compiler
- Set up the ASL Compiler
- Compile Tools above
- Open a Windows CMD prompt:
- Change to the edk2 directory
- Run the edksetup.bat script
C:\Users\MySid> CD \edk2 C:\edk2> edksetup
You will need to edit the Conf\target.txt file. First, change the ACTIVE_PLATFORM to the MdeModulePkg:
C:\edk2> notepad Conf\target.txt
ACTIVE_PLATFORM should look like this in Conf\target.txt:
ACTIVE_PLATFORM = MdeModulePkg/MdeModulePkg.dsc
Modify TOOL_CHAIN_TAG in target.txt for the toolchain installed on your system. There are many options, so review the tools_def.txt to find the appropriate toolchain for your system. Search for 'Supported Tool Chains' in tools_def.txt to see the valid options for TOOL_CHAIN_TAG.
TOOL_CHAIN_TAG = VS2015x86
See also: Windows-systems-ToolChain-Matrix for how to change the Tool Chain Tag.
Also, consider if you want to build a different processor architecture by changing the TARGET_ARCH value in target.txt. Please consider that certain toolchains only support building certain processor architectures.
Now you should be able to simply run the build command to compile the MdeModulePkg.
C:\edk2> build
As a tangible result of the build, you should have the HelloWorld UEFI application. If you have a UEFI system available to you which matches the processor architecture that you built, then this application should be able to run successfully under the shell.
C:\edk2> dir /s Build\MdeModule\DEBUG_...\IA32\HelloWorld.efi
Build OVMF (OPTIONAL)
Once your build environment is set up you might be interested in building the OVMF platform which is included in the main edk2 source tree. Since OVMF builds a full system firmware image this may be of interest to UEFI system firmware developers.