Skip to content

Build_firmware

semihalf-wojtas-marcin edited this page Mar 14, 2022 · 7 revisions

Building the firmware

Prepare toolchain (for cross-compilation only):

  1. Download the latest toolchain from ARM GNU Toolchain page:

    $ wget https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu.tar.xz
    
  2. Extract the archive and setup the path and compiler prefix to GCC5_AARCH64_PREFIX variable:

    $ tar -xf gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu.tar.xz
    $ export GCC5_AARCH64_PREFIX=<toolchain_path>/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-
    

Prepare prerequisites

  1. Create a new folder (directory) on your local development machine for use as your workspace. This example uses /work/git/tianocore, modify as appropriate for your needs.

    $ export WORKSPACE=/work/git/tianocore
    $ mkdir -p $WORKSPACE
    $ cd $WORKSPACE
    
  2. Clone the Trusted Firmware repository:

    $ cd ${WORKSPACE}
    $ git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git
    
  3. Clone repository for auxiliary firmware on the SoC co-processors and checkout to binaries-marvell-armada-SDK10.0.1.0:

    $ cd ${WORKSPACE}
    $ git clone https://github.com/MarvellEmbeddedProcessors/binaries-marvell.git
    $ cd binaries-marvell/
    $ git checkout -b binaries-marvell-armada-SDK10.0.1.0 origin/binaries-marvell-armada-SDK10.0.1.0
    
  4. Clone the DDR training code from:

    $ cd ${WORKSPACE}
    $ git clone https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell.git
    

Prepare EDKII environment:

Please follow instructions from Obtaining source code and Manual building from the top level edk2-platforms Readme.md.

Build EDKII image:

Use below build command in '${WORKSPACE}' directory:

MacchiatoBin:

$ build -a AARCH64 -t GCC5 -b RELEASE -D INCLUDE_TFTP_COMMAND -D X64EMU_ENABLE -p Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc

Marvell CN913x Development Board:

$ build -a AARCH64 -t GCC5 -b RELEASE -D CN9132 -D INCLUDE_TFTP_COMMAND -D CAPSULE_ENABLE -D X64EMU_ENABLE -p Platform/Marvell/Cn913xDb/Cn913xDbA.dsc

CN913x CEx7 Evaluation Board:

$ build -a AARCH64 -t GCC5 -b RELEASE -D INCLUDE_TFTP_COMMAND -D CAPSULE_ENABLE -D X64EMU_ENABLE -p Platform/SolidRun/Cn913xCEx7Eval/Cn913xCEx7Eval.dsc

NOTE

'-D INCLUDE_TFTP_COMMAND' is optional.


Build the final firmware image:

  1. Set BL33 variable to path to EDK II output binary:

    MacchiatoBin:

    $ export BL33=${WORKSPACE}/Build/Armada80x0McBin-AARCH64/RELEASE_GCC5/FV/ARMADA_EFI.fd
    

    Marvell CN913x Development Board:

    $ export BL33=${WORKSPACE}/Build/Cn9132DbA-AARCH64/RELEASE_GCC5/FV/ARMADA_EFI.fd
    

    CN913x CEx7 Evaluation Board:

    $ export BL33=${WORKSPACE}/Build/Cn913xCEx7Eval-AARCH64/RELEASE_GCC5/FV/ARMADA_EFI.fd
    
  2. Export SCP_BL2 variable:

    $ export SCP_BL2=${WORKSPACE}/binaries-marvell/mrvl_scp_bl2.img
    
  3. Export compiler variables (for cross-compilation only):

    $ export ARCH=arm64
    $ export CROSS_COMPILE=<toolchain_path>/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-
    
  4. Build the image:

    $ cd ${WORKSPACE}/trusted-firmware-a/
    

    MacchiatoBin:

    $ make LOG_LEVEL=20 MV_DDR_PATH=${WORKSPACE}/mv-ddr-marvell PLAT=a80x0_mcbin all fip mrvl_flash
    

    Marvell CN913x Development Board:

    $ make LOG_LEVEL=20 MV_DDR_PATH=${WORKSPACE}/mv-ddr-marvell CP_NUM=3 PLAT=t9130 all fip mrvl_flash
    
    

    CN913x CEx7 Evaluation Board:

    $ make LOG_LEVEL=20 MV_DDR_PATH=${WORKSPACE}/mv-ddr-marvell CP_NUM=3 PLAT=t9130_cex7_eval all fip mrvl_flash
    
    

The firmware image flash-image.bin can be found in build/<PLAT>/release/ directory, where PLAT is the platform name from make command. The file is ready for updating in board's boot device (SPI/SD/MMC) - see howto.

Clone this wiki locally