summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-core/ovmf/ovmf/0001-BaseTools-Force-tools-variables-to-host-toolchain.patch48
-rw-r--r--meta/recipes-core/ovmf/ovmf/0001-OvmfPkg-Enable-BGRT-in-OVMF.patch110
-rw-r--r--meta/recipes-core/ovmf/ovmf/0002-ovmf-update-path-to-native-BaseTools.patch32
-rw-r--r--meta/recipes-core/ovmf/ovmf/0003-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch39
-rw-r--r--meta/recipes-core/ovmf/ovmf_git.bb121
5 files changed, 350 insertions, 0 deletions
diff --git a/meta/recipes-core/ovmf/ovmf/0001-BaseTools-Force-tools-variables-to-host-toolchain.patch b/meta/recipes-core/ovmf/ovmf/0001-BaseTools-Force-tools-variables-to-host-toolchain.patch
new file mode 100644
index 0000000000..644b99d8bc
--- /dev/null
+++ b/meta/recipes-core/ovmf/ovmf/0001-BaseTools-Force-tools-variables-to-host-toolchain.patch
@@ -0,0 +1,48 @@
1From 6e24bde1979c2d7149b37d142fb882dfde0e9770 Mon Sep 17 00:00:00 2001
2From: Matt Fleming <matt.fleming@intel.com>
3Date: Fri, 27 Jun 2014 11:12:18 +0100
4Subject: [PATCH] BaseTools: Force tools variables to host toolchain
5
6Signed-off-by: Matt Fleming <matt.fleming@intel.com>
7---
8 BaseTools/Source/C/Makefiles/app.makefile | 7 +++++++
9 BaseTools/Source/C/VfrCompile/GNUmakefile | 5 +++++
10 2 files changed, 12 insertions(+)
11
12diff --git a/BaseTools/Source/C/Makefiles/app.makefile b/BaseTools/Source/C/Makefiles/app.makefile
13index 19269a1..62aad0f 100644
14--- a/BaseTools/Source/C/Makefiles/app.makefile
15+++ b/BaseTools/Source/C/Makefiles/app.makefile
16@@ -16,6 +16,13 @@ include $(MAKEROOT)/Makefiles/header.makefile
17
18 APPLICATION = $(MAKEROOT)/bin/$(APPNAME)
19
20+CC = gcc
21+CXX = g++
22+AS = gcc
23+AR = ar
24+LD = ld
25+LINKER = $(CC)
26+
27 .PHONY:all
28 all: $(MAKEROOT)/bin $(APPLICATION)
29
30diff --git a/BaseTools/Source/C/VfrCompile/GNUmakefile b/BaseTools/Source/C/VfrCompile/GNUmakefile
31index 82005e1..5ac5f7e 100644
32--- a/BaseTools/Source/C/VfrCompile/GNUmakefile
33+++ b/BaseTools/Source/C/VfrCompile/GNUmakefile
34@@ -26,6 +26,11 @@ OBJECTS = AParser.o DLexerBase.o ATokenBuffer.o EfiVfrParser.o VfrLexer.o VfrSyn
35
36 VFR_CPPFLAGS = -DPCCTS_USE_NAMESPACE_STD $(CPPFLAGS)
37
38+CC = gcc
39+CXX = g++
40+AS = gcc
41+AR = ar
42+LD = ld
43 LINKER = $(BUILD_CXX)
44
45 EXTRA_CLEAN_OBJECTS = EfiVfrParser.cpp EfiVfrParser.h VfrParser.dlg VfrTokens.h VfrLexer.cpp VfrLexer.h VfrSyntax.cpp tokens.h
46--
471.9.0
48
diff --git a/meta/recipes-core/ovmf/ovmf/0001-OvmfPkg-Enable-BGRT-in-OVMF.patch b/meta/recipes-core/ovmf/ovmf/0001-OvmfPkg-Enable-BGRT-in-OVMF.patch
new file mode 100644
index 0000000000..4531a6ddfb
--- /dev/null
+++ b/meta/recipes-core/ovmf/ovmf/0001-OvmfPkg-Enable-BGRT-in-OVMF.patch
@@ -0,0 +1,110 @@
1From 66a4020c3c2163aeffc9757851f33c346ecfd870 Mon Sep 17 00:00:00 2001
2From: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
3Date: Mon, 4 Apr 2016 12:15:12 -0700
4Subject: [PATCH] OvmfPkg: Enable BGRT in OVMF
5
6By default, firmware (OVMF - Open source Virtual Machine Firmware)
7never publishes BGRT (Boot Graphics Resource Table) and in the boot
8process Linux kernel checks for this table and if it fails to find BGRT
9table then corresponding code in Linux kernel is not executed. EDK II
10(EFI Development Kit, thus OVMF) already has BGRT source code packaged
11into it but it is excluded from the build process of OVMF. These changes
12to build system of OVMF enables BGRT in 32-bit and 64-bit OVMF.
13
14There are only two files that need to be modified in order to do this.
15The first one being OvmfPkg*.dsc (this file describes the platform) and
16the second one being OvmfPkg*.fdf (this file describes firmware descriptor
17volume). A *.inf file (here "BootGraphicsResourceTableDxe.inf")
18describes a module (here BGRT). So, include
19"BootGraphicsResourceTableDxe.inf" file in "OvmfPkg*.dsc" so that BGRT
20source code will be compiled and "BootGraphicsResourceTableDxe.efi" file
21is generated and we should also include
22"BootGraphicsResourceTableDxe.inf" file in "OvmfPkg*.fdf" file so that
23"BootGraphicsResourceTableDxe.efi" will be placed in a firmware volume
24and thus gets published.
25
26Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
27---
28 OvmfPkg/OvmfPkgIa32.dsc | 1 +
29 OvmfPkg/OvmfPkgIa32.fdf | 1 +
30 OvmfPkg/OvmfPkgIa32X64.dsc | 1 +
31 OvmfPkg/OvmfPkgIa32X64.fdf | 1 +
32 OvmfPkg/OvmfPkgX64.dsc | 1 +
33 OvmfPkg/OvmfPkgX64.fdf | 1 +
34 6 files changed, 6 insertions(+)
35
36diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
37index 9e5b477..0582219 100644
38--- a/OvmfPkg/OvmfPkgIa32.dsc
39+++ b/OvmfPkg/OvmfPkgIa32.dsc
40@@ -647,6 +647,7 @@
41 OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
42 MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
43 MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
44+ MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
45
46 #
47 # Network Support
48diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
49index fc203f2..f968cb7 100644
50--- a/OvmfPkg/OvmfPkgIa32.fdf
51+++ b/OvmfPkg/OvmfPkgIa32.fdf
52@@ -274,6 +274,7 @@ INF RuleOverride=ACPITABLE OvmfPkg/AcpiTables/AcpiTables.inf
53 INF OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
54 INF MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
55 INF MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
56+INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
57
58 INF RuleOverride = BINARY FatBinPkg/EnhancedFatDxe/Fat.inf
59
60diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
61index 6e4da4f..8289385 100644
62--- a/OvmfPkg/OvmfPkgIa32X64.dsc
63+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
64@@ -656,6 +656,7 @@
65 OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
66 MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
67 MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
68+ MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
69
70 #
71 # Network Support
72diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
73index d3f46f3..282d40b 100644
74--- a/OvmfPkg/OvmfPkgIa32X64.fdf
75+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
76@@ -274,6 +274,7 @@ INF RuleOverride=ACPITABLE OvmfPkg/AcpiTables/AcpiTables.inf
77 INF OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
78 INF MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
79 INF MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
80+INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
81
82 INF RuleOverride = BINARY USE = X64 FatBinPkg/EnhancedFatDxe/Fat.inf
83
84diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
85index 3d6d43e..0f956a7 100644
86--- a/OvmfPkg/OvmfPkgX64.dsc
87+++ b/OvmfPkg/OvmfPkgX64.dsc
88@@ -654,6 +654,7 @@
89 OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
90 MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
91 MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
92+ MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
93
94 #
95 # Network Support
96diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
97index 15ef13a..9708fd5 100644
98--- a/OvmfPkg/OvmfPkgX64.fdf
99+++ b/OvmfPkg/OvmfPkgX64.fdf
100@@ -274,6 +274,7 @@ INF RuleOverride=ACPITABLE OvmfPkg/AcpiTables/AcpiTables.inf
101 INF OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
102 INF MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
103 INF MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
104+INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
105
106 INF RuleOverride = BINARY FatBinPkg/EnhancedFatDxe/Fat.inf
107
108--
1092.7.4
110
diff --git a/meta/recipes-core/ovmf/ovmf/0002-ovmf-update-path-to-native-BaseTools.patch b/meta/recipes-core/ovmf/ovmf/0002-ovmf-update-path-to-native-BaseTools.patch
new file mode 100644
index 0000000000..94029a562f
--- /dev/null
+++ b/meta/recipes-core/ovmf/ovmf/0002-ovmf-update-path-to-native-BaseTools.patch
@@ -0,0 +1,32 @@
1From 9e632e3f9edd09632cc877dff6ea57608f979aab Mon Sep 17 00:00:00 2001
2From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
3Date: Thu, 9 Jun 2016 02:23:01 -0700
4Subject: [PATCH] ovmf: update path to native BaseTools
5
6BaseTools is a set of utilities to build EDK-based firmware. These utilities
7are used during the build process. Thus, they need to be built natively.
8When cross-compiling, we need to provide a path to the location of these
9tools. The BBAKE_EDK_TOOLS_PATH string is used as a pattern to be replaced
10with the appropriate location before building.
11
12Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
13---
14 OvmfPkg/build.sh | 2 +-
15 1 file changed, 1 insertion(+), 1 deletion(-)
16
17diff --git a/OvmfPkg/build.sh b/OvmfPkg/build.sh
18index eb5eb73..9058fca 100755
19--- a/OvmfPkg/build.sh
20+++ b/OvmfPkg/build.sh
21@@ -30,7 +30,7 @@ then
22 # this assumes svn pulls have the same root dir
23 # export EDK_TOOLS_PATH=`pwd`/../BaseTools
24 # This version is for the tools source in edk2
25- export EDK_TOOLS_PATH=`pwd`/BaseTools
26+ export EDK_TOOLS_PATH=BBAKE_EDK_TOOLS_PATH/BaseTools
27 echo $EDK_TOOLS_PATH
28 source edksetup.sh BaseTools
29 else
30--
312.8.1
32
diff --git a/meta/recipes-core/ovmf/ovmf/0003-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch b/meta/recipes-core/ovmf/ovmf/0003-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch
new file mode 100644
index 0000000000..0fdc278ce2
--- /dev/null
+++ b/meta/recipes-core/ovmf/ovmf/0003-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch
@@ -0,0 +1,39 @@
1From 2320650c6d381b914fe91b2dedaa5870279a8bcf Mon Sep 17 00:00:00 2001
2From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
3Date: Sun, 27 Nov 2016 18:42:55 -0800
4Subject: [PATCH] BaseTools: makefile: adjust to build in under bitbake
5
6Prepend the build flags with those of bitbake. This is to build
7using the bitbake native sysroot include and library directories.
8
9Signed-off-by: Ricardo Neri <ricardo.neri@linux.intel.com>
10---
11 BaseTools/Source/C/Makefiles/header.makefile | 8 ++++----
12 1 file changed, 4 insertions(+), 4 deletions(-)
13
14diff --git a/BaseTools/Source/C/Makefiles/header.makefile b/BaseTools/Source/C/Makefiles/header.makefile
15index 821d114..fe0f08b 100644
16--- a/BaseTools/Source/C/Makefiles/header.makefile
17+++ b/BaseTools/Source/C/Makefiles/header.makefile
18@@ -44,14 +44,14 @@ ARCH_INCLUDE = -I $(MAKEROOT)/Include/AArch64/
19 endif
20
21 INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) -I $(MAKEROOT)/Include/Common -I $(MAKEROOT)/Include/ -I $(MAKEROOT)/Include/IndustryStandard -I $(MAKEROOT)/Common/ -I .. -I . $(ARCH_INCLUDE)
22-BUILD_CPPFLAGS = $(INCLUDE) -O2
23+BUILD_CPPFLAGS := $(BUILD_CPPFLAGS) $(INCLUDE) -O2
24 ifeq ($(DARWIN),Darwin)
25 # assume clang or clang compatible flags on OS X
26-BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-self-assign -Wno-unused-result -nostdlib -c -g
27+BUILD_CFLAGS := $(BUILD_CFLAGS) -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-self-assign -Wno-unused-result -nostdlib -c -g
28 else
29-BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-unused-result -nostdlib -c -g
30+BUILD_CFLAGS := $(BUILD_CFLAGS) -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-unused-result -nostdlib -c -g
31 endif
32-BUILD_LFLAGS =
33+BUILD_LFLAGS := $(LDFLAGS)
34 BUILD_CXXFLAGS =
35
36 ifeq ($(ARCH), IA32)
37--
382.9.3
39
diff --git a/meta/recipes-core/ovmf/ovmf_git.bb b/meta/recipes-core/ovmf/ovmf_git.bb
new file mode 100644
index 0000000000..e722db5cd1
--- /dev/null
+++ b/meta/recipes-core/ovmf/ovmf_git.bb
@@ -0,0 +1,121 @@
1DESCRIPTION = "OVMF - UEFI firmware for Qemu and KVM"
2HOMEPAGE = "http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF"
3LICENSE = "BSD"
4LIC_FILES_CHKSUM = "file://OvmfPkg/License.txt;md5=343dc88e82ff33d042074f62050c3496"
5
6SRC_URI = "git://github.com/tianocore/edk2.git;branch=master \
7 file://0001-BaseTools-Force-tools-variables-to-host-toolchain.patch \
8 file://0001-OvmfPkg-Enable-BGRT-in-OVMF.patch \
9 file://0002-ovmf-update-path-to-native-BaseTools.patch \
10 file://0003-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch \
11 "
12
13SRCREV="4575a602ca6072ee9d04150b38bfb143cbff8588"
14
15PARALLEL_MAKE = ""
16
17S = "${WORKDIR}/git"
18
19DEPENDS_class-native="util-linux-native iasl-native ossp-uuid-native"
20
21DEPENDS_class-target="ovmf-native"
22
23EDK_TOOLS_DIR="edk2_basetools"
24
25# OVMF has trouble building with the default optimization of -O2.
26BUILD_OPTIMIZATION="-pipe"
27
28# OVMF supports IA only, although it could conceivably support ARM someday.
29COMPATIBLE_HOST='(i.86|x86_64).*'
30
31do_patch_append_class-native() {
32 bb.build.exec_func('do_fix_iasl', d)
33 bb.build.exec_func('do_fix_toolchain', d)
34}
35
36do_fix_basetools_location() {
37 sed -i -e 's#BBAKE_EDK_TOOLS_PATH#${STAGING_BINDIR_NATIVE}/${EDK_TOOLS_DIR}#' ${S}/OvmfPkg/build.sh
38}
39
40do_patch_append_class-target() {
41 bb.build.exec_func('do_fix_basetools_location', d)
42}
43
44
45do_fix_iasl() {
46 sed -i -e 's#/usr/bin/iasl#${STAGING_BINDIR_NATIVE}/iasl#' ${S}/BaseTools/Conf/tools_def.template
47}
48
49do_fix_toolchain(){
50 sed -i -e 's#DEF(ELFGCC_BIN)/#${TARGET_PREFIX}#' ${S}/BaseTools/Conf/tools_def.template
51 sed -i -e 's#DEF(GCC.*PREFIX)#${TARGET_PREFIX}#' ${S}/BaseTools/Conf/tools_def.template
52 sed -i -e "s#^LINKER\(.*\)#LINKER\1\nLFLAGS += ${BUILD_LDFLAGS}#" ${S}/BaseTools/Source/C/Makefiles/app.makefile
53 sed -i -e "s#^LINKER\(.*\)#LINKER\1\nCFLAGS += ${BUILD_CFLAGS}#" ${S}/BaseTools/Source/C/Makefiles/app.makefile
54 sed -i -e "s#^LINKER\(.*\)#LINKER\1\nLFLAGS += ${BUILD_LDFLAGS}#" ${S}/BaseTools/Source/C/VfrCompile/GNUmakefile
55 sed -i -e "s#^LINKER\(.*\)#LINKER\1\nCFLAGS += ${BUILD_CFLAGS}#" ${S}/BaseTools/Source/C/VfrCompile/GNUmakefile
56}
57
58GCC_VER="$(${CC} -v 2>&1 | tail -n1 | awk '{print $3}')"
59
60fixup_target_tools() {
61 case ${1} in
62 4.4.*)
63 FIXED_GCCVER=GCC44
64 ;;
65 4.5.*)
66 FIXED_GCCVER=GCC45
67 ;;
68 4.6.*)
69 FIXED_GCCVER=GCC46
70 ;;
71 4.7.*)
72 FIXED_GCCVER=GCC47
73 ;;
74 4.8.*)
75 FIXED_GCCVER=GCC48
76 ;;
77 4.9.*)
78 FIXED_GCCVER=GCC49
79 ;;
80 *)
81 FIXED_GCCVER=GCC5
82 ;;
83 esac
84 echo ${FIXED_GCCVER}
85}
86
87do_compile_class-native() {
88 oe_runmake -C ${S}/BaseTools
89}
90
91do_compile_class-target() {
92 export LFLAGS="${LDFLAGS}"
93 OVMF_ARCH="X64"
94 if [ "${TARGET_ARCH}" != "x86_64" ] ; then
95 OVMF_ARCH="IA32"
96 fi
97
98 FIXED_GCCVER=$(fixup_target_tools ${GCC_VER})
99 echo FIXED_GCCVER is ${FIXED_GCCVER}
100 ${S}/OvmfPkg/build.sh -a $OVMF_ARCH -b RELEASE -t ${FIXED_GCCVER}
101}
102
103do_install_class-native() {
104 install -d ${D}/${bindir}/edk2_basetools
105 cp -r ${S}/BaseTools ${D}/${bindir}/${EDK_TOOLS_DIR}
106}
107
108do_install_class-target() {
109 OVMF_DIR_SUFFIX="X64"
110 if [ "${TARGET_ARCH}" != "x86_64" ] ; then
111 OVMF_DIR_SUFFIX="Ia32" # Note the different capitalization
112 fi
113 install -d ${D}${datadir}/ovmf
114
115 FIXED_GCCVER=$(fixup_target_tools ${GCC_VER})
116 build_dir="${S}/Build/Ovmf$OVMF_DIR_SUFFIX/RELEASE_${FIXED_GCCVER}"
117 install -m 0755 ${build_dir}/FV/OVMF.fd \
118 ${D}${datadir}/ovmf/bios.bin
119}
120
121BBCLASSEXTEND = "native"