summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/ovmf
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/ovmf')
-rw-r--r--meta/recipes-core/ovmf/ovmf-shell-image.bb6
-rw-r--r--meta/recipes-core/ovmf/ovmf/0001-ovmf-update-path-to-native-BaseTools.patch9
-rw-r--r--meta/recipes-core/ovmf/ovmf/0002-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch58
-rw-r--r--meta/recipes-core/ovmf/ovmf/0003-debug-prefix-map.patch104
-rw-r--r--meta/recipes-core/ovmf/ovmf/0003-ovmf-enable-long-path-file.patch28
-rw-r--r--meta/recipes-core/ovmf/ovmf/0004-ovmf-Update-to-latest.patch46
-rw-r--r--meta/recipes-core/ovmf/ovmf/0004-reproducible.patch180
-rw-r--r--meta/recipes-core/ovmf/ovmf_git.bb77
8 files changed, 377 insertions, 131 deletions
diff --git a/meta/recipes-core/ovmf/ovmf-shell-image.bb b/meta/recipes-core/ovmf/ovmf-shell-image.bb
index fd4fb5b732..4d7958eb5f 100644
--- a/meta/recipes-core/ovmf/ovmf-shell-image.bb
+++ b/meta/recipes-core/ovmf/ovmf-shell-image.bb
@@ -1,11 +1,11 @@
1DESCRIPTION = "boot image with UEFI shell and tools" 1SUMMARY = "boot image with UEFI shell and tools"
2COMPATIBLE_HOST_class-target='(i.86|x86_64).*' 2COMPATIBLE_HOST:class-target='(i.86|x86_64).*'
3 3
4# For this image recipe, only the wic format with a 4# For this image recipe, only the wic format with a
5# single vfat partition makes sense. Because we have no 5# single vfat partition makes sense. Because we have no
6# boot loader and no rootfs partition, not additional 6# boot loader and no rootfs partition, not additional
7# tools are needed for this .wks file. 7# tools are needed for this .wks file.
8IMAGE_FSTYPES_forcevariable = 'wic' 8IMAGE_FSTYPES:forcevariable = 'wic'
9WKS_FILE = "ovmf/ovmf-shell-image.wks" 9WKS_FILE = "ovmf/ovmf-shell-image.wks"
10WKS_FILE_DEPENDS = "" 10WKS_FILE_DEPENDS = ""
11 11
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..490d9e8046 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,4 +1,4 @@
1From 200ff35c6545b4ab85f5ea7a6096fbaec3d82f6d Mon Sep 17 00:00:00 2001 1From d8df6b6433351763e1db791dd84d432983d2b249 Mon Sep 17 00:00:00 2001
2From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com> 2From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
3Date: Thu, 9 Jun 2016 02:23:01 -0700 3Date: Thu, 9 Jun 2016 02:23:01 -0700
4Subject: [PATCH 1/4] ovmf: update path to native BaseTools 4Subject: [PATCH 1/4] ovmf: update path to native BaseTools
@@ -10,14 +10,13 @@ tools. The BBAKE_EDK_TOOLS_PATH string is used as a pattern to be replaced
10with the appropriate location before building. 10with the appropriate location before building.
11 11
12Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com> 12Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
13Upstream-Status: Pending 13Upstream-Status: Inappropriate [oe-core cross compile specific]
14
15--- 14---
16 OvmfPkg/build.sh | 2 +- 15 OvmfPkg/build.sh | 2 +-
17 1 file changed, 1 insertion(+), 1 deletion(-) 16 1 file changed, 1 insertion(+), 1 deletion(-)
18 17
19diff --git a/OvmfPkg/build.sh b/OvmfPkg/build.sh 18diff --git a/OvmfPkg/build.sh b/OvmfPkg/build.sh
20index 91b1442ade..1858dae31a 100755 19index b0334fb76e..094f86f096 100755
21--- a/OvmfPkg/build.sh 20--- a/OvmfPkg/build.sh
22+++ b/OvmfPkg/build.sh 21+++ b/OvmfPkg/build.sh
23@@ -24,7 +24,7 @@ then 22@@ -24,7 +24,7 @@ then
@@ -30,5 +29,5 @@ index 91b1442ade..1858dae31a 100755
30 source edksetup.sh BaseTools 29 source edksetup.sh BaseTools
31 else 30 else
32-- 31--
332.28.0 322.30.2
34 33
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..eeedc9e20f 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,67 +1,69 @@
1From 667c0cf97dadc4f5994d26ec3984f559a05ec406 Mon Sep 17 00:00:00 2001 1From ac9df4fb92965f1f95a5bdbde5f2f86d0c569711 Mon Sep 17 00:00:00 2001
2From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com> 2From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
3Date: Fri, 26 Jul 2019 17:34:26 -0400 3Date: Fri, 26 Jul 2019 17:34:26 -0400
4Subject: [PATCH 2/4] BaseTools: makefile: adjust to build in under bitbake 4Subject: [PATCH] BaseTools: makefile: adjust to build in under bitbake
5 5
6Prepend the build flags with those of bitbake. This is to build 6Prepend the build flags with those of bitbake. This is to build
7using the bitbake native sysroot include and library directories. 7using the bitbake native sysroot include and library directories.
8 8
9Signed-off-by: Ricardo Neri <ricardo.neri@linux.intel.com> 9Note from Alex: this is not appropriate for upstream submission as
10Upstream-Status: Pending 10the recipe already does lots of similar in-place fixups elsewhere, so
11this patch shold be converted to follow that pattern. We're not going
12to fight against how upstream wants to configure the build.
11 13
14Signed-off-by: Ricardo Neri <ricardo.neri@linux.intel.com>
15Upstream-Status: Inappropriate [needs to be converted to in-recipe fixups]
12--- 16---
13 BaseTools/Source/C/Makefiles/header.makefile | 17 +++++++++-------- 17 BaseTools/Source/C/Makefiles/header.makefile | 15 +++++++--------
14 1 file changed, 9 insertions(+), 8 deletions(-) 18 1 file changed, 7 insertions(+), 8 deletions(-)
15 19
16diff --git a/BaseTools/Source/C/Makefiles/header.makefile b/BaseTools/Source/C/Makefiles/header.makefile 20diff --git a/BaseTools/Source/C/Makefiles/header.makefile b/BaseTools/Source/C/Makefiles/header.makefile
17index 1c105ee7d4..d5eea3864e 100644 21index d369908a09..22c670f316 100644
18--- a/BaseTools/Source/C/Makefiles/header.makefile 22--- a/BaseTools/Source/C/Makefiles/header.makefile
19+++ b/BaseTools/Source/C/Makefiles/header.makefile 23+++ b/BaseTools/Source/C/Makefiles/header.makefile
20@@ -69,35 +69,36 @@ $(error Bad HOST_ARCH) 24@@ -85,35 +85,34 @@ endif
21 endif
22 25
23 INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) -I $(MAKEROOT)/Include/Common -I $(MAKEROOT)/Include/ -I $(MAKEROOT)/Include/IndustryStandard -I $(MAKEROOT)/Common/ -I .. -I . $(ARCH_INCLUDE) 26 INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) -I $(MAKEROOT)/Include/Common -I $(MAKEROOT)/Include/ -I $(MAKEROOT)/Include/IndustryStandard -I $(MAKEROOT)/Common/ -I .. -I . $(ARCH_INCLUDE)
24-BUILD_CPPFLAGS = $(INCLUDE) 27 INCLUDE += -I $(EDK2_PATH)/MdePkg/Include
25+BUILD_CPPFLAGS += $(INCLUDE) 28-CPPFLAGS = $(INCLUDE)
29+CPPFLAGS += $(INCLUDE)
26 30
27 # keep EXTRA_OPTFLAGS last 31 # keep EXTRA_OPTFLAGS last
28 BUILD_OPTFLAGS = -O2 $(EXTRA_OPTFLAGS) 32 BUILD_OPTFLAGS = -O2 $(EXTRA_OPTFLAGS)
29 33
30 ifeq ($(DARWIN),Darwin) 34 ifeq ($(DARWIN),Darwin)
31 # assume clang or clang compatible flags on OS X 35 # assume clang or clang compatible flags on OS X
32-BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror \ 36-CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror \
33+BUILD_CFLAGS += -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror \ 37+CFLAGS += -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror \
34 -Wno-deprecated-declarations -Wno-self-assign -Wno-unused-result -nostdlib -g 38 -Wno-deprecated-declarations -Wno-self-assign -Wno-unused-result -nostdlib -g
35 else 39 else
36 ifeq ($(CXX), llvm) 40 ifneq ($(CLANG),)
37-BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fwrapv \ 41-CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fwrapv \
38+BUILD_CFLAGS += -MD -fshort-wchar -fno-strict-aliasing -fwrapv \ 42+CFLAGS += -MD -fshort-wchar -fno-strict-aliasing -fwrapv \
39 -fno-delete-null-pointer-checks -Wall -Werror \ 43 -fno-delete-null-pointer-checks -Wall -Werror \
40 -Wno-deprecated-declarations -Wno-self-assign \ 44 -Wno-deprecated-declarations -Wno-self-assign \
41 -Wno-unused-result -nostdlib -g 45 -Wno-unused-result -nostdlib -g
42 else 46 else
43-BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fwrapv \ 47-CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fwrapv \
44+BUILD_CFLAGS += -MD -fshort-wchar -fno-strict-aliasing -fwrapv \ 48+CFLAGS += -MD -fshort-wchar -fno-strict-aliasing -fwrapv \
45 -fno-delete-null-pointer-checks -Wall -Werror \ 49 -fno-delete-null-pointer-checks -Wall -Werror \
46 -Wno-deprecated-declarations -Wno-stringop-truncation -Wno-restrict \ 50 -Wno-deprecated-declarations -Wno-stringop-truncation -Wno-restrict \
47 -Wno-unused-result -nostdlib -g 51 -Wno-unused-result -nostdlib -g
48 endif 52 endif
49 endif 53 endif
50 ifeq ($(CXX), llvm) 54 ifneq ($(CLANG),)
51-BUILD_LFLAGS = 55-LDFLAGS =
52-BUILD_CXXFLAGS = -Wno-deprecated-register -Wno-unused-result 56-CXXFLAGS = -Wno-deprecated-register -Wno-unused-result -std=c++14
53+BUILD_LFLAGS = $(LDFLAGS) 57+CXXFLAGS += -Wno-deprecated-register -Wno-unused-result -std=c++14
54+BUILD_CXXFLAGS += -Wno-deprecated-register -Wno-unused-result
55 else 58 else
56-BUILD_LFLAGS = 59-LDFLAGS =
57-BUILD_CXXFLAGS = -Wno-unused-result 60-CXXFLAGS = -Wno-unused-result
58+BUILD_LFLAGS = $(LDFLAGS) 61+CXXFLAGS += -Wno-unused-result
59+BUILD_CXXFLAGS += -Wno-unused-result
60 endif 62 endif
61+ 63+
62 ifeq ($(HOST_ARCH), IA32) 64 ifeq ($(HOST_ARCH), IA32)
63 # 65 #
64 # Snow Leopard is a 32-bit and 64-bit environment. uname -m returns i386, but gcc defaults 66 # Snow Leopard is a 32-bit and 64-bit environment. uname -m returns i386, but gcc defaults
65-- 67--
662.28.0 682.30.2
67 69
diff --git a/meta/recipes-core/ovmf/ovmf/0003-debug-prefix-map.patch b/meta/recipes-core/ovmf/ovmf/0003-debug-prefix-map.patch
new file mode 100644
index 0000000000..c0c763c1cf
--- /dev/null
+++ b/meta/recipes-core/ovmf/ovmf/0003-debug-prefix-map.patch
@@ -0,0 +1,104 @@
1From 03e536b20d0b72cf078052f6748de8df3836625c Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Mon, 14 Jun 2021 19:56:28 +0200
4Subject: [PATCH 3/4] debug prefix map
5
6We want to pass ${DEBUG_PREFIX_MAP} to gcc commands and also pass in
7 --debug-prefix-map to nasm (we carry a patch to nasm for this). The
8tools definitions file is built by ovmf-native so we need to pass this in
9at target build time when we know the right values so we use the environment.
10
11By using determininistc file paths during the ovmf build, it removes the
12opportunitity for gcc/ld to change the output binaries due to path lengths
13overflowing section sizes and causing small changes in the binary output.
14Previously we relied on the stripped output being the same which isn't always
15the case if the size of the debug symbols varies.
16
17Upstream-Status: Submitted [https://github.com/tianocore/edk2/pull/2202]
18Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
19Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
20---
21 BaseTools/Conf/tools_def.template | 18 +++++++++---------
22 1 file changed, 9 insertions(+), 9 deletions(-)
23
24diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
25index 503a6687c1..10ac38ef9e 100755
26--- a/BaseTools/Conf/tools_def.template
27+++ b/BaseTools/Conf/tools_def.template
28@@ -739,7 +739,7 @@ NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG = --add-gnu-debuglink="$(DEBUG_DIR)/$(MODULE_
29 *_*_*_DTCPP_PATH = DEF(DTCPP_BIN)
30 *_*_*_DTC_PATH = DEF(DTC_BIN)
31
32-DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common
33+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)
34 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 -fno-pic -fno-pie
35 DEFINE GCC_LOONGARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mabi=lp64d -fno-asynchronous-unwind-tables -fno-plt -Wno-address -fno-short-enums -fsigned-char -ffunction-sections -fdata-sections
36 DEFINE GCC_ARM_CC_XIPFLAGS = -mno-unaligned-access
37@@ -759,8 +759,8 @@ DEFINE GCC_ARM_ASLDLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) -Wl,--entry,Refere
38 DEFINE GCC_AARCH64_ASLDLINK_FLAGS = DEF(GCC_AARCH64_DLINK_FLAGS) -Wl,--entry,ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT) DEF(GCC_ARM_AARCH64_ASLDLINK_FLAGS)
39 DEFINE GCC_LOONGARCH64_ASLDLINK_FLAGS = DEF(GCC_LOONGARCH64_DLINK_FLAGS) -Wl,--entry,ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
40 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
41-DEFINE GCC_ASM_FLAGS = -c -x assembler -imacros AutoGen.h
42-DEFINE GCC_PP_FLAGS = -E -x assembler-with-cpp -include AutoGen.h
43+DEFINE GCC_ASM_FLAGS = -c -x assembler -imacros AutoGen.h ENV(GCC_PREFIX_MAP)
44+DEFINE GCC_PP_FLAGS = -E -x assembler-with-cpp -include AutoGen.h ENV(GCC_PREFIX_MAP)
45 DEFINE GCC_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE --include $(MODULE_NAME)StrDefs.h
46 DEFINE GCC_ASLPP_FLAGS = -x c -E -include AutoGen.h
47 DEFINE GCC_ASLCC_FLAGS = -x c
48@@ -913,7 +913,7 @@ DEFINE GCC5_LOONGARCH64_PP_FLAGS = -mabi=lp64d -march=loongarch64 DEF(
49 *_GCC48_IA32_DLINK2_FLAGS = DEF(GCC48_IA32_DLINK2_FLAGS)
50 *_GCC48_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
51 *_GCC48_IA32_OBJCOPY_FLAGS =
52-*_GCC48_IA32_NASM_FLAGS = -f elf32
53+*_GCC48_IA32_NASM_FLAGS = -f elf32 ENV(NASM_PREFIX_MAP)
54
55 DEBUG_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS)
56 RELEASE_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Wno-unused-but-set-variable
57@@ -941,7 +941,7 @@ RELEASE_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Wno-unused-but-set
58 *_GCC48_X64_DLINK2_FLAGS = DEF(GCC48_X64_DLINK2_FLAGS)
59 *_GCC48_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
60 *_GCC48_X64_OBJCOPY_FLAGS =
61-*_GCC48_X64_NASM_FLAGS = -f elf64
62+*_GCC48_X64_NASM_FLAGS = -f elf64 ENV(NASM_PREFIX_MAP)
63
64 DEBUG_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS)
65 RELEASE_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) -Wno-unused-but-set-variable
66@@ -1050,7 +1050,7 @@ RELEASE_GCC48_AARCH64_CC_FLAGS = DEF(GCC48_AARCH64_CC_FLAGS) -Wno-unused-but-s
67 *_GCC49_IA32_DLINK2_FLAGS = DEF(GCC49_IA32_DLINK2_FLAGS)
68 *_GCC49_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
69 *_GCC49_IA32_OBJCOPY_FLAGS =
70-*_GCC49_IA32_NASM_FLAGS = -f elf32
71+*_GCC49_IA32_NASM_FLAGS = -f elf32 ENV(NASM_PREFIX_MAP)
72
73 DEBUG_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS)
74 RELEASE_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Wno-unused-but-set-variable -Wno-unused-const-variable
75@@ -1078,7 +1078,7 @@ RELEASE_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Wno-unused-but-set
76 *_GCC49_X64_DLINK2_FLAGS = DEF(GCC49_X64_DLINK2_FLAGS)
77 *_GCC49_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
78 *_GCC49_X64_OBJCOPY_FLAGS =
79-*_GCC49_X64_NASM_FLAGS = -f elf64
80+*_GCC49_X64_NASM_FLAGS = -f elf64 ENV(NASM_PREFIX_MAP)
81
82 DEBUG_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS)
83 RELEASE_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -Wno-unused-but-set-variable -Wno-unused-const-variable
84@@ -1337,7 +1337,7 @@ RELEASE_GCCNOLTO_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
85 *_GCC5_IA32_DLINK2_FLAGS = DEF(GCC5_IA32_DLINK2_FLAGS) -no-pie
86 *_GCC5_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
87 *_GCC5_IA32_OBJCOPY_FLAGS =
88-*_GCC5_IA32_NASM_FLAGS = -f elf32
89+*_GCC5_IA32_NASM_FLAGS = -f elf32 ENV(NASM_PREFIX_MAP)
90
91 DEBUG_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -flto
92 DEBUG_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Os -Wl,-m,elf_i386,--oformat=elf32-i386
93@@ -1369,7 +1369,7 @@ RELEASE_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Os -Wl,
94 *_GCC5_X64_DLINK2_FLAGS = DEF(GCC5_X64_DLINK2_FLAGS)
95 *_GCC5_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
96 *_GCC5_X64_OBJCOPY_FLAGS =
97-*_GCC5_X64_NASM_FLAGS = -f elf64
98+*_GCC5_X64_NASM_FLAGS = -f elf64 ENV(NASM_PREFIX_MAP)
99
100 DEBUG_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -flto -DUSING_LTO
101 DEBUG_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -flto -Os
102--
1032.30.2
104
diff --git a/meta/recipes-core/ovmf/ovmf/0003-ovmf-enable-long-path-file.patch b/meta/recipes-core/ovmf/ovmf/0003-ovmf-enable-long-path-file.patch
deleted file mode 100644
index df1d159011..0000000000
--- a/meta/recipes-core/ovmf/ovmf/0003-ovmf-enable-long-path-file.patch
+++ /dev/null
@@ -1,28 +0,0 @@
1From e19481e5a64f8915ac118899b10c40d12c0f9daa Mon Sep 17 00:00:00 2001
2From: Dengke Du <dengke.du@windriver.com>
3Date: Mon, 11 Sep 2017 02:21:55 -0400
4Subject: [PATCH 3/4] ovmf: enable long path file
5
6Upstream-Status: Pending
7Signed-off-by: Dengke Du <dengke.du@windriver.com>
8
9---
10 BaseTools/Source/C/Common/CommonLib.h | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13diff --git a/BaseTools/Source/C/Common/CommonLib.h b/BaseTools/Source/C/Common/CommonLib.h
14index e1cce985f7..d67d03c70c 100644
15--- a/BaseTools/Source/C/Common/CommonLib.h
16+++ b/BaseTools/Source/C/Common/CommonLib.h
17@@ -14,7 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
18 #include <assert.h>
19 #define PRINTED_GUID_BUFFER_SIZE 37 // including null-termination
20
21-#define MAX_LONG_FILE_PATH 500
22+#define MAX_LONG_FILE_PATH 1023
23
24 #define MAX_UINT64 ((UINT64)0xFFFFFFFFFFFFFFFFULL)
25 #define MAX_UINT32 ((UINT32)0xFFFFFFFF)
26--
272.28.0
28
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 @@
1From ad06fcf1e08736e79221cd6863ff2e3c9254f261 Mon Sep 17 00:00:00 2001
2From: Steve Langasek <steve.langasek@ubuntu.com>
3Date: Sat, 10 Jun 2017 01:39:36 -0700
4Subject: [PATCH 4/4] ovmf: Update to latest
5
6Description: pass -fno-stack-protector to all GCC toolchains
7 The upstream build rules inexplicably pass -fno-stack-protector only
8 when building for i386 and amd64. Add this essential argument to the
9 generic rules for gcc 4.4 and later.
10Last-Updated: 2016-04-12
11Upstream-Status: Pending
12
13---
14 BaseTools/Conf/tools_def.template | 8 ++++----
15 1 file changed, 4 insertions(+), 4 deletions(-)
16
17diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
18index 933b3160fd..c2fbbf0c38 100755
19--- a/BaseTools/Conf/tools_def.template
20+++ b/BaseTools/Conf/tools_def.template
21@@ -1952,10 +1952,10 @@ DEFINE GCC_RISCV64_RC_FLAGS = -I binary -O elf64-littleriscv -B riscv
22 # GCC Build Flag for included header file list generation
23 DEFINE GCC_DEPS_FLAGS = -MMD -MF $@.deps
24
25-DEFINE GCC48_ALL_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -ffunction-sections -fdata-sections -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
26+DEFINE GCC48_ALL_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -ffunction-sections -fdata-sections -fno-stack-protector -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
27 DEFINE GCC48_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x20
28-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
29-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
30+DEFINE GCC48_IA32_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m32 -march=i586 -malign-double -D EFI32 -fno-asynchronous-unwind-tables -Wno-address
31+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
32 DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_COMMON) -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
33 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
34 DEFINE GCC48_IA32_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x220 DEF(GCC_DLINK2_FLAGS_COMMON)
35@@ -1964,7 +1964,7 @@ DEFINE GCC48_X64_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x228 DEF
36 DEFINE GCC48_ASM_FLAGS = DEF(GCC_ASM_FLAGS)
37 DEFINE GCC48_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ASM_FLAGS) -mlittle-endian
38 DEFINE GCC48_AARCH64_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ASM_FLAGS) -mlittle-endian
39-DEFINE GCC48_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARM_CC_FLAGS) -fstack-protector -mword-relocations
40+DEFINE GCC48_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARM_CC_FLAGS) -mword-relocations
41 DEFINE GCC48_ARM_CC_XIPFLAGS = DEF(GCC_ARM_CC_XIPFLAGS)
42 DEFINE GCC48_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mcmodel=large DEF(GCC_AARCH64_CC_FLAGS)
43 DEFINE GCC48_AARCH64_CC_XIPFLAGS = DEF(GCC_AARCH64_CC_XIPFLAGS)
44--
452.28.0
46
diff --git a/meta/recipes-core/ovmf/ovmf/0004-reproducible.patch b/meta/recipes-core/ovmf/ovmf/0004-reproducible.patch
new file mode 100644
index 0000000000..c3fdc3d863
--- /dev/null
+++ b/meta/recipes-core/ovmf/ovmf/0004-reproducible.patch
@@ -0,0 +1,180 @@
1From c59850367a190d70dec43e0a66f399a4d8a5ffed Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Mon, 14 Jun 2021 19:57:30 +0200
4Subject: [PATCH 4/4] reproducible
5
6This patch fixes various things which make the build more reproducible. Some changes
7here only change intermediate artefacts but that means when you have two build trees
8giving differing results, the differences can be isolated more easily. The issues here
9usually become apparent with longer paths.
10
11This was all debugged with:
12TMPDIR = "${TOPDIR}/tmp"
13vs.
14TMPDIR = "${TOPDIR}/tmp-inital-mylongpath-mylongpath-mylongpath-mylongpath-mylongpath-mylongpath-mylongpath-mylongpath-mylongpath"
15
16The patch specifically:
17
18 * Sorts output in GNUmakefile
19 * Always generates indirect flags files used to avoid pathlength issues else the
20 compile commands suddenly change when using longer paths
21 * Sorts the AutoGenTimeStamp file contents
22 * Makes the TargetDescBlock objects from BuildEngine sortable to allow the makefile fix
23 * Fix ElfConvert within GenFw so that only the basename of the binary being converted
24 is used, else the output from "GenFw XXX.bin" differs from "GenFw /long/path/XXX.bin"
25 with sufficiently long paths
26
27Upstream-Status: Submitted [https://github.com/tianocore/edk2/pull/2176]
28Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
29Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
30---
31 BaseTools/Source/C/GenFw/Elf64Convert.c | 8 ++++---
32 .../Source/Python/AutoGen/BuildEngine.py | 3 +++
33 BaseTools/Source/Python/AutoGen/GenMake.py | 24 +++++++++----------
34 .../Source/Python/AutoGen/ModuleAutoGen.py | 5 +++-
35 4 files changed, 24 insertions(+), 16 deletions(-)
36
37diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c b/BaseTools/Source/C/GenFw/Elf64Convert.c
38index 9c17c90b16..fcc7864141 100644
39--- a/BaseTools/Source/C/GenFw/Elf64Convert.c
40+++ b/BaseTools/Source/C/GenFw/Elf64Convert.c
41@@ -15,6 +15,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
42 #ifndef __GNUC__
43 #include <windows.h>
44 #include <io.h>
45+#else
46+#define _GNU_SOURCE
47 #endif
48 #include <assert.h>
49 #include <stdio.h>
50@@ -990,7 +992,7 @@ ScanSections64 (
51 }
52 mCoffOffset = mDebugOffset + sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY) +
53 sizeof(EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY) +
54- strlen(mInImageName) + 1;
55+ strlen(basename(mInImageName)) + 1;
56
57 //
58 // Add more space in the .debug data region for the DllCharacteristicsEx
59@@ -2261,7 +2263,7 @@ WriteDebug64 (
60 EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY *Nb10;
61 EFI_IMAGE_DEBUG_EX_DLLCHARACTERISTICS_ENTRY *DllEntry;
62
63- Len = strlen(mInImageName) + 1;
64+ Len = strlen(basename(mInImageName)) + 1;
65
66 NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(mCoffFile + mNtHdrOffset);
67 DataDir = &NtHdr->Pe32Plus.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG];
68@@ -2294,7 +2296,7 @@ WriteDebug64 (
69
70 Nb10 = (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY*)(Dir + 1);
71 Nb10->Signature = CODEVIEW_SIGNATURE_NB10;
72- strcpy ((char *)(Nb10 + 1), mInImageName);
73+ strcpy ((char *)(Nb10 + 1), basename(mInImageName));
74 }
75
76 STATIC
77diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py b/BaseTools/Source/Python/AutoGen/BuildEngine.py
78index 752a1a1f6a..02054cccf8 100644
79--- a/BaseTools/Source/Python/AutoGen/BuildEngine.py
80+++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py
81@@ -70,6 +70,9 @@ class TargetDescBlock(object):
82 else:
83 return str(Other) == self.Target.Path
84
85+ def __lt__(self, other):
86+ return str(self) < str(other)
87+
88 def AddInput(self, Input):
89 if Input not in self.Inputs:
90 self.Inputs.append(Input)
91diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py
92index daec9c6d54..0e8cc20efe 100755
93--- a/BaseTools/Source/Python/AutoGen/GenMake.py
94+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
95@@ -575,7 +575,7 @@ cleanlib:
96 os.remove(RespFileList)
97
98 # convert source files and binary files to build targets
99- self.ResultFileList = [str(T.Target) for T in MyAgo.CodaTargetList]
100+ self.ResultFileList = sorted([str(T.Target) for T in MyAgo.CodaTargetList])
101 if len(self.ResultFileList) == 0 and len(MyAgo.SourceFileList) != 0:
102 EdkLogger.error("build", AUTOGEN_ERROR, "Nothing to build",
103 ExtraData="[%s]" % str(MyAgo))
104@@ -726,7 +726,7 @@ cleanlib:
105 OutputFile = ''
106 DepsFileList = []
107
108- for Cmd in self.GenFfsList:
109+ for Cmd in sorted(self.GenFfsList):
110 if Cmd[2]:
111 for CopyCmd in Cmd[2]:
112 Src, Dst = CopyCmd
113@@ -759,7 +759,7 @@ cleanlib:
114 self.BuildTargetList.append('\t%s' % CmdString)
115
116 self.ParseSecCmd(DepsFileList, Cmd[1])
117- for SecOutputFile, SecDepsFile, SecCmd in self.FfsOutputFileList :
118+ for SecOutputFile, SecDepsFile, SecCmd in sorted(self.FfsOutputFileList):
119 self.BuildTargetList.append('%s : %s' % (self.ReplaceMacro(SecOutputFile), self.ReplaceMacro(SecDepsFile)))
120 self.BuildTargetList.append('\t%s' % self.ReplaceMacro(SecCmd))
121 self.FfsOutputFileList = []
122@@ -798,13 +798,13 @@ cleanlib:
123
124 def CommandExceedLimit(self):
125 FlagDict = {
126- 'CC' : { 'Macro' : '$(CC_FLAGS)', 'Value' : False},
127- 'PP' : { 'Macro' : '$(PP_FLAGS)', 'Value' : False},
128- 'APP' : { 'Macro' : '$(APP_FLAGS)', 'Value' : False},
129- 'ASLPP' : { 'Macro' : '$(ASLPP_FLAGS)', 'Value' : False},
130- 'VFRPP' : { 'Macro' : '$(VFRPP_FLAGS)', 'Value' : False},
131- 'ASM' : { 'Macro' : '$(ASM_FLAGS)', 'Value' : False},
132- 'ASLCC' : { 'Macro' : '$(ASLCC_FLAGS)', 'Value' : False},
133+ 'CC' : { 'Macro' : '$(CC_FLAGS)', 'Value' : True},
134+ 'PP' : { 'Macro' : '$(PP_FLAGS)', 'Value' : True},
135+ 'APP' : { 'Macro' : '$(APP_FLAGS)', 'Value' : True},
136+ 'ASLPP' : { 'Macro' : '$(ASLPP_FLAGS)', 'Value' : True},
137+ 'VFRPP' : { 'Macro' : '$(VFRPP_FLAGS)', 'Value' : True},
138+ 'ASM' : { 'Macro' : '$(ASM_FLAGS)', 'Value' : True},
139+ 'ASLCC' : { 'Macro' : '$(ASLCC_FLAGS)', 'Value' : True},
140 }
141
142 RespDict = {}
143@@ -1007,9 +1007,9 @@ cleanlib:
144 if not self.ObjTargetDict.get(T.Target.SubDir):
145 self.ObjTargetDict[T.Target.SubDir] = set()
146 self.ObjTargetDict[T.Target.SubDir].add(NewFile)
147- for Type in self._AutoGenObject.Targets:
148+ for Type in sorted(self._AutoGenObject.Targets):
149 resp_file_number = 0
150- for T in self._AutoGenObject.Targets[Type]:
151+ for T in sorted(self._AutoGenObject.Targets[Type]):
152 # Generate related macros if needed
153 if T.GenFileListMacro and T.FileListMacro not in self.FileListMacros:
154 self.FileListMacros[T.FileListMacro] = []
155diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
156index d05410b329..99b3f64aba 100755
157--- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
158+++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
159@@ -1474,6 +1474,9 @@ class ModuleAutoGen(AutoGen):
160 for File in Files:
161 if File.lower().endswith('.pdb'):
162 AsBuiltInfDict['binary_item'].append('DISPOSABLE|' + File)
163+
164+ AsBuiltInfDict['binary_item'] = sorted(AsBuiltInfDict['binary_item'])
165+
166 HeaderComments = self.Module.HeaderComments
167 StartPos = 0
168 for Index in range(len(HeaderComments)):
169@@ -1749,7 +1752,7 @@ class ModuleAutoGen(AutoGen):
170 if os.path.exists (self.TimeStampPath):
171 os.remove (self.TimeStampPath)
172
173- SaveFileOnChange(self.TimeStampPath, "\n".join(FileSet), False)
174+ SaveFileOnChange(self.TimeStampPath, "\n".join(sorted(FileSet)), False)
175
176 # Ignore generating makefile when it is a binary module
177 if self.IsBinaryModule:
178--
1792.30.2
180
diff --git a/meta/recipes-core/ovmf/ovmf_git.bb b/meta/recipes-core/ovmf/ovmf_git.bb
index d785ff6700..35ca8d1834 100644
--- a/meta/recipes-core/ovmf/ovmf_git.bb
+++ b/meta/recipes-core/ovmf/ovmf_git.bb
@@ -2,27 +2,48 @@ SUMMARY = "OVMF - UEFI firmware for Qemu and KVM"
2DESCRIPTION = "OVMF is an EDK II based project to enable UEFI support for \ 2DESCRIPTION = "OVMF is an EDK II based project to enable UEFI support for \
3Virtual Machines. OVMF contains sample UEFI firmware for QEMU and KVM" 3Virtual Machines. OVMF contains sample UEFI firmware for QEMU and KVM"
4HOMEPAGE = "https://github.com/tianocore/tianocore.github.io/wiki/OVMF" 4HOMEPAGE = "https://github.com/tianocore/tianocore.github.io/wiki/OVMF"
5LICENSE = "BSD-2-Clause" 5LICENSE = "BSD-2-Clause-Patent"
6LICENSE_class-target = "${@bb.utils.contains('PACKAGECONFIG', 'secureboot', 'BSD & OpenSSL', 'BSD', d)}" 6LICENSE:class-target = "${@bb.utils.contains('PACKAGECONFIG', 'secureboot', 'BSD-2-Clause-Patent & OpenSSL', 'BSD-2-Clause-Patent', d)}"
7LIC_FILES_CHKSUM = "file://OvmfPkg/License.txt;md5=06357ddc23f46577c2aeaeaf7b776d65" 7LIC_FILES_CHKSUM = "file://OvmfPkg/License.txt;md5=06357ddc23f46577c2aeaeaf7b776d65"
8 8
9# Enabling Secure Boot adds a dependency on OpenSSL and implies 9# Enabling Secure Boot adds a dependency on OpenSSL and implies
10# compiling OVMF twice, so it is disabled by default. Distros 10# compiling OVMF twice, so it is disabled by default. Distros
11# may change that default. 11# may change that default.
12PACKAGECONFIG ??= "" 12PACKAGECONFIG ??= ""
13PACKAGECONFIG += "${@bb.utils.contains('MACHINE_FEATURES', 'tpm', 'tpm', '', d)}"
14PACKAGECONFIG += "${@bb.utils.contains('MACHINE_FEATURES', 'tpm2', 'tpm', '', d)}"
13PACKAGECONFIG[secureboot] = ",,," 15PACKAGECONFIG[secureboot] = ",,,"
16PACKAGECONFIG[tpm] = "-D TPM_ENABLE=TRUE,-D TPM_ENABLE=FALSE,,"
17
18# GCC12 trips on it
19#see https://src.fedoraproject.org/rpms/edk2/blob/rawhide/f/0032-Basetools-turn-off-gcc12-warning.patch
20BUILD_CFLAGS += "-Wno-error=stringop-overflow"
14 21
15SRC_URI = "gitsm://github.com/tianocore/edk2.git;branch=master;protocol=https \ 22SRC_URI = "gitsm://github.com/tianocore/edk2.git;branch=master;protocol=https \
16 file://0001-ovmf-update-path-to-native-BaseTools.patch \ 23 file://0001-ovmf-update-path-to-native-BaseTools.patch \
17 file://0002-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch \ 24 file://0002-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch \
18 file://0003-ovmf-enable-long-path-file.patch \ 25 file://0003-debug-prefix-map.patch \
19 file://0004-ovmf-Update-to-latest.patch \ 26 file://0004-reproducible.patch \
20 " 27 "
21 28
22PV = "edk2-stable202011" 29PV = "edk2-stable202402"
23SRCREV = "872f953262d68a11da7bc2fb3ded16df234b8700" 30SRCREV = "edc6681206c1a8791981a2f911d2fb8b3d2f5768"
24UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>edk2-stable.*)" 31UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>edk2-stable.*)"
25 32
33CVE_PRODUCT = "edk2"
34CVE_VERSION = "${@d.getVar('PV').split('stable')[1]}"
35
36CVE_STATUS[CVE-2014-8271] = "fixed-version: Fixed in svn_16280, which is an unusual versioning breaking version comparison."
37CVE_STATUS[CVE-2014-4859] = "fixed-version: The CPE in the NVD database doesn't reflect correctly the vulnerable versions."
38CVE_STATUS[CVE-2014-4860] = "fixed-version: The CPE in the NVD database doesn't reflect correctly the vulnerable versions."
39CVE_STATUS[CVE-2019-14553] = "fixed-version: The CPE in the NVD database doesn't reflect correctly the vulnerable versions."
40CVE_STATUS[CVE-2019-14559] = "fixed-version: The CPE in the NVD database doesn't reflect correctly the vulnerable versions."
41CVE_STATUS[CVE-2019-14562] = "fixed-version: The CPE in the NVD database doesn't reflect correctly the vulnerable versions."
42CVE_STATUS[CVE-2019-14563] = "fixed-version: The CPE in the NVD database doesn't reflect correctly the vulnerable versions."
43CVE_STATUS[CVE-2019-14575] = "fixed-version: The CPE in the NVD database doesn't reflect correctly the vulnerable versions."
44CVE_STATUS[CVE-2019-14586] = "fixed-version: The CPE in the NVD database doesn't reflect correctly the vulnerable versions."
45CVE_STATUS[CVE-2019-14587] = "fixed-version: The CPE in the NVD database doesn't reflect correctly the vulnerable versions."
46
26inherit deploy 47inherit deploy
27 48
28PARALLEL_MAKE = "" 49PARALLEL_MAKE = ""
@@ -37,7 +58,7 @@ EDK_TOOLS_DIR="edk2_basetools"
37BUILD_OPTIMIZATION="-pipe" 58BUILD_OPTIMIZATION="-pipe"
38 59
39# OVMF supports IA only, although it could conceivably support ARM someday. 60# OVMF supports IA only, although it could conceivably support ARM someday.
40COMPATIBLE_HOST_class-target='(i.86|x86_64).*' 61COMPATIBLE_HOST:class-target='(i.86|x86_64).*'
41 62
42# Additional build flags for OVMF with Secure Boot. 63# Additional build flags for OVMF with Secure Boot.
43# Fedora also uses "-D SMM_REQUIRE -D EXCLUDE_SHELL_FROM_FD". 64# Fedora also uses "-D SMM_REQUIRE -D EXCLUDE_SHELL_FROM_FD".
@@ -49,7 +70,7 @@ export PYTHON_COMMAND = "${HOSTTOOLS_DIR}/python3"
49do_patch[postfuncs] += "fix_basetools_location" 70do_patch[postfuncs] += "fix_basetools_location"
50fix_basetools_location () { 71fix_basetools_location () {
51} 72}
52fix_basetools_location_class-target() { 73fix_basetools_location:class-target() {
53 # Replaces the fake path inserted by 0002-ovmf-update-path-to-native-BaseTools.patch. 74 # Replaces the fake path inserted by 0002-ovmf-update-path-to-native-BaseTools.patch.
54 # Necessary for finding the actual BaseTools from ovmf-native. 75 # Necessary for finding the actual BaseTools from ovmf-native.
55 sed -i -e 's#BBAKE_EDK_TOOLS_PATH#${STAGING_BINDIR_NATIVE}/${EDK_TOOLS_DIR}#' ${S}/OvmfPkg/build.sh 76 sed -i -e 's#BBAKE_EDK_TOOLS_PATH#${STAGING_BINDIR_NATIVE}/${EDK_TOOLS_DIR}#' ${S}/OvmfPkg/build.sh
@@ -58,7 +79,7 @@ fix_basetools_location_class-target() {
58do_patch[postfuncs] += "fix_iasl" 79do_patch[postfuncs] += "fix_iasl"
59fix_iasl() { 80fix_iasl() {
60} 81}
61fix_iasl_class-native() { 82fix_iasl:class-native() {
62 # iasl is not installed under /usr/bin when building with OE. 83 # iasl is not installed under /usr/bin when building with OE.
63 sed -i -e 's#/usr/bin/iasl#${STAGING_BINDIR_NATIVE}/iasl#' ${S}/BaseTools/Conf/tools_def.template 84 sed -i -e 's#/usr/bin/iasl#${STAGING_BINDIR_NATIVE}/iasl#' ${S}/BaseTools/Conf/tools_def.template
64} 85}
@@ -77,14 +98,14 @@ fix_toolchain() {
77 -e '/^VFR_CPPFLAGS/a CC = ${CC}\nCXX = ${CXX}\nAS = ${AS}\nAR = ${AR}\nLD = ${LD}' \ 98 -e '/^VFR_CPPFLAGS/a CC = ${CC}\nCXX = ${CXX}\nAS = ${AS}\nAR = ${AR}\nLD = ${LD}' \
78 ${S}/BaseTools/Source/C/VfrCompile/GNUmakefile 99 ${S}/BaseTools/Source/C/VfrCompile/GNUmakefile
79} 100}
80fix_toolchain_append_class-native() { 101fix_toolchain:append:class-native() {
81 # This tools_def.template is going to be used by the target ovmf and 102 # This tools_def.template is going to be used by the target ovmf and
82 # defines which compilers to use. For the GCC toolchain definitions, 103 # defines which compilers to use. For the GCC toolchain definitions,
83 # that will be ${HOST_PREFIX}gcc. However, "make" doesn't need that 104 # that will be ${HOST_PREFIX}gcc. However, "make" doesn't need that
84 # prefix. 105 # prefix.
85 # 106 #
86 # Injecting ENV(HOST_PREFIX) matches exporting that value as env 107 # Injecting ENV(HOST_PREFIX) matches exporting that value as env
87 # variable in do_compile_class-target. 108 # variable in do_compile:class-target.
88 sed -i \ 109 sed -i \
89 -e 's#\(ENV\|DEF\)(GCC.*_PREFIX)#ENV(HOST_PREFIX)#' \ 110 -e 's#\(ENV\|DEF\)(GCC.*_PREFIX)#ENV(HOST_PREFIX)#' \
90 -e 's#ENV(HOST_PREFIX)make#make#' \ 111 -e 's#ENV(HOST_PREFIX)make#make#' \
@@ -101,9 +122,23 @@ fix_toolchain_append_class-native() {
101 # to make ovmf-native reusable across distros. 122 # to make ovmf-native reusable across distros.
102 sed -i \ 123 sed -i \
103 -e 's#^\(DEFINE GCC.*DLINK.*FLAGS *=\)#\1 -fuse-ld=bfd#' \ 124 -e 's#^\(DEFINE GCC.*DLINK.*FLAGS *=\)#\1 -fuse-ld=bfd#' \
125 -e 's#-flto#-fno-lto#g' \
126 -e 's#-DUSING_LTO##g' \
104 ${S}/BaseTools/Conf/tools_def.template 127 ${S}/BaseTools/Conf/tools_def.template
105} 128}
106 129
130# We disable lto above since the results are not reproducible and make it hard to compare
131# binary build aretfacts to debug reproducibility problems.
132# Surprisingly, if you disable lto, you see compiler warnings which are fatal. We therefore
133# have to hack warnings overrides into GCC_PREFIX_MAP to allow it to build.
134
135# We want to pass ${DEBUG_PREFIX_MAP} to gcc commands and also pass in
136# --debug-prefix-map to nasm (we carry a patch to nasm for this). The
137# tools definitions are built by ovmf-native so we need to pass this in
138# at target build time when we know the right values.
139export NASM_PREFIX_MAP = "--debug-prefix-map=${WORKDIR}=${TARGET_DBGSRC_DIR}"
140export GCC_PREFIX_MAP = "${DEBUG_PREFIX_MAP} -Wno-stringop-overflow -Wno-maybe-uninitialized"
141
107GCC_VER="$(${CC} -v 2>&1 | tail -n1 | awk '{print $3}')" 142GCC_VER="$(${CC} -v 2>&1 | tail -n1 | awk '{print $3}')"
108 143
109fixup_target_tools() { 144fixup_target_tools() {
@@ -133,11 +168,11 @@ fixup_target_tools() {
133 echo ${FIXED_GCCVER} 168 echo ${FIXED_GCCVER}
134} 169}
135 170
136do_compile_class-native() { 171do_compile:class-native() {
137 oe_runmake -C ${S}/BaseTools 172 oe_runmake -C ${S}/BaseTools
138} 173}
139 174
140do_compile_class-target() { 175do_compile:class-target() {
141 export LFLAGS="${LDFLAGS}" 176 export LFLAGS="${LDFLAGS}"
142 PARALLEL_JOBS="${@oe.utils.parallel_make_argument(d, '-n %d')}" 177 PARALLEL_JOBS="${@oe.utils.parallel_make_argument(d, '-n %d')}"
143 OVMF_ARCH="X64" 178 OVMF_ARCH="X64"
@@ -169,7 +204,7 @@ do_compile_class-target() {
169 204
170 bbnote "Building without Secure Boot." 205 bbnote "Building without Secure Boot."
171 rm -rf ${S}/Build/Ovmf$OVMF_DIR_SUFFIX 206 rm -rf ${S}/Build/Ovmf$OVMF_DIR_SUFFIX
172 ${S}/OvmfPkg/build.sh $PARALLEL_JOBS -a $OVMF_ARCH -b RELEASE -t ${FIXED_GCCVER} 207 ${S}/OvmfPkg/build.sh $PARALLEL_JOBS -a $OVMF_ARCH -b RELEASE -t ${FIXED_GCCVER} ${PACKAGECONFIG_CONFARGS}
173 ln ${build_dir}/FV/OVMF.fd ${WORKDIR}/ovmf/ovmf.fd 208 ln ${build_dir}/FV/OVMF.fd ${WORKDIR}/ovmf/ovmf.fd
174 ln ${build_dir}/FV/OVMF_CODE.fd ${WORKDIR}/ovmf/ovmf.code.fd 209 ln ${build_dir}/FV/OVMF_CODE.fd ${WORKDIR}/ovmf/ovmf.code.fd
175 ln ${build_dir}/FV/OVMF_VARS.fd ${WORKDIR}/ovmf/ovmf.vars.fd 210 ln ${build_dir}/FV/OVMF_VARS.fd ${WORKDIR}/ovmf/ovmf.vars.fd
@@ -179,19 +214,19 @@ do_compile_class-target() {
179 # Repeat build with the Secure Boot flags. 214 # Repeat build with the Secure Boot flags.
180 bbnote "Building with Secure Boot." 215 bbnote "Building with Secure Boot."
181 rm -rf ${S}/Build/Ovmf$OVMF_DIR_SUFFIX 216 rm -rf ${S}/Build/Ovmf$OVMF_DIR_SUFFIX
182 ${S}/OvmfPkg/build.sh $PARALLEL_JOBS -a $OVMF_ARCH -b RELEASE -t ${FIXED_GCCVER} ${OVMF_SECURE_BOOT_FLAGS} 217 ${S}/OvmfPkg/build.sh $PARALLEL_JOBS -a $OVMF_ARCH -b RELEASE -t ${FIXED_GCCVER} ${PACKAGECONFIG_CONFARGS} ${OVMF_SECURE_BOOT_FLAGS}
183 ln ${build_dir}/FV/OVMF.fd ${WORKDIR}/ovmf/ovmf.secboot.fd 218 ln ${build_dir}/FV/OVMF.fd ${WORKDIR}/ovmf/ovmf.secboot.fd
184 ln ${build_dir}/FV/OVMF_CODE.fd ${WORKDIR}/ovmf/ovmf.secboot.code.fd 219 ln ${build_dir}/FV/OVMF_CODE.fd ${WORKDIR}/ovmf/ovmf.secboot.code.fd
185 ln ${build_dir}/${OVMF_ARCH}/EnrollDefaultKeys.efi ${WORKDIR}/ovmf/ 220 ln ${build_dir}/${OVMF_ARCH}/EnrollDefaultKeys.efi ${WORKDIR}/ovmf/
186 fi 221 fi
187} 222}
188 223
189do_install_class-native() { 224do_install:class-native() {
190 install -d ${D}/${bindir}/edk2_basetools 225 install -d ${D}/${bindir}/edk2_basetools
191 cp -r ${S}/BaseTools ${D}/${bindir}/${EDK_TOOLS_DIR} 226 cp -r ${S}/BaseTools ${D}/${bindir}/${EDK_TOOLS_DIR}
192} 227}
193 228
194do_install_class-target() { 229do_install:class-target() {
195 # Content for UEFI shell iso. We install the EFI shell as 230 # Content for UEFI shell iso. We install the EFI shell as
196 # bootx64/ia32.efi because then it can be started even when the 231 # bootx64/ia32.efi because then it can be started even when the
197 # firmware itself does not contain it. 232 # firmware itself does not contain it.
@@ -208,19 +243,19 @@ do_install_class-target() {
208# 243#
209# However, EnrollDefaultKeys.efi is only included when Secure Boot is enabled. 244# However, EnrollDefaultKeys.efi is only included when Secure Boot is enabled.
210PACKAGES =+ "ovmf-shell-efi" 245PACKAGES =+ "ovmf-shell-efi"
211FILES_ovmf-shell-efi = " \ 246FILES:ovmf-shell-efi = " \
212 EnrollDefaultKeys.efi \ 247 EnrollDefaultKeys.efi \
213 efi/ \ 248 efi/ \
214" 249"
215 250
216DEPLOYDEP = "" 251DEPLOYDEP = ""
217DEPLOYDEP_class-target = "qemu-system-native:do_populate_sysroot" 252DEPLOYDEP:class-target = "qemu-system-native:do_populate_sysroot"
218DEPLOYDEP_class-target += " ${@bb.utils.contains('PACKAGECONFIG', 'secureboot', 'openssl-native:do_populate_sysroot', '', d)}" 253DEPLOYDEP:class-target += " ${@bb.utils.contains('PACKAGECONFIG', 'secureboot', 'openssl-native:do_populate_sysroot', '', d)}"
219do_deploy[depends] += "${DEPLOYDEP}" 254do_deploy[depends] += "${DEPLOYDEP}"
220 255
221do_deploy() { 256do_deploy() {
222} 257}
223do_deploy_class-target() { 258do_deploy:class-target() {
224 # For use with "runqemu ovmf". 259 # For use with "runqemu ovmf".
225 for i in \ 260 for i in \
226 ovmf \ 261 ovmf \