Build firmware on a Linux host

The steps in this section show you how to build the firmware on a Linux host.

System requirements

Before you can build the firmware on a Linux host, check that you have:

  • The correct PC hardware:
  • The correct Ubuntu version by typing the following in the terminal window:
    $ uname -srvmpio
    Linux 4.18.0-15-generic #16~18.04.1-Ubuntu SMP Thu Feb 7 14:06:04 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
    
    You must have Ubuntu 18.04 desktop.
  • 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 Python 2.7
    $ sudo apt install python
    $ python -V
    Python 2.7.15rc1
    
    Python 3
    $ sudo apt install python3 python3-distutils
    
    uuid-dev Required for including uuid/uuid.h
    $ sudo apt install uuid-dev
    Build-essential This package installs make, gcc, g++.
    $ sudo apt install build-essential
    $ make -v
    GNU Make 4.1
    $ gcc --version
    gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
    $ g++ --version
    g++ (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
    
    bison A parser generator required by ACPICA tools
    $ sudo apt install bison
    
    flex A fast-lexical analyzer generator required by ACPICA tools
    $ sudo apt install flex
    

The following steps show you how to install the required Arm toolchain and how to build the ACPICA tools:

  1. 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
    
  2. 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
    

Building the EDKII firmware

The following steps show you how to build the firmware image:

Note:Run the commands in the terminal window.

  1. Use the following commands to set up the environment variables:
    $ export GCC5_AARCH64_PREFIX=$WORKSPACE/toolchain/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/aarch64-none-elf-
    $ export PACKAGES_PATH=$WORKSPACE/edk2:$WORKSPACE/edk2-platforms
    $ export IASL_PREFIX=$WORKSPACE/acpica/generate/unix/bin/
    
  2. 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
    
  3. Configure the EDKII development environment by running the edk2setup bash script that is shown in the following command:
    $ source edk2/edksetup.sh
    
  4. 4. Build the BaseTools as shown in the following command:
    $ make -C edk2/BaseTools
    
  5. 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.

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:

$ build -a AARCH64 -t GCC5 -p Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc -b DEBUG
$ build -a AARCH64 -t GCC5 -p Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc -b RELEASE

The firmware binaries are at the following location:

$WORKSPACE/Build/ArmVExpress-FVP-AArch64/<DEBUG|RELEASE>_GCC5/FV/FVP_AARCH64_EFI.fd

Build the firmware for Arm Juno platform

To build the firmware for Arm Juno platform, run the following commands:

$ 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
Previous Next