Building Edkii Eufi Firmware For Arm Platforms
Building Edkii Eufi Firmware For Arm Platforms
Arm Platforms
Version 1.0
Building EDKII UEFI firmware for Arm Platforms 102158_0100_00
Version 1.0
Copyright © 2020 Arm Limited (or its affiliates). All rights reserved.
Release Information
Document History
Your access to the information in this document is conditional upon your acceptance that you will not use or permit others to use
the information for the purposes of determining whether implementations infringe any third party patents.
THIS DOCUMENT IS PROVIDED “AS IS”. ARM PROVIDES NO REPRESENTATIONS AND NO WARRANTIES, EXPRESS,
IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
SATISFACTORY QUALITY, NON-INFRINGEMENT OR FITNESS FOR A PARTICULAR PURPOSE WITH RESPECT TO THE
DOCUMENT. For the avoidance of doubt, Arm makes no representation with respect to, and has undertaken no analysis to
identify or understand the scope and content of, patents, copyrights, trade secrets, or other rights.
TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL ARM BE LIABLE FOR ANY DAMAGES, INCLUDING
WITHOUT LIMITATION ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE, OR CONSEQUENTIAL DAMAGES,
HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF ANY USE OF THIS
DOCUMENT, EVEN IF ARM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
This document consists solely of commercial items. You shall be responsible for ensuring that any use, duplication or disclosure
of this document complies fully with any relevant export laws and regulations to assure that this document or any portion
thereof is not exported, directly or indirectly, in violation of such export laws. Use of the word “partner” in reference to Arm’s
customers is not intended to create or refer to any partnership relationship with any other company. Arm may make changes to
this document at any time and without notice.
If any of the provisions contained in these terms conflict with any of the provisions of any click through or signed written
agreement covering this document with Arm, then the click through or signed written agreement prevails over and supersedes
the conflicting provisions of these terms. This document may be translated into other languages for convenience, and you agree
that if there is any conflict between the English version of this document and any translation, the terms of the English version of
the Agreement shall prevail.
The Arm corporate logo and words marked with ® or ™ are registered trademarks or trademarks of Arm Limited (or its
subsidiaries) in the US and/or elsewhere. All rights reserved. Other brands and names mentioned in this document may be the
trademarks of their respective owners. Please follow Arm’s trademark usage guidelines at
http://www.arm.com/company/policies/trademarks.
3T 3T
Copyright © 2020 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 2 of 18
Building EDKII UEFI firmware for Arm Platforms 102158_0100_00
Version 1.0
Copyright © 2020 Arm Limited (or its affiliates). All rights reserved.
LES-PRE-20349
Confidentiality Status
This document is Non-Confidential. The right to use, copy and disclose this document may be subject to license restrictions in
accordance with the terms of the agreement entered into by Arm and the party that Arm delivered this document to.
Product Status
The information in this document is Final, that is for a developed product.
Web Address
http://www.arm.com
3T 3T
Copyright © 2020 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 3 of 18
Building EDKII UEFI firmware for Arm Platforms 102158_0100_00
Version 1.0
Contents
1 Overview ...................................................................................................................................................................................................................5
1.1. Before you begin ......................................................................................................................................................................................................................................5
Copyright © 2020 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 4 of 18
Building EDKII UEFI firmware for Arm Platforms 102158_0100_00
Issue 1.0
1 Overview
This guide shows you how to build Unified Extensible Firmware Interface (UEFI) firmware for the Arm Fixed
Virtual Platform (FVP) Model and Juno Development Platform on either a Linux or Windows development PC.
UEFI is a specification that defines an interface between the firmware and an Operating System (OS). UEFI
defines the firmware interfaces and boot services that are required for booting a standards-based OS. UEFI
also defines run-time services, for example, time, variable that an OS can invoke at runtime.
The TianoCore EFI Development Kit II (EDKII) project provides an implementation of the UEFI firmware. EDKII
is an open-source project that provides a feature-rich, cross-platform firmware development environment for
UEFI and UEFI Platform Initialization (PI) specifications. UEFI Forum develops and maintains the specifications.
Before you work through any section of the guide, you must have git installed. How to install git is shown in the
following code:
You also need to follow the instructions in Set up the development environment.
Copyright © 2020 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 5 of 18
Building EDKII UEFI firmware for Arm Platforms 102158_0100_0
Version 1
The following steps show you how to set up your development environment:
Launch a terminal window and create a workspace folder on your development PC called source. Set the
WORKSPACE environment variable to point to this folder.
This can be seen in the following code:
In a Linux bash shell:
Copyright © 2020 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 6 of 18
Building EDKII UEFI firmware for Arm Platforms 102158_0100_0
Version 1
Clone the source code repositories. In the terminal window, change directory to your workspace (source)
folder and run the following commands:
git clone https://github.com/tianocore/edk2-platforms.git
git clone https://github.com/acpica/acpica.git
git clone https://github.com/tianocore/edk2.git
Go to the edk2 folder and update the submodules:
cd edk2
git submodule update --init
cd ..
Copyright © 2020 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 7 of 18
Building EDKII UEFI firmware for Arm Platforms 102158_0100_0
Version 1
• The following tools installed on your development PC. The instructions for each tool show you how to
install that tool:
Copyright © 2020 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 8 of 18
Building EDKII UEFI firmware for Arm Platforms 102158_0100_0
Version 1
The following steps show you how to install the required Arm toolchain and how to build the ACPICA tools:
Install the required Arm toolchain from GNU-A downloads on Arm developer.
Go to the relevant section of the page for your development PC architecture and select the little-endian
AArch64 ELF bare-metal target (aarch64-elf) GCC cross compiler. For example, for an x86_64
development PC, download gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf.tar.xz. Create a folder called
toolchain under the workspace folder and extract the toolchain, as shown in the following commands:
$ mkdir $WORKSPACE/toolchain
$ cd $WORKSPACE/toolchain
$ wget https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-a/9.2-
2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf.tar.xz
$ tar xf gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf.tar.xz
Run the following commands in the terminal window, to build the ACPICA tools:
Note: The ACPICA tools implement the latest iASL compiler.
$ cd $WORKSPACE
$ make -C $WORKSPACE/acpica
Select the Python version that you want to use and set the PYTHON_COMMAND environment variable.
For Python 2.7:
$ export PYTHON_COMMAND=/usr/bin/python
For Python 3:
$ export PYTHON_COMMAND=/usr/bin/python3
Configure the EDKII development environment by running the edk2setup bash script that is shown in the
following command:
$ source edk2/edksetup.sh
Copyright © 2020 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 9 of 18
Building EDKII UEFI firmware for Arm Platforms 102158_0100_0
Version 1
Follow either Build the firmware for Arm FVP Base AEMv8A-AEMv8A model platform or Build firmware
for Arm Juno platform. These show you how to build the firmware for your choice of Arm development
platform.
3.3. Build the firmware for Arm FVP Base AEMv8A-AEMv8A model
platform
To build the firmware for FVP Base AEMv8A-AEMv8A platform, run the following commands:
$WORKSPACE/Build/ArmVExpress-FVP-AArch64/<DEBUG|RELEASE>_GCC5/FV/FVP_AARCH64_EFI.fd
$WORKSPACE/Build/ArmJuno/<DEBUG|RELEASE>_GCC5/FV/BL33_AP_UEFI.fd
Copyright © 2020 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 10 of 18
Building EDKII UEFI firmware for Arm Platforms 102158_0100_0
Version 1
Python 2.7 The scripts in the $ sudo apt install python python3 python3-
distutils
uefi-tools package
and require Python 2.7,
whereas EDKII
Python 3 defaults to use
Python3.
Arm cross compiler The uefi-tools use $ sudo apt install gcc-aarch64-linux-gnu
toolchain the gcc-aarch64-
linux-gnu toolchain.
Follow either Build the firmware for Arm FVP Base AEMv8A-AEMv8A model platform or Build firmware
for Arm Juno platform. These show you how to build the firmware for your choice of Arm development
platform.
Copyright © 2020 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 11 of 18
Building EDKII UEFI firmware for Arm Platforms 102158_0100_0
Version 1
4.2. Build the firmware for Arm FVP Base AEMv8A-AEMv8A model
platform
To build the firmware for FVP Base AEMv8A-AEMv8A platform, run the following commands:
$ cd $WORKSPACE
$ ./uefi-tools/edk2-build.sh -b DEBUG fvp -v
$ ./uefi-tools/edk2-build.sh -b RELEASE fvp -v
$WORKSPACE/Build/ArmVExpress-FVP-AArch64/<DEBUG|RELEASE>_GCC5/FV/FVP_AARCH64_EFI.fd
$ cd $WORKSPACE
$ ./uefi-tools/edk2-build.sh -b DEBUG juno -v
$ ./uefi-tools/edk2-build.sh -b RELEASE juno -v
$WORKSPACE/Build/ArmJuno/<DEBUG|RELEASE>_GCC5/FV/BL33_AP_UEFI.fd
The uefi-tools have additional options for building firmware. To view these options, type the following command
in a terminal window:
$ ./uefi-tools/edk2-build.sh -h
Copyright © 2020 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 12 of 18
Building EDKII UEFI firmware for Arm Platforms 102158_0100_0
Version 1
Copyright © 2020 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 13 of 18
Building EDKII UEFI firmware for Arm Platforms 102158_0100_0
Version 1
Copyright © 2020 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 14 of 18
Building EDKII UEFI firmware for Arm Platforms 102158_0100_0
Version 1
echo tool Echo See the subsection called Workaround for echo command.
Create a folder called toolchain under the workspace folder, for example source\toolchain and extract
the toolchain to this folder using an appropriate archiver utility. For example, 7zip. The toolchain folder tree
will look like the following:
toolchain
+---gcc-arm-9.2-2019.12-mingw-w64-i686-aarch64-none-elf
| +---aarch64-none-elf
| +---bin
| +---include
| +---lib
| +---libexec
| +---share
Copyright © 2020 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 15 of 18
Building EDKII UEFI firmware for Arm Platforms 102158_0100_0
Version 1
Select the Python version that you want to use, and set the PYTHON_COMMAND environment variable to your
Python executable:
Configure the EDKII development environment by running the edksetup.bat script. This can be done
with the following command:
> call %WORKSPACE%\edk2\edksetup.bat [Rebuild | ForceRebuild]
Note: If the BaseTools have already been built, the Rebuild option can be skipped. Also,
the ForceRebuild option can be used to do a clean build of the Base tools.
6.5. Build the firmware for Arm FVP Base AEMv8A-AEMv8A model
platform
To build the firmware for FVP Base AEMv8A-AEMv8A platform, run the following commands:
%WORKSPACE%\Build\ArmVExpress-FVP-AArch64\<DEBUG|RELEASE>_GCC5\FV\FVP_AARCH64_EFI.fd
%WORKSPACE%\Build\ArmJuno\<DEBUG|RELEASE>_GCC5\FV\BL33_AP_UEFI.fd
Copyright © 2020 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 16 of 18
Building EDKII UEFI firmware for Arm Platforms 102158_0100_0
Version 1
7 Related information
Here are some resources related to material in this guide:
• Arm architecture and reference manuals - Find technical manuals and documentation relating to
this guide and other similar topics.
• Arm Community - Ask development questions and find articles and blogs on specific topics from Arm
experts.
• ACPI Component Architecture
• Arm Fixed Virtual Platforms
• Getting Started with EDKII
• Juno Development Board
Copyright © 2020 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 17 of 18
Building EDKII UEFI firmware for Arm Platforms 102158_0100_0
Version 1
8 Next steps
This guide has outlined the steps to build UEFI firmware for Arm development platforms.
To build Trusted Firmware-A (TF-A), a reference implementation of Secure world firmware, see the TF-A
Getting Started guide.
The steps to run the firmware on an Arm Fixed Virtual Platform (FVP) or Arm Juno development platform are
covered in Arm Development Platforms on TrustedFirmware.
Copyright © 2020 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 18 of 18