Setup the Build Environment
Check Cross-Compiler Installation
1
2sudo apt update && sudo apt upgrade -y
sudo apt install gcc-aarch64-linux-gnuSpecify the Correct GCC Toolchain
You may need to explicitly tell the build system to use the correct cross-compiler. Set the
GCC5_AARCH64_PREFIX
environment variable to point to the AArch64 GCC compiler:1
2echo "export GCC5_AARCH64_PREFIX=aarch64-linux-gnu-" >> ~/.bashrc
source ~/.bashrc
Obtaining Source Code
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.
1
2
3echo 'export WORKSPACE=/media/raman/development/tianocore' >> ~/.bashrc
mkdir -p $WORKSPACE
cd $WORKSPACEInto that folder, clone:
edk2-non-osi (if building platforms that need it)
1
2
3
4
5
6
7
8
9
10
11
12
13git clone https://github.com/tianocore/edk2.git
cd edk2
git submodule update --init
cd ..
git clone https://github.com/tianocore/edk2-platforms.git
cd edk2-platforms
git submodule update --init
cd ..
git clone https://github.com/tianocore/edk2-non-osi.git
git clone git@github.com:ADLINK/edk2_aadp.git
cd edk2_aadp
git submodule update --init
git clone git@github.com:ADLINK/edk2_adlink-ampere-altra.gitSet up a PACKAGES_PATH to point to the locations of these three repositories:
1
2
3
4echo 'export PACKAGES_PATH=$PWD/edk2:$PWD/edk2-platforms:$PWD/edk2-non-osi:$PWD/edk2_aadp:$PWD/edk2_adlink-ampere-altra:$PWD/edk2_aadp/edk2-platforms:$PWD/edk2_aadp/adlink-platforms:$PWD/edk2_aadp/OpenPlatformPkg:$PWD/edk2-platforms/Features/Intel/Debugging:$PWD/edk2_aadp/edk2-platforms/Features/Intel:$PWD/edk2_aadp/edk2' >> ~/.bashrc
# echo 'export PACKAGES_PATH=$PWD/edk2:$PWD/edk2-platforms:$PWD/edk2-non-osi' >> ~/.bashrc
source ~/.bashrcBuild the environment
1
. edk2/edksetup.sh
Build BaseTools
1
make -C edk2/BaseTools TOOLCHAIN=GCC5
Building the UEFI image
Copy the ManageabilityPkg files into the right directory.
1 | cp -rfv /media/raman/development/tianocore/edk2-platforms/Features/ManageabilityPkg /media/raman/development/tianocore/edk2-platforms/ |
Building EDK2 FD with the following command:
1 | cd edk2-platforms |
Notes: Please refer to LinuxBoot.md for building EDK2+LinuxBoot FD.
The resulting image will be at
1 | edk2-platforms/Build/Jade/RELEASE_GCC5/FV/BL33_JADE_UEFI.fd |
We will be using edk2-platforms/BUILDS/jade_tianocore_atf for the final artifacts.
1 | cd edk2-platforms |
Signing the Image
You need to download and install cert_create
and fiptool
from Arm Trusted Firmware.
1 | cd .. |
Set up your $PATH to include cert_create and fiptool from above.
Perform the following to sign the image:
1 | cd edk2-platforms |
Integrating Board Setting and Ampere’s Arm Trusted Firmware (ATF)
You need to obtain Ampere ATF image and Board Setting file compatible with this vesion of Ampere EDK2 in order to build a final firmware image.
Contact developer@amperecomputing.com for information.
1 | git clone https://github.com/ADLINK/AmpereAltra-ATF-SCP |
Build integrated UEFI + Board Setting + ATF image
Generating the final image with the following commands:
1 | dd bs=1024 count=2048 if=/dev/zero | tr "\000" "\377" > BUILDS/jade_tianocore_atf/jade_tianocore_atf.img |
Build Tianocore Capsule.
1 | build -a AARCH64 -t GCC5 -b RELEASE -p Platform/Ampere/JadePkg/JadeCapsule.dsc -D UEFI_ATF_IMAGE=BUILDS/jade_tianocore_atf/altra_atf_signed_2.10.20221028.slim -D SCP_IMAGE=BUILDS/jade_tianocore_atf/altra_scp_signed_2.10.20221028.slim |
Bonus Tip(Automate the build using script)
You can automate the build using the script file from the edk2-ampere-tools.
1 | sudo apt install efitools gnu-efi |