From 796f5a422a1bb9059ca8045b5aa199aa02b0e46a Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Tue, 15 Jun 2021 10:12:17 +0200 Subject: ovmf: update 2021.02 -> 2021.05 Reformat patches using git, so that rebasing them to newer versions is easier. Signed-off-by: Alexander Kanavin Signed-off-by: Richard Purdie --- ...0001-ovmf-update-path-to-native-BaseTools.patch | 7 +- ...makefile-adjust-to-build-in-under-bitbake.patch | 11 +- .../ovmf/ovmf/0003-ovmf-Update-to-latest.patch | 45 ++++++ .../ovmf/ovmf/0004-Strip-build-paths.patch | 32 ++++ .../ovmf/ovmf/0004-ovmf-Update-to-latest.patch | 46 ------ .../ovmf/ovmf/0005-debug-prefix-map.patch | 104 ++++++++++++ .../recipes-core/ovmf/ovmf/0006-reproducible.patch | 180 +++++++++++++++++++++ meta/recipes-core/ovmf/ovmf/debug_prefix_map.patch | 93 ----------- meta/recipes-core/ovmf/ovmf/reproducible.patch | 165 ------------------- meta/recipes-core/ovmf/ovmf/zero.patch | 84 ---------- meta/recipes-core/ovmf/ovmf_git.bb | 12 +- 11 files changed, 375 insertions(+), 404 deletions(-) create mode 100644 meta/recipes-core/ovmf/ovmf/0003-ovmf-Update-to-latest.patch create mode 100644 meta/recipes-core/ovmf/ovmf/0004-Strip-build-paths.patch delete mode 100644 meta/recipes-core/ovmf/ovmf/0004-ovmf-Update-to-latest.patch create mode 100644 meta/recipes-core/ovmf/ovmf/0005-debug-prefix-map.patch create mode 100644 meta/recipes-core/ovmf/ovmf/0006-reproducible.patch delete mode 100644 meta/recipes-core/ovmf/ovmf/debug_prefix_map.patch delete mode 100644 meta/recipes-core/ovmf/ovmf/reproducible.patch delete mode 100644 meta/recipes-core/ovmf/ovmf/zero.patch diff --git a/meta/recipes-core/ovmf/ovmf/0001-ovmf-update-path-to-native-BaseTools.patch b/meta/recipes-core/ovmf/ovmf/0001-ovmf-update-path-to-native-BaseTools.patch index c32963a807..89d9ffab5e 100644 --- a/meta/recipes-core/ovmf/ovmf/0001-ovmf-update-path-to-native-BaseTools.patch +++ b/meta/recipes-core/ovmf/ovmf/0001-ovmf-update-path-to-native-BaseTools.patch @@ -1,7 +1,7 @@ -From 200ff35c6545b4ab85f5ea7a6096fbaec3d82f6d Mon Sep 17 00:00:00 2001 +From 1125f5a02c2f327aeffe2d6b66a9d816ad2eeec0 Mon Sep 17 00:00:00 2001 From: Ricardo Neri Date: Thu, 9 Jun 2016 02:23:01 -0700 -Subject: [PATCH 1/4] ovmf: update path to native BaseTools +Subject: [PATCH 1/6] ovmf: update path to native BaseTools BaseTools is a set of utilities to build EDK-based firmware. These utilities are used during the build process. Thus, they need to be built natively. @@ -11,7 +11,6 @@ with the appropriate location before building. Signed-off-by: Ricardo Neri Upstream-Status: Pending - --- OvmfPkg/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) @@ -30,5 +29,5 @@ index 91b1442ade..1858dae31a 100755 source edksetup.sh BaseTools else -- -2.28.0 +2.32.0 diff --git a/meta/recipes-core/ovmf/ovmf/0002-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch b/meta/recipes-core/ovmf/ovmf/0002-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch index c61a08f022..f6141c8af5 100644 --- a/meta/recipes-core/ovmf/ovmf/0002-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch +++ b/meta/recipes-core/ovmf/ovmf/0002-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch @@ -1,23 +1,22 @@ -From 667c0cf97dadc4f5994d26ec3984f559a05ec406 Mon Sep 17 00:00:00 2001 +From 19d4c7f9812062a683b3ba60b35aac0461190456 Mon Sep 17 00:00:00 2001 From: Ricardo Neri Date: Fri, 26 Jul 2019 17:34:26 -0400 -Subject: [PATCH 2/4] BaseTools: makefile: adjust to build in under bitbake +Subject: [PATCH 2/6] BaseTools: makefile: adjust to build in under bitbake Prepend the build flags with those of bitbake. This is to build using the bitbake native sysroot include and library directories. Signed-off-by: Ricardo Neri Upstream-Status: Pending - --- BaseTools/Source/C/Makefiles/header.makefile | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/BaseTools/Source/C/Makefiles/header.makefile b/BaseTools/Source/C/Makefiles/header.makefile -index 1c105ee7d4..d5eea3864e 100644 +index 0df728f327..1299d47c87 100644 --- a/BaseTools/Source/C/Makefiles/header.makefile +++ b/BaseTools/Source/C/Makefiles/header.makefile -@@ -69,35 +69,36 @@ $(error Bad HOST_ARCH) +@@ -75,35 +75,36 @@ $(error Bad HOST_ARCH) endif INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) -I $(MAKEROOT)/Include/Common -I $(MAKEROOT)/Include/ -I $(MAKEROOT)/Include/IndustryStandard -I $(MAKEROOT)/Common/ -I .. -I . $(ARCH_INCLUDE) @@ -63,5 +62,5 @@ index 1c105ee7d4..d5eea3864e 100644 # # Snow Leopard is a 32-bit and 64-bit environment. uname -m returns i386, but gcc defaults -- -2.28.0 +2.32.0 diff --git a/meta/recipes-core/ovmf/ovmf/0003-ovmf-Update-to-latest.patch b/meta/recipes-core/ovmf/ovmf/0003-ovmf-Update-to-latest.patch new file mode 100644 index 0000000000..d710429899 --- /dev/null +++ b/meta/recipes-core/ovmf/ovmf/0003-ovmf-Update-to-latest.patch @@ -0,0 +1,45 @@ +From 67267d8cc31df16a3608cad1a17c5f1470ef8bbd Mon Sep 17 00:00:00 2001 +From: Steve Langasek +Date: Sat, 10 Jun 2017 01:39:36 -0700 +Subject: [PATCH 3/6] ovmf: Update to latest + +Description: pass -fno-stack-protector to all GCC toolchains + The upstream build rules inexplicably pass -fno-stack-protector only + when building for i386 and amd64. Add this essential argument to the + generic rules for gcc 4.4 and later. +Last-Updated: 2016-04-12 +Upstream-Status: Pending +--- + BaseTools/Conf/tools_def.template | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template +index 498696e583..36241b6ede 100755 +--- a/BaseTools/Conf/tools_def.template ++++ b/BaseTools/Conf/tools_def.template +@@ -1897,10 +1897,10 @@ DEFINE GCC_RISCV64_RC_FLAGS = -I binary -O elf64-littleriscv -B riscv + # GCC Build Flag for included header file list generation + DEFINE GCC_DEPS_FLAGS = -MMD -MF $@.deps + +-DEFINE GCC48_ALL_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -ffunction-sections -fdata-sections -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings ++DEFINE GCC48_ALL_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -ffunction-sections -fdata-sections -fno-stack-protector -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings + DEFINE GCC48_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x20 +-DEFINE GCC48_IA32_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m32 -march=i586 -malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-unwind-tables -Wno-address +-DEFINE GCC48_X64_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m64 -fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables -Wno-address ++DEFINE GCC48_IA32_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m32 -march=i586 -malign-double -D EFI32 -fno-asynchronous-unwind-tables -Wno-address ++DEFINE GCC48_X64_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables -Wno-address + DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_COMMON) -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable + DEFINE GCC48_IA32_X64_DLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive + DEFINE GCC48_IA32_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x220 DEF(GCC_DLINK2_FLAGS_COMMON) +@@ -1909,7 +1909,7 @@ DEFINE GCC48_X64_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x228 DEF + DEFINE GCC48_ASM_FLAGS = DEF(GCC_ASM_FLAGS) + DEFINE GCC48_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ASM_FLAGS) -mlittle-endian + DEFINE GCC48_AARCH64_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ASM_FLAGS) -mlittle-endian +-DEFINE GCC48_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARM_CC_FLAGS) -fstack-protector -mword-relocations ++DEFINE GCC48_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARM_CC_FLAGS) -mword-relocations + DEFINE GCC48_ARM_CC_XIPFLAGS = DEF(GCC_ARM_CC_XIPFLAGS) + DEFINE GCC48_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mcmodel=large DEF(GCC_AARCH64_CC_FLAGS) + DEFINE GCC48_AARCH64_CC_XIPFLAGS = DEF(GCC_AARCH64_CC_XIPFLAGS) +-- +2.32.0 + diff --git a/meta/recipes-core/ovmf/ovmf/0004-Strip-build-paths.patch b/meta/recipes-core/ovmf/ovmf/0004-Strip-build-paths.patch new file mode 100644 index 0000000000..dfb8a73398 --- /dev/null +++ b/meta/recipes-core/ovmf/ovmf/0004-Strip-build-paths.patch @@ -0,0 +1,32 @@ +From b7cfe97895e0586d14403ba98e62a0cd9373da96 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin +Date: Mon, 14 Jun 2021 19:55:08 +0200 +Subject: [PATCH 4/6] Strip build paths + +Pass --zero to GenFw in release builds so that the sections that link back to +the intermediate binaries (containing build paths) are removed. + +Upstream-Status: Pending (discussion at https://bugzilla.tianocore.org/show_bug.cgi?id=3256) +Signed-off-by: Ross Burton + +Signed-off-by: Alexander Kanavin +--- + OvmfPkg/OvmfPkgIa32.dsc | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc +index 33fbd76790..06c6d5ce60 100644 +--- a/OvmfPkg/OvmfPkgIa32.dsc ++++ b/OvmfPkg/OvmfPkgIa32.dsc +@@ -91,6 +91,8 @@ + + !include NetworkPkg/NetworkBuildOptions.dsc.inc + ++ RELEASE_*_*_GENFW_FLAGS = --zero ++ + [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER] + GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000 + XCODE:*_*_*_DLINK_FLAGS = -seg1addr 0x1000 -segalign 0x1000 +-- +2.32.0 + diff --git a/meta/recipes-core/ovmf/ovmf/0004-ovmf-Update-to-latest.patch b/meta/recipes-core/ovmf/ovmf/0004-ovmf-Update-to-latest.patch deleted file mode 100644 index 128438b201..0000000000 --- a/meta/recipes-core/ovmf/ovmf/0004-ovmf-Update-to-latest.patch +++ /dev/null @@ -1,46 +0,0 @@ -From ad06fcf1e08736e79221cd6863ff2e3c9254f261 Mon Sep 17 00:00:00 2001 -From: Steve Langasek -Date: Sat, 10 Jun 2017 01:39:36 -0700 -Subject: [PATCH 4/4] ovmf: Update to latest - -Description: pass -fno-stack-protector to all GCC toolchains - The upstream build rules inexplicably pass -fno-stack-protector only - when building for i386 and amd64. Add this essential argument to the - generic rules for gcc 4.4 and later. -Last-Updated: 2016-04-12 -Upstream-Status: Pending - ---- - BaseTools/Conf/tools_def.template | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template -index 933b3160fd..c2fbbf0c38 100755 ---- a/BaseTools/Conf/tools_def.template -+++ b/BaseTools/Conf/tools_def.template -@@ -1952,10 +1952,10 @@ DEFINE GCC_RISCV64_RC_FLAGS = -I binary -O elf64-littleriscv -B riscv - # GCC Build Flag for included header file list generation - DEFINE GCC_DEPS_FLAGS = -MMD -MF $@.deps - --DEFINE GCC48_ALL_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -ffunction-sections -fdata-sections -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings -+DEFINE GCC48_ALL_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -ffunction-sections -fdata-sections -fno-stack-protector -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings - DEFINE GCC48_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x20 --DEFINE GCC48_IA32_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m32 -march=i586 -malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-unwind-tables -Wno-address --DEFINE GCC48_X64_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m64 -fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables -Wno-address -+DEFINE GCC48_IA32_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m32 -march=i586 -malign-double -D EFI32 -fno-asynchronous-unwind-tables -Wno-address -+DEFINE GCC48_X64_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables -Wno-address - DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_COMMON) -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable - DEFINE GCC48_IA32_X64_DLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive - DEFINE GCC48_IA32_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x220 DEF(GCC_DLINK2_FLAGS_COMMON) -@@ -1964,7 +1964,7 @@ DEFINE GCC48_X64_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x228 DEF - DEFINE GCC48_ASM_FLAGS = DEF(GCC_ASM_FLAGS) - DEFINE GCC48_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ASM_FLAGS) -mlittle-endian - DEFINE GCC48_AARCH64_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ASM_FLAGS) -mlittle-endian --DEFINE GCC48_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARM_CC_FLAGS) -fstack-protector -mword-relocations -+DEFINE GCC48_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARM_CC_FLAGS) -mword-relocations - DEFINE GCC48_ARM_CC_XIPFLAGS = DEF(GCC_ARM_CC_XIPFLAGS) - DEFINE GCC48_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mcmodel=large DEF(GCC_AARCH64_CC_FLAGS) - DEFINE GCC48_AARCH64_CC_XIPFLAGS = DEF(GCC_AARCH64_CC_XIPFLAGS) --- -2.28.0 - diff --git a/meta/recipes-core/ovmf/ovmf/0005-debug-prefix-map.patch b/meta/recipes-core/ovmf/ovmf/0005-debug-prefix-map.patch new file mode 100644 index 0000000000..e467d6f152 --- /dev/null +++ b/meta/recipes-core/ovmf/ovmf/0005-debug-prefix-map.patch @@ -0,0 +1,104 @@ +From 860bb1979f3578bb83257076fe0f3bd33f9d68bf Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin +Date: Mon, 14 Jun 2021 19:56:28 +0200 +Subject: [PATCH 5/6] debug prefix map + +We want to pass ${DEBUG_PREFIX_MAP} to gcc commands and also pass in + --debug-prefix-map to nasm (we carry a patch to nasm for this). The +tools definitions file is built by ovmf-native so we need to pass this in +at target build time when we know the right values so we use the environment. + +By using determininistc file paths during the ovmf build, it removes the +opportunitity for gcc/ld to change the output binaries due to path lengths +overflowing section sizes and causing small changes in the binary output. +Previously we relied on the stripped output being the same which isn't always +the case if the size of the debug symbols varies. + +Upstream-Status: Pending [gcc parts may be upstreamable, nasm patch isn't upstream yet] +Signed-off-by: Richard Purdie +Signed-off-by: Alexander Kanavin +--- + BaseTools/Conf/tools_def.template | 18 +++++++++--------- + 1 file changed, 9 insertions(+), 9 deletions(-) + +diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template +index 36241b6ede..947fbf2e8d 100755 +--- a/BaseTools/Conf/tools_def.template ++++ b/BaseTools/Conf/tools_def.template +@@ -1863,7 +1863,7 @@ NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG = --add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_N + *_*_*_DTCPP_PATH = DEF(DTCPP_BIN) + *_*_*_DTC_PATH = DEF(DTC_BIN) + +-DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common ++DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common ENV(GCC_PREFIX_MAP) + DEFINE GCC_IA32_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe + DEFINE GCC_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-address -mno-stack-arg-probe + DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -mabi=aapcs -fno-short-enums -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft -fno-pic -fno-pie +@@ -1881,8 +1881,8 @@ DEFINE GCC_IA32_X64_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry _Ref + DEFINE GCC_ARM_ASLDLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) -Wl,--entry,ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT) DEF(GCC_ARM_AARCH64_ASLDLINK_FLAGS) + DEFINE GCC_AARCH64_ASLDLINK_FLAGS = DEF(GCC_AARCH64_DLINK_FLAGS) -Wl,--entry,ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT) DEF(GCC_ARM_AARCH64_ASLDLINK_FLAGS) + DEFINE GCC_IA32_X64_DLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry _$(IMAGE_ENTRY_POINT) --file-alignment 0x20 --section-alignment 0x20 -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map +-DEFINE GCC_ASM_FLAGS = -c -x assembler -imacros AutoGen.h +-DEFINE GCC_PP_FLAGS = -E -x assembler-with-cpp -include AutoGen.h ++DEFINE GCC_ASM_FLAGS = -c -x assembler -imacros AutoGen.h ENV(GCC_PREFIX_MAP) ++DEFINE GCC_PP_FLAGS = -E -x assembler-with-cpp -include AutoGen.h ENV(GCC_PREFIX_MAP) + DEFINE GCC_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE --include $(MODULE_NAME)StrDefs.h + DEFINE GCC_ASLPP_FLAGS = -x c -E -include AutoGen.h + DEFINE GCC_ASLCC_FLAGS = -x c +@@ -2027,7 +2027,7 @@ DEFINE GCC_PP_FLAGS = -E -x assembler-with-cpp -include A + *_GCC48_IA32_DLINK2_FLAGS = DEF(GCC48_IA32_DLINK2_FLAGS) + *_GCC48_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS) + *_GCC48_IA32_OBJCOPY_FLAGS = +-*_GCC48_IA32_NASM_FLAGS = -f elf32 ++*_GCC48_IA32_NASM_FLAGS = -f elf32 ENV(NASM_PREFIX_MAP) + + DEBUG_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os + RELEASE_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable +@@ -2055,7 +2055,7 @@ RELEASE_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os -Wno-unused-but + *_GCC48_X64_DLINK2_FLAGS = DEF(GCC48_X64_DLINK2_FLAGS) + *_GCC48_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS) + *_GCC48_X64_OBJCOPY_FLAGS = +-*_GCC48_X64_NASM_FLAGS = -f elf64 ++*_GCC48_X64_NASM_FLAGS = -f elf64 ENV(NASM_PREFIX_MAP) + + DEBUG_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) -Os + RELEASE_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) -Os -Wno-unused-but-set-variable +@@ -2167,7 +2167,7 @@ RELEASE_GCC48_AARCH64_CC_FLAGS = DEF(GCC48_AARCH64_CC_FLAGS) -Wno-unused-but-s + *_GCC49_IA32_DLINK2_FLAGS = DEF(GCC49_IA32_DLINK2_FLAGS) + *_GCC49_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS) + *_GCC49_IA32_OBJCOPY_FLAGS = +-*_GCC49_IA32_NASM_FLAGS = -f elf32 ++*_GCC49_IA32_NASM_FLAGS = -f elf32 ENV(NASM_PREFIX_MAP) + + DEBUG_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os + RELEASE_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable -Wno-unused-const-variable +@@ -2195,7 +2195,7 @@ RELEASE_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os -Wno-unused-but + *_GCC49_X64_DLINK2_FLAGS = DEF(GCC49_X64_DLINK2_FLAGS) + *_GCC49_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS) + *_GCC49_X64_OBJCOPY_FLAGS = +-*_GCC49_X64_NASM_FLAGS = -f elf64 ++*_GCC49_X64_NASM_FLAGS = -f elf64 ENV(NASM_PREFIX_MAP) + + DEBUG_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -Os + RELEASE_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -Os -Wno-unused-but-set-variable -Wno-unused-const-variable +@@ -2313,7 +2313,7 @@ RELEASE_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20 + *_GCC5_IA32_DLINK2_FLAGS = DEF(GCC5_IA32_DLINK2_FLAGS) -no-pie + *_GCC5_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS) + *_GCC5_IA32_OBJCOPY_FLAGS = +-*_GCC5_IA32_NASM_FLAGS = -f elf32 ++*_GCC5_IA32_NASM_FLAGS = -f elf32 ENV(NASM_PREFIX_MAP) + + DEBUG_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -flto -Os + DEBUG_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Os -Wl,-m,elf_i386,--oformat=elf32-i386 +@@ -2345,7 +2345,7 @@ RELEASE_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Os -Wl, + *_GCC5_X64_DLINK2_FLAGS = DEF(GCC5_X64_DLINK2_FLAGS) + *_GCC5_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS) + *_GCC5_X64_OBJCOPY_FLAGS = +-*_GCC5_X64_NASM_FLAGS = -f elf64 ++*_GCC5_X64_NASM_FLAGS = -f elf64 ENV(NASM_PREFIX_MAP) + + DEBUG_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -flto -DUSING_LTO -Os + DEBUG_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -flto -Os +-- +2.32.0 + diff --git a/meta/recipes-core/ovmf/ovmf/0006-reproducible.patch b/meta/recipes-core/ovmf/ovmf/0006-reproducible.patch new file mode 100644 index 0000000000..343c21b541 --- /dev/null +++ b/meta/recipes-core/ovmf/ovmf/0006-reproducible.patch @@ -0,0 +1,180 @@ +From 27ed9962f5cb3afcc44d6c96c53277132a999712 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin +Date: Mon, 14 Jun 2021 19:57:30 +0200 +Subject: [PATCH 6/6] reproducible + +This patch fixes various things which make the build more reproducible. Some changes +here only change intermediate artefacts but that means when you have two build trees +giving differing results, the differences can be isolated more easily. The issues here +usually become apparent with longer paths. + +This was all debugged with: +TMPDIR = "${TOPDIR}/tmp" +vs. +TMPDIR = "${TOPDIR}/tmp-inital-mylongpath-mylongpath-mylongpath-mylongpath-mylongpath-mylongpath-mylongpath-mylongpath-mylongpath" + +The patch specifically: + + * Sorts output in GNUmakefile + * Always generates indirect flags files used to avoid pathlength issues else the + compile commands suddenly change when using longer paths + * Sorts the AutoGenTimeStamp file contents + * Makes the TargetDescBlock objects from BuildEngine sortable to allow the makefile fix + * Fix ElfConvert within GenFw so that only the basename of the binary being converted + is used, else the output from "GenFw XXX.bin" differs from "GenFw /long/path/XXX.bin" + with sufficiently long paths + +Upstream-Status: Pending [At least some of this might be interesting to upstream] +Signed-off-by: Richard Purdie +Signed-off-by: Alexander Kanavin +--- + BaseTools/Source/C/GenFw/Elf64Convert.c | 8 ++++--- + .../Source/Python/AutoGen/BuildEngine.py | 3 +++ + BaseTools/Source/Python/AutoGen/GenMake.py | 24 +++++++++---------- + .../Source/Python/AutoGen/ModuleAutoGen.py | 5 +++- + 4 files changed, 24 insertions(+), 16 deletions(-) + +diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c b/BaseTools/Source/C/GenFw/Elf64Convert.c +index d097db8632..a87ae6f3d0 100644 +--- a/BaseTools/Source/C/GenFw/Elf64Convert.c ++++ b/BaseTools/Source/C/GenFw/Elf64Convert.c +@@ -14,6 +14,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent + #ifndef __GNUC__ + #include + #include ++#else ++#define _GNU_SOURCE + #endif + #include + #include +@@ -769,7 +771,7 @@ ScanSections64 ( + } + mCoffOffset = mDebugOffset + sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY) + + sizeof(EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY) + +- strlen(mInImageName) + 1; ++ strlen(basename(mInImageName)) + 1; + + mCoffOffset = CoffAlign(mCoffOffset); + if (SectionCount == 0) { +@@ -1608,7 +1610,7 @@ WriteDebug64 ( + EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *Dir; + EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY *Nb10; + +- Len = strlen(mInImageName) + 1; ++ Len = strlen(basename(mInImageName)) + 1; + + Dir = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY*)(mCoffFile + mDebugOffset); + Dir->Type = EFI_IMAGE_DEBUG_TYPE_CODEVIEW; +@@ -1618,7 +1620,7 @@ WriteDebug64 ( + + Nb10 = (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY*)(Dir + 1); + Nb10->Signature = CODEVIEW_SIGNATURE_NB10; +- strcpy ((char *)(Nb10 + 1), mInImageName); ++ strcpy ((char *)(Nb10 + 1), basename(mInImageName)); + + + NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(mCoffFile + mNtHdrOffset); +diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py b/BaseTools/Source/Python/AutoGen/BuildEngine.py +index 722fead75a..8f1c236970 100644 +--- a/BaseTools/Source/Python/AutoGen/BuildEngine.py ++++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py +@@ -70,6 +70,9 @@ class TargetDescBlock(object): + else: + return str(Other) == self.Target.Path + ++ def __lt__(self, other): ++ return str(self) < str(other) ++ + def AddInput(self, Input): + if Input not in self.Inputs: + self.Inputs.append(Input) +diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py +index 961b2ab1c3..23c1592025 100755 +--- a/BaseTools/Source/Python/AutoGen/GenMake.py ++++ b/BaseTools/Source/Python/AutoGen/GenMake.py +@@ -575,7 +575,7 @@ cleanlib: + os.remove(RespFileList) + + # convert source files and binary files to build targets +- self.ResultFileList = [str(T.Target) for T in MyAgo.CodaTargetList] ++ self.ResultFileList = sorted([str(T.Target) for T in MyAgo.CodaTargetList]) + if len(self.ResultFileList) == 0 and len(MyAgo.SourceFileList) != 0: + EdkLogger.error("build", AUTOGEN_ERROR, "Nothing to build", + ExtraData="[%s]" % str(MyAgo)) +@@ -726,7 +726,7 @@ cleanlib: + OutputFile = '' + DepsFileList = [] + +- for Cmd in self.GenFfsList: ++ for Cmd in sorted(self.GenFfsList): + if Cmd[2]: + for CopyCmd in Cmd[2]: + Src, Dst = CopyCmd +@@ -759,7 +759,7 @@ cleanlib: + self.BuildTargetList.append('\t%s' % CmdString) + + self.ParseSecCmd(DepsFileList, Cmd[1]) +- for SecOutputFile, SecDepsFile, SecCmd in self.FfsOutputFileList : ++ for SecOutputFile, SecDepsFile, SecCmd in sorted(self.FfsOutputFileList): + self.BuildTargetList.append('%s : %s' % (self.ReplaceMacro(SecOutputFile), self.ReplaceMacro(SecDepsFile))) + self.BuildTargetList.append('\t%s' % self.ReplaceMacro(SecCmd)) + self.FfsOutputFileList = [] +@@ -798,13 +798,13 @@ cleanlib: + + def CommandExceedLimit(self): + FlagDict = { +- 'CC' : { 'Macro' : '$(CC_FLAGS)', 'Value' : False}, +- 'PP' : { 'Macro' : '$(PP_FLAGS)', 'Value' : False}, +- 'APP' : { 'Macro' : '$(APP_FLAGS)', 'Value' : False}, +- 'ASLPP' : { 'Macro' : '$(ASLPP_FLAGS)', 'Value' : False}, +- 'VFRPP' : { 'Macro' : '$(VFRPP_FLAGS)', 'Value' : False}, +- 'ASM' : { 'Macro' : '$(ASM_FLAGS)', 'Value' : False}, +- 'ASLCC' : { 'Macro' : '$(ASLCC_FLAGS)', 'Value' : False}, ++ 'CC' : { 'Macro' : '$(CC_FLAGS)', 'Value' : True}, ++ 'PP' : { 'Macro' : '$(PP_FLAGS)', 'Value' : True}, ++ 'APP' : { 'Macro' : '$(APP_FLAGS)', 'Value' : True}, ++ 'ASLPP' : { 'Macro' : '$(ASLPP_FLAGS)', 'Value' : True}, ++ 'VFRPP' : { 'Macro' : '$(VFRPP_FLAGS)', 'Value' : True}, ++ 'ASM' : { 'Macro' : '$(ASM_FLAGS)', 'Value' : True}, ++ 'ASLCC' : { 'Macro' : '$(ASLCC_FLAGS)', 'Value' : True}, + } + + RespDict = {} +@@ -1007,9 +1007,9 @@ cleanlib: + if not self.ObjTargetDict.get(T.Target.SubDir): + self.ObjTargetDict[T.Target.SubDir] = set() + self.ObjTargetDict[T.Target.SubDir].add(NewFile) +- for Type in self._AutoGenObject.Targets: ++ for Type in sorted(self._AutoGenObject.Targets): + resp_file_number = 0 +- for T in self._AutoGenObject.Targets[Type]: ++ for T in sorted(self._AutoGenObject.Targets[Type]): + # Generate related macros if needed + if T.GenFileListMacro and T.FileListMacro not in self.FileListMacros: + self.FileListMacros[T.FileListMacro] = [] +diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py +index d70b0d7ae8..25dca9a6df 100755 +--- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py ++++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py +@@ -1484,6 +1484,9 @@ class ModuleAutoGen(AutoGen): + for File in Files: + if File.lower().endswith('.pdb'): + AsBuiltInfDict['binary_item'].append('DISPOSABLE|' + File) ++ ++ AsBuiltInfDict['binary_item'] = sorted(AsBuiltInfDict['binary_item']) ++ + HeaderComments = self.Module.HeaderComments + StartPos = 0 + for Index in range(len(HeaderComments)): +@@ -1759,7 +1762,7 @@ class ModuleAutoGen(AutoGen): + if os.path.exists (self.TimeStampPath): + os.remove (self.TimeStampPath) + +- SaveFileOnChange(self.TimeStampPath, "\n".join(FileSet), False) ++ SaveFileOnChange(self.TimeStampPath, "\n".join(sorted(FileSet)), False) + + # Ignore generating makefile when it is a binary module + if self.IsBinaryModule: +-- +2.32.0 + diff --git a/meta/recipes-core/ovmf/ovmf/debug_prefix_map.patch b/meta/recipes-core/ovmf/ovmf/debug_prefix_map.patch deleted file mode 100644 index 0165fae7ce..0000000000 --- a/meta/recipes-core/ovmf/ovmf/debug_prefix_map.patch +++ /dev/null @@ -1,93 +0,0 @@ -We want to pass ${DEBUG_PREFIX_MAP} to gcc commands and also pass in - --debug-prefix-map to nasm (we carry a patch to nasm for this). The -tools definitions file is built by ovmf-native so we need to pass this in -at target build time when we know the right values so we use the environment. - -By using determininistc file paths during the ovmf build, it removes the -opportunitity for gcc/ld to change the output binaries due to path lengths -overflowing section sizes and causing small changes in the binary output. -Previously we relied on the stripped output being the same which isn't always -the case if the size of the debug symbols varies. - -Upstream-Status: Pending [gcc parts may be upstreamable, nasm patch isn't upstream yet] -Signed-off-by: Richard Purdie - - -Index: git/BaseTools/Conf/tools_def.template -=================================================================== ---- git.orig/BaseTools/Conf/tools_def.template -+++ git/BaseTools/Conf/tools_def.template -@@ -1918,7 +1918,7 @@ NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG = --a - *_*_*_DTCPP_PATH = DEF(DTCPP_BIN) - *_*_*_DTC_PATH = DEF(DTC_BIN) - --DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common -+DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common ENV(GCC_PREFIX_MAP) - DEFINE GCC_IA32_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe - DEFINE GCC_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-address -mno-stack-arg-probe - DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -mabi=aapcs -fno-short-enums -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft -fno-pic -fno-pie -@@ -1936,8 +1936,8 @@ DEFINE GCC_IA32_X64_ASLDLINK_FLAGS = -fu - DEFINE GCC_ARM_ASLDLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) -Wl,--entry,ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT) DEF(GCC_ARM_AARCH64_ASLDLINK_FLAGS) - DEFINE GCC_AARCH64_ASLDLINK_FLAGS = DEF(GCC_AARCH64_DLINK_FLAGS) -Wl,--entry,ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT) DEF(GCC_ARM_AARCH64_ASLDLINK_FLAGS) - DEFINE GCC_IA32_X64_DLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry _$(IMAGE_ENTRY_POINT) --file-alignment 0x20 --section-alignment 0x20 -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map --DEFINE GCC_ASM_FLAGS = -c -x assembler -imacros AutoGen.h --DEFINE GCC_PP_FLAGS = -E -x assembler-with-cpp -include AutoGen.h -+DEFINE GCC_ASM_FLAGS = -c -x assembler -imacros AutoGen.h ENV(GCC_PREFIX_MAP) -+DEFINE GCC_PP_FLAGS = -E -x assembler-with-cpp -include AutoGen.h ENV(GCC_PREFIX_MAP) - DEFINE GCC_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE --include $(MODULE_NAME)StrDefs.h - DEFINE GCC_ASLPP_FLAGS = -x c -E -include AutoGen.h - DEFINE GCC_ASLCC_FLAGS = -x c -@@ -2082,7 +2082,7 @@ DEFINE GCC_PP_FLAGS - *_GCC48_IA32_DLINK2_FLAGS = DEF(GCC48_IA32_DLINK2_FLAGS) - *_GCC48_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS) - *_GCC48_IA32_OBJCOPY_FLAGS = --*_GCC48_IA32_NASM_FLAGS = -f elf32 -+*_GCC48_IA32_NASM_FLAGS = -f elf32 ENV(NASM_PREFIX_MAP) - - DEBUG_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os - RELEASE_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable -@@ -2110,7 +2110,7 @@ RELEASE_GCC48_IA32_CC_FLAGS = DEF( - *_GCC48_X64_DLINK2_FLAGS = DEF(GCC48_X64_DLINK2_FLAGS) - *_GCC48_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS) - *_GCC48_X64_OBJCOPY_FLAGS = --*_GCC48_X64_NASM_FLAGS = -f elf64 -+*_GCC48_X64_NASM_FLAGS = -f elf64 ENV(NASM_PREFIX_MAP) - - DEBUG_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) -Os - RELEASE_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) -Os -Wno-unused-but-set-variable -@@ -2222,7 +2222,7 @@ RELEASE_GCC48_AARCH64_CC_FLAGS = DEF(G - *_GCC49_IA32_DLINK2_FLAGS = DEF(GCC49_IA32_DLINK2_FLAGS) - *_GCC49_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS) - *_GCC49_IA32_OBJCOPY_FLAGS = --*_GCC49_IA32_NASM_FLAGS = -f elf32 -+*_GCC49_IA32_NASM_FLAGS = -f elf32 ENV(NASM_PREFIX_MAP) - - DEBUG_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os - RELEASE_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable -Wno-unused-const-variable -@@ -2250,7 +2250,7 @@ RELEASE_GCC49_IA32_CC_FLAGS = DEF( - *_GCC49_X64_DLINK2_FLAGS = DEF(GCC49_X64_DLINK2_FLAGS) - *_GCC49_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS) - *_GCC49_X64_OBJCOPY_FLAGS = --*_GCC49_X64_NASM_FLAGS = -f elf64 -+*_GCC49_X64_NASM_FLAGS = -f elf64 ENV(NASM_PREFIX_MAP) - - DEBUG_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -Os - RELEASE_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -Os -Wno-unused-but-set-variable -Wno-unused-const-variable -@@ -2368,7 +2368,7 @@ RELEASE_GCC49_AARCH64_DLINK_XIPFLAGS = - - *_GCC5_IA32_DLINK2_FLAGS = DEF(GCC5_IA32_DLINK2_FLAGS) -no-pie - *_GCC5_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS) - *_GCC5_IA32_OBJCOPY_FLAGS = --*_GCC5_IA32_NASM_FLAGS = -f elf32 -+*_GCC5_IA32_NASM_FLAGS = -f elf32 ENV(NASM_PREFIX_MAP) - - DEBUG_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -flto -Os - DEBUG_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Os -Wl,-m,elf_i386,--oformat=elf32-i386 -@@ -2400,7 +2400,7 @@ RELEASE_GCC5_IA32_DLINK_FLAGS = DEF(G - *_GCC5_X64_DLINK2_FLAGS = DEF(GCC5_X64_DLINK2_FLAGS) - *_GCC5_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS) - *_GCC5_X64_OBJCOPY_FLAGS = --*_GCC5_X64_NASM_FLAGS = -f elf64 -+*_GCC5_X64_NASM_FLAGS = -f elf64 ENV(NASM_PREFIX_MAP) - - DEBUG_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -flto -DUSING_LTO -Os - DEBUG_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -flto -Os diff --git a/meta/recipes-core/ovmf/ovmf/reproducible.patch b/meta/recipes-core/ovmf/ovmf/reproducible.patch deleted file mode 100644 index 5d2aeaacfe..0000000000 --- a/meta/recipes-core/ovmf/ovmf/reproducible.patch +++ /dev/null @@ -1,165 +0,0 @@ -This patch fixes various things which make the build more reproducible. Some changes -here only change intermediate artefacts but that means when you have two build trees -giving differing results, the differences can be isolated more easily. The issues here -usually become apparent with longer paths. - -This was all debugged with: -TMPDIR = "${TOPDIR}/tmp" -vs. -TMPDIR = "${TOPDIR}/tmp-inital-mylongpath-mylongpath-mylongpath-mylongpath-mylongpath-mylongpath-mylongpath-mylongpath-mylongpath" - -The patch specifically: - - * Sorts output in GNUmakefile - * Always generates indirect flags files used to avoid pathlength issues else the - compile commands suddenly change when using longer paths - * Sorts the AutoGenTimeStamp file contents - * Makes the TargetDescBlock objects from BuildEngine sortable to allow the makefile fix - * Fix ElfConvert within GenFw so that only the basename of the binary being converted - is used, else the output from "GenFw XXX.bin" differs from "GenFw /long/path/XXX.bin" - with sufficiently long paths - -Upstream-Status: Pending [At least some of this might be interesting to upstream] -Signed-off-by: Richard Purdie - -Index: git/BaseTools/Source/Python/AutoGen/GenMake.py -=================================================================== ---- git.orig/BaseTools/Source/Python/AutoGen/GenMake.py -+++ git/BaseTools/Source/Python/AutoGen/GenMake.py -@@ -571,7 +571,7 @@ cleanlib: - os.remove(RespFileList) - - # convert source files and binary files to build targets -- self.ResultFileList = [str(T.Target) for T in MyAgo.CodaTargetList] -+ self.ResultFileList = sorted([str(T.Target) for T in MyAgo.CodaTargetList]) - if len(self.ResultFileList) == 0 and len(MyAgo.SourceFileList) != 0: - EdkLogger.error("build", AUTOGEN_ERROR, "Nothing to build", - ExtraData="[%s]" % str(MyAgo)) -@@ -722,7 +722,7 @@ cleanlib: - OutputFile = '' - DepsFileList = [] - -- for Cmd in self.GenFfsList: -+ for Cmd in sorted(self.GenFfsList): - if Cmd[2]: - for CopyCmd in Cmd[2]: - Src, Dst = CopyCmd -@@ -755,7 +755,7 @@ cleanlib: - self.BuildTargetList.append('\t%s' % CmdString) - - self.ParseSecCmd(DepsFileList, Cmd[1]) -- for SecOutputFile, SecDepsFile, SecCmd in self.FfsOutputFileList : -+ for SecOutputFile, SecDepsFile, SecCmd in sorted(self.FfsOutputFileList): - self.BuildTargetList.append('%s : %s' % (self.ReplaceMacro(SecOutputFile), self.ReplaceMacro(SecDepsFile))) - self.BuildTargetList.append('\t%s' % self.ReplaceMacro(SecCmd)) - self.FfsOutputFileList = [] -@@ -794,13 +794,13 @@ cleanlib: - - def CommandExceedLimit(self): - FlagDict = { -- 'CC' : { 'Macro' : '$(CC_FLAGS)', 'Value' : False}, -- 'PP' : { 'Macro' : '$(PP_FLAGS)', 'Value' : False}, -- 'APP' : { 'Macro' : '$(APP_FLAGS)', 'Value' : False}, -- 'ASLPP' : { 'Macro' : '$(ASLPP_FLAGS)', 'Value' : False}, -- 'VFRPP' : { 'Macro' : '$(VFRPP_FLAGS)', 'Value' : False}, -- 'ASM' : { 'Macro' : '$(ASM_FLAGS)', 'Value' : False}, -- 'ASLCC' : { 'Macro' : '$(ASLCC_FLAGS)', 'Value' : False}, -+ 'CC' : { 'Macro' : '$(CC_FLAGS)', 'Value' : True}, -+ 'PP' : { 'Macro' : '$(PP_FLAGS)', 'Value' : True}, -+ 'APP' : { 'Macro' : '$(APP_FLAGS)', 'Value' : True}, -+ 'ASLPP' : { 'Macro' : '$(ASLPP_FLAGS)', 'Value' : True}, -+ 'VFRPP' : { 'Macro' : '$(VFRPP_FLAGS)', 'Value' : True}, -+ 'ASM' : { 'Macro' : '$(ASM_FLAGS)', 'Value' : True}, -+ 'ASLCC' : { 'Macro' : '$(ASLCC_FLAGS)', 'Value' : True}, - } - - RespDict = {} -@@ -1003,9 +1003,9 @@ cleanlib: - if not self.ObjTargetDict.get(T.Target.SubDir): - self.ObjTargetDict[T.Target.SubDir] = set() - self.ObjTargetDict[T.Target.SubDir].add(NewFile) -- for Type in self._AutoGenObject.Targets: -+ for Type in sorted(self._AutoGenObject.Targets): - resp_file_number = 0 -- for T in self._AutoGenObject.Targets[Type]: -+ for T in sorted(self._AutoGenObject.Targets[Type]): - # Generate related macros if needed - if T.GenFileListMacro and T.FileListMacro not in self.FileListMacros: - self.FileListMacros[T.FileListMacro] = [] -Index: git/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py -=================================================================== ---- git.orig/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py -+++ git/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py -@@ -1484,6 +1484,9 @@ class ModuleAutoGen(AutoGen): - for File in Files: - if File.lower().endswith('.pdb'): - AsBuiltInfDict['binary_item'].append('DISPOSABLE|' + File) -+ -+ AsBuiltInfDict['binary_item'] = sorted(AsBuiltInfDict['binary_item']) -+ - HeaderComments = self.Module.HeaderComments - StartPos = 0 - for Index in range(len(HeaderComments)): -@@ -1759,7 +1762,7 @@ class ModuleAutoGen(AutoGen): - if os.path.exists (self.TimeStampPath): - os.remove (self.TimeStampPath) - -- SaveFileOnChange(self.TimeStampPath, "\n".join(FileSet), False) -+ SaveFileOnChange(self.TimeStampPath, "\n".join(sorted(FileSet)), False) - - # Ignore generating makefile when it is a binary module - if self.IsBinaryModule: -Index: git/BaseTools/Source/Python/AutoGen/BuildEngine.py -=================================================================== ---- git.orig/BaseTools/Source/Python/AutoGen/BuildEngine.py -+++ git/BaseTools/Source/Python/AutoGen/BuildEngine.py -@@ -70,6 +70,9 @@ class TargetDescBlock(object): - else: - return str(Other) == self.Target.Path - -+ def __lt__(self, other): -+ return str(self) < str(other) -+ - def AddInput(self, Input): - if Input not in self.Inputs: - self.Inputs.append(Input) -Index: git/BaseTools/Source/C/GenFw/Elf64Convert.c -=================================================================== ---- git.orig/BaseTools/Source/C/GenFw/Elf64Convert.c -+++ git/BaseTools/Source/C/GenFw/Elf64Convert.c -@@ -14,6 +14,8 @@ SPDX-License-Identifier: BSD-2-Clause-Pa - #ifndef __GNUC__ - #include - #include -+#else -+#define _GNU_SOURCE - #endif - #include - #include -@@ -770,7 +772,7 @@ ScanSections64 ( - } - mCoffOffset = mDebugOffset + sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY) + - sizeof(EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY) + -- strlen(mInImageName) + 1; -+ strlen(basename(mInImageName)) + 1; - - mCoffOffset = CoffAlign(mCoffOffset); - if (SectionCount == 0) { -@@ -1609,7 +1611,7 @@ WriteDebug64 ( - EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *Dir; - EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY *Nb10; - -- Len = strlen(mInImageName) + 1; -+ Len = strlen(basename(mInImageName)) + 1; - - Dir = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY*)(mCoffFile + mDebugOffset); - Dir->Type = EFI_IMAGE_DEBUG_TYPE_CODEVIEW; -@@ -1619,7 +1621,7 @@ WriteDebug64 ( - - Nb10 = (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY*)(Dir + 1); - Nb10->Signature = CODEVIEW_SIGNATURE_NB10; -- strcpy ((char *)(Nb10 + 1), mInImageName); -+ strcpy ((char *)(Nb10 + 1), basename(mInImageName)); - - - NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(mCoffFile + mNtHdrOffset); diff --git a/meta/recipes-core/ovmf/ovmf/zero.patch b/meta/recipes-core/ovmf/ovmf/zero.patch deleted file mode 100644 index af7a9d31f6..0000000000 --- a/meta/recipes-core/ovmf/ovmf/zero.patch +++ /dev/null @@ -1,84 +0,0 @@ -Pass --zero to GenFw in release builds so that the sections that link back to -the intermediate binaries (containing build paths) are removed. - -Upstream-Status: Pending (discussion at https://bugzilla.tianocore.org/show_bug.cgi?id=3256) -Signed-off-by: Ross Burton - -From 6303b065802c9427c718fda129360189b79316e7 Mon Sep 17 00:00:00 2001 -From: Ross Burton -Date: Tue, 16 Mar 2021 16:49:49 +0000 -Subject: [PATCH] Strip build paths - ---- - OvmfPkg/AmdSev/AmdSevX64.dsc | 1 + - OvmfPkg/Bhyve/BhyveX64.dsc | 1 + - OvmfPkg/OvmfPkgIa32.dsc | 2 ++ - OvmfPkg/OvmfPkgIa32X64.dsc | 1 + - OvmfPkg/OvmfPkgX64.dsc | 1 + - OvmfPkg/OvmfXen.dsc | 1 + - 6 files changed, 7 insertions(+) - -diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc -index 4a1cdf5aca..132f55cf69 100644 ---- a/OvmfPkg/Bhyve/BhyveX64.dsc -+++ b/OvmfPkg/Bhyve/BhyveX64.dsc -@@ -76,6 +76,7 @@ - GCC:*_*_X64_GENFW_FLAGS = --keepexceptiontable - INTEL:*_*_X64_GENFW_FLAGS = --keepexceptiontable - !endif -+ RELEASE_*_*_GENFW_FLAGS = --zero - - # - # Disable deprecated APIs. -diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc -index 1eaf3e99c6..ce20f09df8 100644 ---- a/OvmfPkg/OvmfPkgIa32.dsc -+++ b/OvmfPkg/OvmfPkgIa32.dsc -@@ -90,6 +90,8 @@ - - !include NetworkPkg/NetworkBuildOptions.dsc.inc - -+ RELEASE_*_*_GENFW_FLAGS = --zero -+ - [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER] - GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000 - XCODE:*_*_*_DLINK_FLAGS = -seg1addr 0x1000 -segalign 0x1000 -diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc -index 4a5a430147..97cc438250 100644 ---- a/OvmfPkg/OvmfPkgIa32X64.dsc -+++ b/OvmfPkg/OvmfPkgIa32X64.dsc -@@ -84,6 +84,7 @@ - GCC:*_*_X64_GENFW_FLAGS = --keepexceptiontable - INTEL:*_*_X64_GENFW_FLAGS = --keepexceptiontable - !endif -+ RELEASE_*_*_GENFW_FLAGS = --zero - - # - # Disable deprecated APIs. -diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc -index d4d601b444..f544fb04bf 100644 ---- a/OvmfPkg/OvmfPkgX64.dsc -+++ b/OvmfPkg/OvmfPkgX64.dsc -@@ -84,6 +84,7 @@ - GCC:*_*_X64_GENFW_FLAGS = --keepexceptiontable - INTEL:*_*_X64_GENFW_FLAGS = --keepexceptiontable - !endif -+ RELEASE_*_*_GENFW_FLAGS = --zero - - # - # Disable deprecated APIs. -diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc -index 507029404f..fcaa35acf1 100644 ---- a/OvmfPkg/OvmfXen.dsc -+++ b/OvmfPkg/OvmfXen.dsc -@@ -74,6 +74,7 @@ - GCC:*_*_X64_GENFW_FLAGS = --keepexceptiontable - INTEL:*_*_X64_GENFW_FLAGS = --keepexceptiontable - !endif -+ RELEASE_*_*_GENFW_FLAGS = --zero - - # - # Disable deprecated APIs. --- -2.25.1 - diff --git a/meta/recipes-core/ovmf/ovmf_git.bb b/meta/recipes-core/ovmf/ovmf_git.bb index 888ea082ec..90dae2aed0 100644 --- a/meta/recipes-core/ovmf/ovmf_git.bb +++ b/meta/recipes-core/ovmf/ovmf_git.bb @@ -15,15 +15,15 @@ PACKAGECONFIG[secureboot] = ",,," SRC_URI = "gitsm://github.com/tianocore/edk2.git;branch=master;protocol=https \ file://0001-ovmf-update-path-to-native-BaseTools.patch \ file://0002-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch \ - file://0004-ovmf-Update-to-latest.patch \ - file://zero.patch \ - file://debug_prefix_map.patch \ - file://reproducible.patch \ + file://0003-ovmf-Update-to-latest.patch \ + file://0004-Strip-build-paths.patch \ + file://0005-debug-prefix-map.patch \ + file://0006-reproducible.patch \ file://0001-Fix-VLA-parameter-warning.patch \ " -PV = "edk2-stable202102" -SRCREV = "ef91b07388e1c0a50c604e5350eeda98428ccea6" +PV = "edk2-stable202105" +SRCREV = "e1999b264f1f9d7230edf2448f757c73da567832" UPSTREAM_CHECK_GITTAGREGEX = "(?Pedk2-stable.*)" inherit deploy -- cgit 1.2.3-korg