Files
buildroot/support/testing/tests/boot/test_edk2.py
Julien Olivain 5ddba9702a boot/edk2: bump to version edk2-stable202505
For release notes since edk2-stable202411, see:
https://github.com/tianocore/edk2/releases/tag/edk2-stable202502
https://github.com/tianocore/edk2/releases/tag/edk2-stable202505

Note: the edk2-stable202505 release note mention a security fix.
This fix was already backported in Buildroot in a previous commit.
For that reason, this bump is not marked as securiy, and also
removes the backported patch and its associated _IGNORE_CVES entry.

Those versions include fixes when using gcc 15 (host and target).

This commit also updates the edk2-platforms and edk2-non-osi packages
with the last commit merged at the edk2 release date (2025-05-23).
In the case of edk2-platforms, the commit id used in this update
is few days later, to include a fix for the Arm Sgi575 platform.
Exact commit should have been [1] (to be exactly aligned to the edk2
tag date), but commit [2] is used instead. The package edk2-non-osi is
updated to commit [3].

Also, the SocioNext SynQuacer platforms (including the DeveloperBox)
were removed upstream in edk2-platforms commit [4]. This commit
reflect that change by removing those platforms choices and associated
runtime tests.

This commit has been runtime tested with tests using EDK2 package,
with commands:

    support/testing/run-tests \
        -d dl -o output_folder \
            tests.boot.test_edk2 \
            tests.boot.test_grub.TestGrubAArch64EFI \
            tests.boot.test_grub.TestGrubi386EFI \
            tests.boot.test_grub.TestGrubRiscV64EFI \
            tests.boot.test_grub.TestGrubX8664EFI \
            tests.fs.test_iso9660.TestIso9660Grub2EFI \
            tests.fs.test_iso9660.TestIso9660Grub2Hybrid \
            tests.package.test_fwts

It has also been runtime tested (by booting in qemu) with defconfigs
using EDK2 package:
qemu_aarch64_sbsa_defconfig
qemu_riscv64_virt_efi_defconfig

[1] 2bfe3fa99e
[2] 92f7d69e8a
[3] ea2040c2d4
[4] aaba5807f1

Cc: Dick Olsson <hi@senzilla.io>
Cc: Romain Naour <romain.naour@smile.fr>
Cc: Vincent Stehlé <vincent.stehle@arm.com>
Tested-by: Vincent Stehlé <vincent.stehle@arm.com>
Reviewed-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Julien Olivain <ju.o@free.fr>
2025-06-25 19:30:18 +02:00

155 lines
5.3 KiB
Python

