1
0
mirror of https://git.yoctoproject.org/meta-arm synced 2026-06-06 02:40:18 +00:00

arm/edk2-firmware: update to edk2-stable202511

Update edk2-firmware and edk2-basetools to the 202511 stable release.

Patches from upstream were needed to get it compiling with clang.

edk2 dropped support for 32bit arm and x86, see
https://edk2.groups.io/g/devel/topic/rfc_remove_ovmf_ia32_and/114152215
Therefore, we're dropping qemuarm edk2 testing and relevant bits

Signed-off-by: Jon Mason <jon.mason@arm.com>
This commit is contained in:
Jon Mason
2025-12-17 11:15:23 -05:00
parent a95040828c
commit f6c78d2770
11 changed files with 204 additions and 64 deletions
-1
View File
@@ -308,7 +308,6 @@ qemuarm:
parallel:
matrix:
- TOOLCHAINS: [gcc, clang]
FIRMWARE: edk2
TESTING: testimage
- DISTRO: poky-tiny
TESTING: testimage
@@ -1,6 +1,3 @@
# The release of EDK2 after 202402 should fix this
NUMA: Failed to initialise from firmware
# TODO: we should be using bochsdrm over efifb?
efifb: cannot reserve video memory at 0x80000000
@@ -10,7 +10,7 @@ LICENSE = "BSD-2-Clause-Patent"
SRC_URI = "git://github.com/tianocore/edk2.git;branch=master;protocol=https"
LIC_FILES_CHKSUM = "file://License.txt;md5=2b415520383f7964e96700ae12b4570a"
SRCREV = "d46aa46c8361194521391aa581593e556c707c6e"
SRCREV = "46548b1adac82211d8d11da12dd914f41e7aa775"
UPSTREAM_CHECK_GITTAGREGEX = "^edk2-stable(?P<pver>\d+)$"
@@ -5,17 +5,6 @@ EDK2_BIN_NAME:qemuarm64 = "QEMU_EFI.fd"
# No need for PXE booting in qemu, disable to reduce unnecessary noise
EDK2_EXTRA_BUILD:qemuarm64 += " -D NETWORK_PXE_BOOT_ENABLE=FALSE "
COMPATIBLE_MACHINE:qemuarm = "qemuarm"
EDK2_PLATFORM:qemuarm = "ArmVirtQemu-ARM"
EDK2_PLATFORM_DSC:qemuarm = "ArmVirtPkg/ArmVirtQemu.dsc"
EDK2_BIN_NAME:qemuarm = "QEMU_EFI.fd"
# No need for PXE booting in qemu, disable to reduce unnecessary noise
EDK2_EXTRA_BUILD:qemuarm += " -D NETWORK_PXE_BOOT_ENABLE=FALSE "
do_install:append:qemuarm64() {
install ${B}/Build/${EDK2_PLATFORM}/${EDK2_BUILD_MODE}_${EDK_COMPILER}/FV/${EDK2_BIN_NAME} ${D}/firmware/
}
do_install:append:qemuarm() {
install ${B}/Build/${EDK2_PLATFORM}/${EDK2_BUILD_MODE}_${EDK_COMPILER}/FV/${EDK2_BIN_NAME} ${D}/firmware/
}
@@ -1,9 +0,0 @@
require recipes-bsp/uefi/edk2-firmware.inc
SRCREV_edk2 ?= "d46aa46c8361194521391aa581593e556c707c6e"
SRCREV_edk2-platforms ?= "d82aa92c1d360c1b53ccad4dc45bdd8164a560d5"
SRC_URI += "file://edk2_fix_epoch.patch"
#FIXME - arm32 doesn't work with clang due to a linker issue
TOOLCHAIN:arm = "gcc"
@@ -0,0 +1,7 @@
require recipes-bsp/uefi/edk2-firmware.inc
SRCREV_edk2 ?= "46548b1adac82211d8d11da12dd914f41e7aa775"
SRCREV_edk2-platforms ?= "675f692ace4ae501c7f6f700cff364b13960e74e"
SRC_URI += "file://0001-BaseTools-tools_def-Use-LLD-to-link-ACPI-table-binar.patch \
file://0001-ArmPkg-Fix-errors-in-MiscChassisManufacturerFunction.patch"
@@ -0,0 +1,148 @@
From 33e4e73a17bff0823bc916998169b926115b0c6b Mon Sep 17 00:00:00 2001
From: Mike Beaton <mjsbeaton@gmail.com>
Date: Mon, 24 Nov 2025 20:40:28 +0000
Subject: [PATCH] ArmPkg: Fix errors in MiscChassisManufacturerFunction
Initial error found while attempting to implement Azure Pipelines
CLANGDWARF CI:
ERROR - Compiler #error from /__w/1/s/ArmPkg/Universal/Smbios/SmbiosMiscDx
e/Type03/MiscChassisManufacturerFunction.c variable 'ContainedElements' is
uninitialized when passed as a const pointer argument here [-Werror,-Wunin
itialized-const-pointer]
The code in question should copy the optional ContainedElements from
InputData, so fix it so that it does.
Additionally:
- Various size calculations in the original code are incorrect, since
the base size for calculations should not include ContainedElements,
so fix these.
- Since we are calculating Hdr.Length separately as part of the above,
add code to ASSERT and return EFI_OUT_OF_RESOURCES if it would
overflow the UINT8 location where it will be stored.
- Since we are adding a new early exit, fix the fact that no error log
message is generated on early exit.
Fixes: bfc0fae459543442f3f17e0de655a72aba5b0920
Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
Upstream-Status: Backport [33e4e73a17bff0823bc916998169b926115b0c6b]
Signed-off-by: Jon Mason <jon.mason@arm.com>
---
.../Type03/MiscChassisManufacturerFunction.c | 54 ++++++++++---------
1 file changed, 29 insertions(+), 25 deletions(-)
diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type03/MiscChassisManufacturerFunction.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type03/MiscChassisManufacturerFunction.c
index 6b3b63b0e8d5..363f3bfe30d6 100644
--- a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type03/MiscChassisManufacturerFunction.c
+++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type03/MiscChassisManufacturerFunction.c
@@ -45,6 +45,9 @@ SMBIOS_MISC_TABLE_FUNCTION (MiscChassisManufacturer) {
UINTN AssertTagStrLen;
UINTN SerialNumStrLen;
UINTN ChaNumStrLen;
+ UINTN BaseSize;
+ UINTN ExtendLength;
+ UINTN HdrLength;
EFI_STRING Manufacturer;
EFI_STRING Version;
EFI_STRING SerialNumber;
@@ -55,12 +58,6 @@ SMBIOS_MISC_TABLE_FUNCTION (MiscChassisManufacturer) {
SMBIOS_TABLE_TYPE3 *InputData;
EFI_STATUS Status;
- UINT8 ContainedElementCount;
- CONTAINED_ELEMENT ContainedElements;
- UINT8 ExtendLength;
-
- ExtendLength = 0;
-
//
// First check for invalid parameters.
//
@@ -116,14 +113,25 @@ SMBIOS_MISC_TABLE_FUNCTION (MiscChassisManufacturer) {
ChassisSkuNumber = HiiGetPackageString (&gEfiCallerIdGuid, TokenToGet, NULL);
ChaNumStrLen = StrLen (ChassisSkuNumber);
- ContainedElementCount = InputData->ContainedElementCount;
- ExtendLength = ContainedElementCount * sizeof (CONTAINED_ELEMENT);
+ STATIC_ASSERT (OFFSET_OF (SMBIOS_TABLE_TYPE3, ContainedElements) == 0x15, "Base size of SMBIOS_TABLE_TYPE3 does not meet SMBIOS specification");
+
+ BaseSize = OFFSET_OF (SMBIOS_TABLE_TYPE3, ContainedElements);
+ ExtendLength = (UINTN)InputData->ContainedElementCount * (UINTN)InputData->ContainedElementRecordLength;
+
+ //
+ // Length of SMBIOS struct includes ContainedElements and SKUNumber.
+ //
+ HdrLength = BaseSize + ExtendLength + sizeof (SMBIOS_TABLE_STRING);
+ if (HdrLength > MAX_UINT8) {
+ ASSERT (HdrLength <= MAX_UINT8);
+ Status = EFI_OUT_OF_RESOURCES;
+ goto Exit;
+ }
//
- // Two zeros following the last string.
+ // Additional zero follows the last string.
//
- RecordLength = sizeof (SMBIOS_TABLE_TYPE3) +
- ExtendLength + 1 +
+ RecordLength = HdrLength +
ManuStrLen + 1 +
VerStrLen + 1 +
SerialNumStrLen + 1 +
@@ -135,25 +143,20 @@ SMBIOS_MISC_TABLE_FUNCTION (MiscChassisManufacturer) {
goto Exit;
}
- (VOID)CopyMem (SmbiosRecord, InputData, sizeof (SMBIOS_TABLE_TYPE3));
+ // Copy base record plus ContainedElements.
+ (VOID)CopyMem (SmbiosRecord, InputData, BaseSize + ExtendLength);
- SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE3) + ExtendLength + 1;
+ SmbiosRecord->Hdr.Length = HdrLength;
SmbiosRecord->Type = OemGetChassisType ();
- // ContainedElements
- ASSERT (ContainedElementCount < 2);
- (VOID)CopyMem (SmbiosRecord + 1, &ContainedElements, ExtendLength);
-
// ChassisSkuNumber
- SkuNumberField = (UINT8 *)SmbiosRecord +
- sizeof (SMBIOS_TABLE_TYPE3) -
- sizeof (CONTAINED_ELEMENT) + ExtendLength;
+ SkuNumberField = (UINT8 *)SmbiosRecord + BaseSize + ExtendLength;
+ // The string numbers in the fixed position portion of the record are populated in the input data.
*SkuNumberField = 5;
- OptionalStrStart = (CHAR8 *)((UINT8 *)SmbiosRecord + sizeof (SMBIOS_TABLE_TYPE3) +
- ExtendLength + 1);
+ OptionalStrStart = (CHAR8 *)((UINT8 *)SmbiosRecord + HdrLength);
UnicodeStrToAsciiStrS (Manufacturer, OptionalStrStart, ManuStrLen + 1);
StrStart = OptionalStrStart + ManuStrLen + 1;
UnicodeStrToAsciiStrS (Version, StrStart, VerStrLen + 1);
@@ -175,6 +178,10 @@ SMBIOS_MISC_TABLE_FUNCTION (MiscChassisManufacturer) {
// Now we have got the full smbios record, call smbios protocol to add this record.
//
Status = SmbiosMiscAddRecord ((UINT8 *)SmbiosRecord, NULL);
+
+ FreePool (SmbiosRecord);
+
+Exit:
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
@@ -185,9 +192,6 @@ SMBIOS_MISC_TABLE_FUNCTION (MiscChassisManufacturer) {
));
}
- FreePool (SmbiosRecord);
-
-Exit:
if (Manufacturer != NULL) {
FreePool (Manufacturer);
}
@@ -0,0 +1,42 @@
From 5d38a20196b9b9d15552ba3617ec7f63f6401a5c Mon Sep 17 00:00:00 2001
From: Ard Biesheuvel <ardb@kernel.org>
Date: Tue, 25 Nov 2025 14:29:20 +0100
Subject: [PATCH] BaseTools/tools_def: Use LLD to link ACPI table binaries
Currently, the CLANGDWARF toolchain on AARCH64 fails to pass the
-fuse-ld=lld compiler option, and so linking ACPI table binaries falls
back to the BFD linker. On non-AARCH64 build systems, this will
correctly run the cross-linker, based on the -target argument passed to
Clang, which therefore needs to be installed.
However, the ASLCC invocation fails to pass that same -target argument,
therefore producing object files for the native architecture, which the
cross-linker cannot link, resulting in a build error.
So pass the target in ASLCC_FLAGS as well, which is sufficient to get a
working build. And for good measure, pass -fuse-ld=lld so that we don't
rely on the BFD cross-linker in the first place.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Upstream-Status: Backport [5d38a20196b9b9d15552ba3617ec7f63f6401a5c]
Signed-off-by: Jon Mason <jon.mason@arm.com>
---
BaseTools/Conf/tools_def.template | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 32085ad00af7..d19624fa4628 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -1872,8 +1872,8 @@ DEFINE CLANGDWARF_AARCH64_DLINK_FLAGS = DEF(CLANGDWARF_AARCH64_TARGET) DEF(GCC_
*_CLANGDWARF_AARCH64_SLINK_PATH = ENV(CLANGDWARF_BIN)llvm-ar
*_CLANGDWARF_AARCH64_RC_PATH = ENV(CLANGDWARF_BIN)llvm-objcopy
-*_CLANGDWARF_AARCH64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -fno-lto
-*_CLANGDWARF_AARCH64_ASLDLINK_FLAGS = DEF(CLANGDWARF_AARCH64_TARGET) DEF(GCC_AARCH64_ASLDLINK_FLAGS) DEF(CLANGDWARF_DLINK_WARNING_FLAGS)
+*_CLANGDWARF_AARCH64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) DEF(CLANGDWARF_AARCH64_TARGET) -fno-lto
+*_CLANGDWARF_AARCH64_ASLDLINK_FLAGS = DEF(CLANGDWARF_AARCH64_TARGET) DEF(GCC_AARCH64_ASLDLINK_FLAGS) DEF(CLANGDWARF_DLINK_WARNING_FLAGS) -fuse-ld=lld
*_CLANGDWARF_AARCH64_ASM_FLAGS = DEF(GCC_ASM_FLAGS) DEF(CLANGDWARF_AARCH64_TARGET) $(PLATFORM_FLAGS) -Qunused-arguments
*_CLANGDWARF_AARCH64_DLINK_FLAGS = DEF(CLANGDWARF_AARCH64_TARGET) DEF(GCC_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000 DEF(CLANGDWARF_DLINK_WARNING_FLAGS)
*_CLANGDWARF_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
@@ -1,33 +0,0 @@
From ef9dfeb6e96bf7f71162691a78d6b82c9516c0c0 Mon Sep 17 00:00:00 2001
From: Mikko Rapeli <mikko.rapeli@linaro.org>
Date: Tue, 1 Apr 2025 10:34:31 -0400
Subject: [PATCH] edk2-firmware: fix SOURCE_DATE_EPOCH use
printenv host tool is not exposed to recipes so
just set epoch using SOURCE_DATE_EPOCH which is always
set. Fixes compile error:
Building ... ../build/tmp_zynqmp-kria-starter-psa/work/zynqmp_kria_starter_psa-poky-linux/edk2-firmware/202411/edk2/MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf [AARCH64]
../build/tmp_zynqmp-kria-starter-psa/work/zynqmp_kria_starter_psa-poky-linux/edk2-firmware/202411/edk2/EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.c: In function 'LibGetTime':
<command-line>: error: stray '`' in program
../build/tmp_zynqmp-kria-starter-psa/work/zynqmp_kria_starter_psa-poky-linux/edk2-firmware/202411/edk2/EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.c:89:20: note: in expansion of macro 'BUILD_EPOCH'
89 | EpochSeconds = BUILD_EPOCH;
| ^~~~~~~~~~~
Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
Upstream-Status: Inappropriate [OE specific build config fix, though filed as https://github.com/tianocore/edk2/issues/10910]
---
.../Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf b/EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf
index 285e880daab8..e1c986a6532d 100644
--- a/EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf
+++ b/EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf
@@ -34,4 +34,4 @@
# Current usage of this library expects GCC in a UNIX-like shell environment with the date command
[BuildOptions]
- GCC:*_*_*_CC_FLAGS = -DBUILD_EPOCH=`printenv SOURCE_DATE_EPOCH || date +%s`
+ GCC:*_*_*_CC_FLAGS = -DBUILD_EPOCH=${SOURCE_DATE_EPOCH}
@@ -1,4 +1,4 @@
From da0d96f0dc5fceafa34a7cc7d4d05f6f89336a87 Mon Sep 17 00:00:00 2001
From af134611c744322e1d159794c426fbdd02e151cc Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 7 Apr 2021 00:16:07 -0400
Subject: [PATCH] Enforce using good old BFD linker
@@ -25,15 +25,15 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 0caa1c90018f..0b62fdc9ee72 100755
index 90a389bdff07..93f7b5cde437 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -928,7 +928,7 @@ DEFINE GCC_ARM_CC_XIPFLAGS = -mno-unaligned-access
@@ -839,7 +839,7 @@ DEFINE GCC_LOONGARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mabi=lp64d -fno-asyn
DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char -ffunction-sections -fdata-sections -Wno-address -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-pic -fno-pie -ffixed-x18 -mstack-protector-guard=global
DEFINE GCC_AARCH64_CC_XIPFLAGS = -mstrict-align -mgeneral-regs-only
DEFINE GCC_RISCV64_CC_XIPFLAGS = -mstrict-align -mgeneral-regs-only
-DEFINE GCC_DLINK2_FLAGS_COMMON = -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
+DEFINE GCC_DLINK2_FLAGS_COMMON = -fuse-ld=bfd -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
DEFINE GCC_ARM_AARCH64_DLINK_COMMON= -Wl,--emit-relocs -nostdlib -Wl,--gc-sections -u $(IMAGE_ENTRY_POINT) -Wl,-e,$(IMAGE_ENTRY_POINT),-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map
DEFINE GCC_LOONGARCH64_DLINK_COMMON= -Wl,--emit-relocs -nostdlib -Wl,--gc-sections -u $(IMAGE_ENTRY_POINT) -Wl,-e,$(IMAGE_ENTRY_POINT),-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map
DEFINE GCC_ARM_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) -z common-page-size=0x20 -Wl,--pic-veneer
DEFINE GCC_AARCH64_DLINK_FLAGS = -Wl,--emit-relocs -nostdlib -Wl,--gc-sections -u $(IMAGE_ENTRY_POINT) -Wl,-e,$(IMAGE_ENTRY_POINT),-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map -z common-page-size=0x20
DEFINE GCC_LOONGARCH64_DLINK_FLAGS = DEF(GCC_LOONGARCH64_DLINK_COMMON) -z common-page-size=0x20
+1 -1
View File
@@ -1,4 +1,4 @@
require recipes-bsp/uefi/edk2-firmware_202508.bb
require recipes-bsp/uefi/edk2-firmware_202511.bb
PROVIDES:remove = "virtual/bootloader"
LICENSE += "& Apache-2.0"