The previous article is the Ampere Altra Mt. Jade OpenBMC and EDKII build guide on ARM64 platform. It’s a kind of old article and is for Mt. Jade, not for Altrad8ud.
Rebecca committed the Altrad8ud support for EDK2 several months ago. I’ll just update some procedures and the git tree addresses.
OS: ubuntu 24.04
Install necessary packages
sudo apt update
sudo apt-get install -y build-essential chrpath cpio debianutils diffstat gawk git iputils-ping libdata-dumper-simple-perl liblz4-tool libsdl1.2-dev libthread-queue-any-perl locales python3 socat subversion texinfo wget zstd
sudo apt-get install -y uuid-dev acpica-tools
If want to compile it on x86 platform, it needs to install cross compiler gcc
sudo apt install gcc-aarch64-linux-gnu
export GCC_AARCH64_PREFIX=aarch64-linux-gnu-
Download git source code
export WORKSPACE=/nvme/tianocore
mkdir -p $WORKSPACE
cd $WORKSPACE
git 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 https://github.com/AmpereComputing/edk2-ampere-tools.git
git clone --depth 1 https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git
Setup the environment, first time, it needs to run the script in the edk2 directory
make -C edk2/BaseTools
cd edk2
. edksetup.sh
then it should run it again on <WORKSPACE>
cd $WORKSPACE
. edk2/edksetup.sh
Build ARM ATF
cd $WORKSPACE
cd trusted-firmware-a
make fiptool
make certtool
add those parameters to your environment file and source it.
export WORKSPACE=/nvme/tianocore
export PACKAGES_PATH=$PWD/edk2:$PWD/edk2-platforms:$PWD/edk2-non-osi:$PWD/edk2-platforms/Features
ATFPATH=$WORKSPACE
export MANUFACTURER=ASRockRack
export BOARD_NAME=Altra1L2T
export PATH=$PATH:$ATFPATH/AtfTools/tools/cert_create:$ATFPATH/AtfTools/tools/fiptool
Build the edk2
# build release version
./edk2-platforms/Platform/Ampere/buildfw.sh -m ASRockRack -p Altra1L2T -b RELEASE
# build debug version
./edk2-platforms/Platform/Ampere/buildfw.sh -m ASRockRack -p Altra1L2T -b DEBUG
# Change default parameters
EDK2_X86_EMULATOR_ENABLE=FALSE EDK2_SHELL_ENABLE=TRUE ./edk2-platforms/Platform/Ampere/buildfw.sh -m ASRockRack -p Altra1L2T -b RELEASE
Detail parameres can be seen in the build_fw.sh file
./edk2-platforms/Platform/Ampere/buildfw.sh --help
Usage:
./edk2-platforms/Platform/Ampere/buildfw.sh [options]
Options:
-b <bldtype>, --build <bldtype> Specify the build type: DEBUG or RELEASE
-t <tc>, --toolchain <tc> Specify the toolchain to use: GCC or CLANG
-m <mfg>, --manufacturer <mfg> Specify platform manufacturer (e.g. Ampere)
-p <plat>, --platform <plat> Specify platform to build (e.g. Jade)
-l <kern>, --linuxboot <kern> Build LinuxBoot firmware instead of full EDK2 with UEFI Shell, specifying path to flashkernel
-f, --flash Copy firmware to BMC and flash firmware (keeping EFI variables and NVPARAMs) after building
-F, --full-flash Copy firmware to BMC and flash full EEPROM (resetting EFI variables and NVPARAMs) after building
Note: flash options require bmc.sh file with env vars BMC_HOST, BMC_USER and BMC_PASS defined
Available manufacturers:
ADLINK
Ampere
ASRockRack
Available platforms:
ADLINK -> ComHpcAlt
Ampere -> Jade
ASRockRack -> Altra1L2Q
ASRockRack -> Altra1L2T
Environment Variables:
SECUREBOOT_DIR - directory to store SecureBoot keys, certs etc.
USE_EXISTING_SB_KEYS - use existing Secure Boot Platform and Update keys
DOWNLOAD_MS_SB_KEYS - force re-download of Microsoft Secure Boot KEK and DB certificates
CERT_PASSWORD - password to use when generating Platform and Update Keys and certificates
defaults to "password" if not specified.
EDK2_SECURE_BOOT_ENABLE (TRUE)
EDK2_NETWORK_ENABLE (TRUE)
EDK2_INCLUDE_TFTP_COMMAND (TRUE)
EDK2_NETWORK_IP6_ENABLE (TRUE)
EDK2_NETWORK_ALLOW_HTTP_CONNECTIONS (FALSE)
EDK2_NETWORK_TLS_ENABLE (TRUE)
EDK2_REDFISH_ENABLE (TRUE)
EDK2_PERFORMANCE_MEASUREMENT_ENABLE (FALSE)
EDK2_TPM2_ENABLE (TRUE)
EDK2_HEAP_GUARD_ENABLE (FALSE)
EDK2_X86_EMULATOR_ENABLE (TRUE)
EDK2_SHELL_ENABLE (TRUE)
If build_fw.sh run’s without any problem, it will generate a 10MB size BIOS image, but the stock ASRR image size is 32MB. Therefore, you needs to copy the EDK2 image into the stock image at offset 0x600000. You can download the Altrad8ud stock firmware from the Altrad8ud firmware download site.
dd if=edk2-uefi.bin of=stock-bios.bin bs=1MB seek=6 conv=notrunc
Here is a sample script to package it again. It will generate fw-altrad8ud.tar, which can be upgraded via the WebGUI.
cp ampere/bios.bin .
cp ampere/MANIFEST .
dd if=Build/Altra1L2T/altra1l2t_uefi.bin of=bios.bin bs=1M seek=6 conv=notrunc
tar cf fw-altrad8ud.tar bios.bin MANIFEST
Or you also can copy bios.bin(modified) to the BMC and update it directly from the BMC.
because scp or sftp didn’t work for me, I used the http to download the image.
# cd /tmp
# curl <your web>/bios.bin
# ampere_flash_bios.sh bios.bin
發佈留言