Using EDK II with Native GCC - Wayne777Chiu/Chinese_Practice_about_TianoCore GitHub Wiki
(2019/03/08)
本頁提供 單步指示 給使用原生 GCC (4.4+) 安裝的 Linux 來建置 EDK II 開發環境。 這個 EDK II 建置不需要 Mingw 版本的 GCC, 因此可以更快速的建置。
這些指示將會是寫成一系列透過命令終端機 (command terminal) 的執行命令。 通常這些指示將包含一個需要透過終端機視窗來執行的命令。 例如:
bash$ echo this text is a sample command
執行(上述)在你的網頁瀏覽器上被強調的命令內容。 (注意 'bash$' 並不是命令的一部分!) 大部分的網頁瀏覽器都能夠藉由編輯選單(Edit menu)下的拷貝選項來複製(指令)內容。 現在切換回(change back)終端機應用程式,應該有一個貼上 (Paste) 的操作在編輯選單上。 在貼上命令到這個使用者使用介面 (shell) (殼層) 之後,你可以按壓 enter 或 return 鍵去執行該命令。
當然,有其他方式去複製和貼上這個指令來進入終端,具體取決於你的視窗環境和所使用的應用程式。 然而假使其他方式都失敗,你可以親手鍵入這個指令。
一些指令是非常長,我們使用反斜線 (backslash) 字元來告訴使用者介面層殼程式命令沒有被結束。 例如:
bash$ echo this bold text is a sample command \ which is broken into two lines
當你使用複製貼上時,確認你包含命令的所有行(包含反斜線字元)。 當你正鍵入命令,想要的話,你能移除反斜線字元,並合併到單一行。
假如一個命令開始時伴隨著 sudo 命令,你可能會被提示一個使用者密碼。而這個密碼是跟你登入到系統使用的一樣。
為了集中指示的目的,我們將使用以下的路徑
Edk2 來源樹: | $HOME/src/edk2 |
原生(Native) GCC 4.x compiler installation: | /usr/bin/gcc |
Intel ASL Compiler installation: | /usr/bin/iasl |
你將需要改變命令,假如你會使用不同的位置,但除非你確定知道做甚麼否則不建議。
假如你的網絡裡用了有網路代理的防火牆,那你可能需要設定你的代理資訊組態給每個命令行應用程式來使其生效。你可能需要諮詢你的網路管理員去找出提供給代理設定的電腦名稱和網路埠 (port)。以下命令是很尋常的例子關於如何藉著環境變數 (environment variable) 來設定你的代理組態:
bash$ export http_proxy=http://proxy.domain.com:proxy_port bash$ export ftp_proxy=$http_proxy
在有網路代理的網路防火牆下利用 SVN 版本控制系統 (subversion source) 控制指令,你應該在 ~/.subversion/servers 檔案上設定組態。
注意: 這些指令利用了 GCC5 & NASM 編譯器的支援(增加於2016早期),連同 git (替換了 subversion)。 GCC 4.x 仍被支援。 GCC5 並非是強制性(要求)。
這些指示將透過 GNOME 終端程式來使用 Ubuntu 建置的命令殼層 (bash)。 要開啟這終端程式,在應用程式選單(Application menu)和附屬子選單(Accessories sub-menu)下找尋(locate)(它)。
幾個Ubutntu套件(包)將被需要去設置 EDK II 的建置環境。 接下來的命令將安裝所有需要的套件(包):
bash$ sudo apt-get install build-essential uuid-dev iasl git gcc-5 nasm python3-distutils
- build-essential - build-essential (建置必要性)的資訊列表的套件(包)
- uuid-dev - 全域唯一識別碼 (UUID) 函式庫 (標頭和靜態函式庫)
- iasl - Intel ASL 編譯和反編譯器 (acpica-tools 也有提供)
- git - 支援 git 版本控制系統
- gcc-5 - GNU C 編譯器 (v5.4.0 作為 Ubuntu 16.04 LTS)
- nasm - 通用 x86 組譯器
- python3-distutils - 來自 python 標準函式庫的 distutils 模組
這 剩餘的指示 是對大部分 UNIX-like 系統共通的。
注意: 這些以下指示並沒有已經更新成較新版的 GCC 4.4,git(替換 subversion) 或 NASM。 較新的建置在沒有滿足的依賴性下(dependecies)可能會失敗。我們建議移除較新的 Linux 發行除非你有一個可依賴 (dependency) 的特定版本。
注意: GCC 4.4 工具鏈只支援建置 IA32 和 X64 架構的映像檔。 我們建議使用較新的工具鏈。 另外,在某些案例上 GCC 4.4 被安裝在 Linux x86 (32位元模式)上,那麼它也僅支援建置 IA32 架構的 UEFI 映像檔。
注意: Arch Linux 此時沒有經由 edk2 專案的官方支持或測試。
這些指示將透過 GNOME 終端程式來使用 Arch Linux 建置的命令殼層 (bash)。 要開啟這終端程式,在應用程式選單(Application menu)和工具子選單(System Tools sub-menu)下找尋(locate)(它)。
為了安裝所需要的套件(包),你必須是 root。 因此我們使用 'su' 來變成 root 使用者。
bash$ su - bash$ pacman -S base-devel glibc iasl python2 subversion bash$ exit
接下來的共通指示
這 剩餘的指示 是對大部分 UNIX-like 系統共通的。
注意: Fedora 此時沒有經由 edk2 專案的官方支持或測試。
注意: x86 (32位元) Fedora 將安裝 GCC 4.4,即僅有建置 UEFI 為 IA32 架構的可能。
這些指示將透過 GNOME 終端程式來使用 Fedora 建置的命令殼層 (bash)。 要開啟這終端程式,在應用程式選單(Application menu)和工具子選單(System Tools sub-menu)下找尋(locate)(它)。
為了安裝所需要的套件(包),你必須是 root。 因此我們使用 'su' 來變成 root 使用者。
bash$ su - bash$ yum groupinstall development-tools bash$ yum install iasl libuuid-devel bash$ exit
接下來的共通指示
這 剩餘的指示 是對大部分 UNIX-like 系統共通的。
注意: Mandriva 此時沒有經由 edk2 專案的官方支持或測試。
注意: x86 (32位元) Mandriva 將安裝 GCC 4.4,即僅有建置 UEFI 為 IA32 架構的可能。
這些指示將透過終端程式來使用 Mandriva 建置的命令殼層 (bash)。 要開啟這終端程式,在應用程式選單(Application menu)和工具子選單(Tools sub-menu)下找尋(locate)(它)。
為了安裝所需要的套件(包),你必須是 root。 因此我們使用 'su' 來變成 root 使用者。
bash$ su - bash$ urpmi task-c++-devel iasl libuuid-devel subversion bash$ exit
接下來的共通指示
這 剩餘的指示 是對大部分 UNIX-like 系統共通的。
注意: openSUSE 此時沒有經由 edk2 專案的官方支持或測試。
這些指示將透過 GNOME 終端程式來使用 openSUSE 建置的命令殼層 (bash)。 要開啟這終端程式,點擊 '電腦' 選單('Computer' menu),點擊 '更多應用程式' ('More Applications') 按紐,然後輸入 '終端' ('terminal') 進入過濾文字盒 (filter text box)。
幾個 openSUSE 套件(包)將需要被完整設定成 edk2 建置環境。 為了要更容易安裝所有的需求,你需要運行這個命令。
bash> sudo zypper in -t pattern devel_basis
接下來的共通指示
這 剩餘的指示 是對大部分 UNIX-like 系統共通的。
注意:
- 這個 Ubuntu 平台此時沒有經由 edk2 專案的官方支持或測試。
- x86 (32位元) 和 x86-64 (64位元) 兩者的 Ubuntu 版本將會安裝 GCC 4.4,兩者是可建置為 IA32 和 X64 架構的 UEFI。
- 這些指示可以用於 Ubuntu 10.04 上。
這些指示將透過 GNOME 終端程式來使用 Ubuntu 建置的命令殼層 (bash)。 要開啟這終端程式,在應用程式選單(Application menu)和附屬子選單(Accessories sub-menu)下找尋(locate)(它)。
幾個 Ubutntu 套件(包)將需要被完整設定成 edk2 建置環境。為了要更容易安裝所有的需求,你需要運行這個命令。
bash$ sudo apt-get install build-essential subversion uuid-dev iasl
這 剩餘的指示 是對大部分 UNIX-like 系統共通的。
- Unix-like 系統 - 建置 Ningw GCC 跨平台編譯器的初步試行的指示。
This page provides step-by-step instructions for setting up a EDK II build environment on Linux using a native GCC installation (4.4+). This EDK II setup does not require the Mingw version of GCC to be built, and therefore can be much faster to setup.
These instructions will be written as a series of commands executed from a command terminal.Often these instructions will contain a command which needs to be executed in the terminal window. For example:
bash$ echo this text is a sample command
To execute this command, highlight the text of the command in your web browser. (Note that the 'bash$' text is not part of the command!) Most web browsers should be able to copy the text by selecting Copy under the Edit menu. Now, change back to the terminal application, and there should be a Paste operation under the Edit menu. After pasting the command into the shell, you may need to press the enter or return key to execute the command.
Of course, there may be other ways to copy and paste the command into the terminal which are specific to the windowing environment and applications that you are using. If all else fails, however, you can type the command by hand.
Some commands are very long, and we use the backslash character (\) to tell the shell program that the command is not finished. For example:
bash$ echo this bold text is a sample command \ which is broken into two lines
When you copy and paste, make sure you include all lines of the command (including the backslash (\) characters). If you are typing the command, you can remove the backslash character (\) and combine the lines into a single line if you prefer.
If a command starts with the sudo command, then you may be prompted for your user password. This will be the same password as you used to login to the system.
For the purposes of this set of instructions, we will be using the following paths.
Edk2 source tree: | $HOME/src/edk2 |
Native GCC 4.x compiler installation: | /usr/bin/gcc |
Intel ASL Compiler installation: | /usr/bin/iasl |
You will need to change the commands if you want to use different locations, but this is not recommended unless you are sure that you know what you are doing.
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 examples of how you would configure your proxy by setting an environment variable:
bash$ export http_proxy=http://proxy.domain.com:proxy_port bash$ export ftp_proxy=$http_proxy
To utilize the subversion source control command behind an internet firewall with a web proxy, you should configure the ~/.subversion/servers file.
Note: These instructions utilize GCC5 & NASM compiler support (added in early 2016), along with git (replaces subversion). GCC 4.x is still supported. GCC5 is not mandatory.
These instructions will utilize Ubuntu's built in command shell (bash) via the GNOME Terminal application. To open the Terminal application, locate it under the Applications menu and the Accessories sub-menu.
Several Ubuntu packages will be needed to set up the build environment for EDK II. The following command will install all required packages:
bash$ sudo apt-get install build-essential uuid-dev iasl git gcc-5 nasm python3-distutils
- build-essential - Informational list of build-essential packages
- uuid-dev - Universally Unique ID library (headers and static libraries)
- iasl - Intel ASL compiler/decompiler (also provided by acpica-tools)
- git - support for git revision control system
- gcc-5 - GNU C compiler (v5.4.0 as of Ubuntu 16.04 LTS)
- nasm - General-purpose x86 assembler
- python3-distutils - distutils module from the Python standard library
The remaining instructions are common for most UNIX-like systems.
Note: the instructions below have not been updated for compilers newer than GCC 4.4, git (replaces subversion) or NASM. Newer builds may fail without satisfying these dependecies. We recommend moving to newer Linux distributions unless you have a dependency on a specific version.
Note: The GCC 4.4 toolchain only supports building images for the IA32 and X64 architectures. We recommend using newer toolchains.
Also, in some cases if GCC 4.4 is installed under Linux x86 (32-bit mode), then it may only support building UEFI images for the IA32 architecture.
Note: Arch Linux is not officially supported or tested by the edk2 project at this time.
These instructions will utilize Arch Linux's built in command shell (bash) via the GNOME Terminal application. To open the Terminal application, locate it under the Applications menu and the System Tools sub-menu.
To install the required packages, you must be root. Therefore we use 'su' to become the root user.
bash$ su - bash$ pacman -S base-devel glibc iasl python2 subversion bash$ exit
Continue with common instructions
The remaining instructions are common for most UNIX-like systems.
Note: Fedora is not officially supported or tested by the edk2 project at this time.
Note: x86 (32-bit) Fedora will install GCC 4.4 which is only capable of building UEFI for the IA32 architecture.
These instructions will utilize Fedora's built in command shell (bash) via the GNOME Terminal application. To open the Terminal application, locate it under the Applications menu and the System Tools sub-menu.
To install the required packages, you must be root. Therefore we use 'su' to become the root user.
bash$ su - bash$ yum groupinstall development-tools bash$ yum install iasl libuuid-devel bash$ exit
Continue with common instructions
The remaining instructions are common for most UNIX-like systems.
Note: Mandriva is not officially supported or tested by the edk2 project at this time.
Note: x86 (32-bit) Mandriva will install GCC 4.4 which is only capable of building UEFI for the IA32 architecture.
These instructions will utilize Mandriva's built in command shell (bash) via the Terminal application. To open the Terminal application, locate it under the Applications menu and the Tools sub-menu.
To install the required packages, you must be root. Therefore we use 'su' to become the root user.
bash$ su - bash$ urpmi task-c++-devel iasl libuuid-devel subversion bash$ exit
Continue with common instructions
The remaining instructions are common for most UNIX-like systems.
Note: openSUSE is not officially supported or tested by the edk2 project at this time.
These instructions will utilize openSUSE's built in command shell (bash) via the GNOME Terminal application. To open the Terminal application, click the 'Computer' menu, click the 'More Applications' button, and then enter 'terminal' into the filter text box.
Several openSUSE packages will be needed to fully set up an edk2 build environment. In order to easily install all the requirements, you need to run this command.
bash> sudo zypper in -t pattern devel_basis
Continue with common instructions
The remaining instructions are common for most UNIX-like systems.
Notes:
- The Ubuntu platform is not officially supported or tested by the edk2 project at this time.
- Both the x86 (32-bit) and x86-64 (64-bit) Ubuntu versions will install GCC 4.4 which is capable of building UEFI for both the IA32 and X64 architectures.
- These instructions should work for Ubuntu 10.04 as well
These instructions will utilize Ubuntu's built in command shell (bash) via the GNOME Terminal application. To open the Terminal application, locate it under the Applications menu and the Accessories sub-menu.
Several ubuntu packages will be needed to fully set up an edk2 build environment. In order to easily install all the requirements, you need to run this command.
bash$ sudo apt-get install build-essential subversion uuid-dev iasl
The remaining instructions are common for most UNIX-like systems.
- Unix-like systems - Instructions which walk through building the Mingw GCC cross-compiler