Build firmware on a x64 Windows host
This section shows you how to build firmware on a x64 Windows host.
System requirements
Before you can build the firmware on a x64 Windows host, check that you have:
- The correct PC hardware:
- That you have at least Windows 10 desktop (Version 1809, OS Build 17763.316) or newer installed.
- The following tools installed on your development PC. The instructions for each tool show you how to install that tool:
Tool | Description | Install instructions |
Python 2.7 or Python 3 | Python interpreter | Go to https://www.python.org/downloads/windows/ Choose the latest Python 2.7 or 3.8.3 release. Download and run the Windows x86_64 MSI installer If needed, add the Python executable to your path by executing the following command: >set PATH=<:Path_to_the_python_executable>;%PATH% |
Git | Git source control tool | Go to https://git-scm.com/download/win Download and run the 64-bit Git for Windows Setup .
|
ASL tools |
iASL compiler and other tools for the ASL language | Go to https://www.acpica.org/downloads/binary-tools Download the iASL Compiler and Windows ACPI Tools Extract the content and place it at C:\ASL\ Check that the compiler is at the right place by executing: > C:\ASL\iasl.exe -v
|
Microsoft Visual Studio 2017 professional | Microsoft IDE and compiler toolchain | Go to https://visualstudio.microsoft.com/downloads/ Download and install Visual Studio 2017 Professional. |
echo tool | Echo | See the subsection called Workaround for echo command. |
Arm cross compiler toolchain
The following instructions show you how to install the Arm toolchain Windows (i686-mingw32) hosted cross compilers.
- Select the latest toolchain for AArch64 bare-metal target (aarch64-none-elf) GCC cross compiler.
For example: Download gcc-arm-9.2-2019.12-mingw-w64-i686-aarch64-none-elf.tar.xz - 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
Workaround for the echo command
EDKII needs a workaround related to the echo command. A script replacing the Windows echo executable must be created, with the name echo.BAT
. The following instructions show how you can do this:
- Create a file named
echo.BAT
in the folder of your choice. - Paste the following lines inside the file:
rem %~f0 echo.BAT %* rem This file exists to overcome a problem in the EDKII build where rem build_rule.template invokes a command as: rem "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst} rem When OBJCOPY is set to echo, this results in the following error: rem "echo" objcopy not needed for m:\...\PCD\Dxe\Pcd\DEBUG\PcdDxe.dll rem And CMD.EXE fails to find the DOS echo command because of the quotes @echo %* @goto :EOF
- Add the file to your
PATH
by executing the following:
>set PATH=<Path_to_the_echo_file>;%PATH%
Building EDKII firmware
To build the firmware image, follow these steps:
- Set up the environment variables:
> set GCC5_AARCH64_PREFIX=%WORKSPACE%\toolchain\gcc-arm-9.2-2019.12-mingw-w64-i686-aarch64-none-elf\bin\aarch64-none-elf- > set PACKAGES_PATH=%WORKSPACE%\edk2;%WORKSPACE%\edk2-platforms
Select the Python version that you want to use, and set the PYTHON_COMMAND environment variable to your Python executable:
> set PYTHON_COMMAND=<Path_to_your_Python_executable>\<Python_executable>.exe
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, theRebuild
option can be skipped. Also, theForceRebuild
option can be used to do a clean build of the Base tools.
Build the firmware for Arm Juno platform
To build the firmware for Arm Juno platform, run the following command:
> build -a AARCH64 -t GCC5 -p Platform\ARM\JunoPkg\ArmJuno.dsc -b DEBUG > build -a AARCH64 -t GCC5 -p Platform\ARM\JunoPkg\ArmJuno.dsc -b RELEASE
The firmware binaries are at the following location:
%WORKSPACE%\Build\ArmJuno\<DEBUG|RELEASE>_GCC5\FV\BL33_AP_UEFI.fd