搜尋此網誌

2014年12月7日 星期日

Using EDK II with Native GCC in Ubuntu 13.04



  • 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.8 which is capable of building UEFI for both the IA32 and X64 architectures.
  • These instructions should work for Ubuntu 10.10 as well

Open the GNOME Terminal program
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.

Install required software from apt
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
bash$ sudo apt-get install nasm
Continue with common instructions

The remaining instructions are common for most UNIX-like systems.

Common instructions
A significant portion of the steps are common on the various UNIX-like platforms. You should start with the instructions for the operating system that most closely matches your platform, and it will direct you here at the appropriate time.

Get the edk2 source tree
bash$ mkdir ~/src
bash$ cd ~/src
bash$ git clone https://github.com/tianocore/edk2
======================================================
Or, download source using subversion:
If you are behind a web proxy, then you may need to configure your proxy in the ~/.subversion/servers file.
bash$ mkdir ~/src
bash$ cd ~/src
bash$ svn co https://svn.code.sf.net/p/edk2/code/trunk/edk2
======================================================
Build the EDK II BaseTools
bash$ make -C edk2/BaseTools

Setup build shell environment
bash$ cd ~/src/edk2
bash$ export EDK_TOOLS_PATH=$HOME/src/edk2/BaseTools
bash$ . edksetup.sh BaseTools

Modify Conf Files
You will need to edit the Conf/tools_def.txt and Conf/target.txt files. These changes will enable the MdeModulePkg to be built using the GCC 4.4 compiler.

Set Build Target Information
For the Conf/target.txt file, find the following lines:

ACTIVE_PLATFORM       = Nt32Pkg/Nt32Pkg.dsc
TOOL_CHAIN_TAG        = MYTOOLS
And change the corresponding lines to match these:

ACTIVE_PLATFORM       = MdeModulePkg/MdeModulePkg.dsc
TOOL_CHAIN_TAG        = GCC48
Note: The 'gcc --version' command can be used to find out your GCC version. Use the GCC45 toolchain for gcc 4.5.* and the GCC46 toolchain for gcc 4.6.*.

Optionally, you may consider finding:

TARGET_ARCH           = IA32
...and changing it if your GCC 4.4 installation supports 64-bit builds. You can change it to either 'X64', or even 'IA32 X64' which will build both architectures.

Build Hello World! (and the rest of MdeModulePkg)
Now you should be able to simply run the build command to compile the MdeModulePkg.

bash$ build
One result of the build is that you should have the HelloWorld UEFI application:

bash$ ls Build/MdeModule/DEBUG_*/*/HelloWorld.efi
*: IA32 or X64


[Build OVMF]
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.

OVMF is an EDK II based project to enable UEFI support for Virtual Machines.

沒有留言:

張貼留言