import os
import infra.basetest
class TestEdk2(infra.basetest.BRTest):
config = \
"""
BR2_aarch64=y
BR2_neoverse_n1=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
# BR2_TARGET_ROOTFS_TAR is not set
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/aarch64-sbsa/assemble-flash-images support/scripts/genimage.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/qemu/aarch64-sbsa/genimage.cfg"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.6.58"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="support/testing/tests/boot/test_edk2/linux.config"
BR2_TARGET_EDK2=y
BR2_TARGET_EDK2_PLATFORM_QEMU_SBSA=y
BR2_TARGET_GRUB2=y
BR2_TARGET_GRUB2_ARM64_EFI=y
BR2_TARGET_ARM_TRUSTED_FIRMWARE=y
BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION=y
BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION_VALUE="v2.12"
BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="qemu_sbsa"
BR2_TARGET_ARM_TRUSTED_FIRMWARE_FIP=y
BR2_PACKAGE_HOST_GENIMAGE=y
BR2_PACKAGE_HOST_DOSFSTOOLS=y
BR2_PACKAGE_HOST_MTOOLS=y
BR2_PACKAGE_HOST_QEMU=y
BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y
"""
def test_run(self):
hda = os.path.join(self.builddir, "images", "disk.img")
flash0 = os.path.join(self.builddir, "images", "SBSA_FLASH0.fd")
flash1 = os.path.join(self.builddir, "images", "SBSA_FLASH1.fd")
self.emulator.boot(arch="aarch64",
options=["-M", "sbsa-ref",
"-cpu", "neoverse-n1",
"-m", "512M",
"-pflash", flash0,
"-pflash", flash1,
"-hda", hda])
self.emulator.login()
class TestEdk2BuildBase(infra.basetest.BRTest):
"""A class to test the build of various edk2 platforms."""
base_config = \
"""
# BR2_PACKAGE_BUSYBOX is not set
# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set
# BR2_TARGET_ROOTFS_TAR is not set
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
BR2_TARGET_EDK2=y
BR2_TOOLCHAIN_EXTERNAL=y
"""
def assertBinariesExist(self, *binaries: str) -> None:
"""Assert that the binaries passed as argument exist
under the images folder.
We print a message to the emulator logfile for each binary found.
"""
for binary in binaries:
binpath = os.path.join(self.builddir, "images", binary)
self.assertTrue(os.path.exists(binpath), f"Missing {binpath}!")
print(f"{binary} exists: {binpath}", file=self.emulator.logfile,
flush=True)
class TestEdk2BuildArmVirtQemu(TestEdk2BuildBase):
config = TestEdk2BuildBase.base_config + \
"""
BR2_aarch64=y
BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU=y
"""
def test_run(self) -> None:
self.assertBinariesExist("QEMU_EFI.fd", "QEMU_VARS.fd")
class TestEdk2BuildArmVirtQemuKernel(TestEdk2BuildBase):
config = TestEdk2BuildBase.base_config + \
"""
BR2_aarch64=y
BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU_KERNEL=y
"""
def test_run(self) -> None:
self.assertBinariesExist("QEMU_EFI.fd", "QEMU_VARS.fd")
class TestEdk2BuildArmSgi575(TestEdk2BuildBase):
config = TestEdk2BuildBase.base_config + \
"""
BR2_aarch64=y
BR2_TARGET_EDK2_PLATFORM_ARM_SGI575=y
"""
def test_run(self) -> None:
self.assertBinariesExist("BL33_AP_UEFI.fd")
class TestEdk2BuildArmVexpressFvpAarch64(TestEdk2BuildBase):
config = TestEdk2BuildBase.base_config + \
"""
BR2_aarch64=y
BR2_TARGET_EDK2_PLATFORM_ARM_VEXPRESS_FVP_AARCH64=y
"""
def test_run(self) -> None:
self.assertBinariesExist("FVP_AARCH64_EFI.fd")
class TestEdk2BuildQemuSbsa(TestEdk2BuildBase):
# This configuration is not exactly identical to the configuration built
# during TestEdk2, as we use the latest arm-trusted-firmware version, among
# other things.
config = TestEdk2BuildBase.base_config + \
"""
BR2_aarch64=y
BR2_TARGET_EDK2_PLATFORM_QEMU_SBSA=y
BR2_TARGET_ARM_TRUSTED_FIRMWARE=y
BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="qemu_sbsa"
BR2_TARGET_ARM_TRUSTED_FIRMWARE_FIP=y
"""
def test_run(self) -> None:
self.assertBinariesExist("SBSA_FLASH0.fd", "SBSA_FLASH1.fd", "fip.bin")
class TestEdk2BuildSolidrunArmada80x0mcbin(TestEdk2BuildBase):
config = TestEdk2BuildBase.base_config + \
"""
BR2_aarch64=y
BR2_cortex_a72=y
BR2_TARGET_EDK2_PLATFORM_SOLIDRUN_ARMADA80X0MCBIN=y
BR2_TARGET_ARM_TRUSTED_FIRMWARE=y
BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="a80x0_mcbin"
BR2_TARGET_ARM_TRUSTED_FIRMWARE_EDK2_AS_BL33=y
BR2_TARGET_BINARIES_MARVELL=y
BR2_TARGET_MV_DDR_MARVELL=y
"""
def test_run(self) -> None:
self.assertBinariesExist("ARMADA_EFI.fd", "fip.bin", "ble.bin",
"scp-fw.bin")