diff options
-rw-r--r-- | meta/recipes-core/ovmf/ovmf/0001-BaseTools-Force-tools-variables-to-host-toolchain.patch | 48 | ||||
-rw-r--r-- | meta/recipes-core/ovmf/ovmf_git.bb | 68 |
2 files changed, 50 insertions, 66 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 deleted file mode 100644 index 644b99d8bc..0000000000 --- a/meta/recipes-core/ovmf/ovmf/0001-BaseTools-Force-tools-variables-to-host-toolchain.patch +++ /dev/null | |||
@@ -1,48 +0,0 @@ | |||
1 | From 6e24bde1979c2d7149b37d142fb882dfde0e9770 Mon Sep 17 00:00:00 2001 | ||
2 | From: Matt Fleming <matt.fleming@intel.com> | ||
3 | Date: Fri, 27 Jun 2014 11:12:18 +0100 | ||
4 | Subject: [PATCH] BaseTools: Force tools variables to host toolchain | ||
5 | |||
6 | Signed-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 | |||
12 | diff --git a/BaseTools/Source/C/Makefiles/app.makefile b/BaseTools/Source/C/Makefiles/app.makefile | ||
13 | index 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 | |||
30 | diff --git a/BaseTools/Source/C/VfrCompile/GNUmakefile b/BaseTools/Source/C/VfrCompile/GNUmakefile | ||
31 | index 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 | -- | ||
47 | 1.9.0 | ||
48 | |||
diff --git a/meta/recipes-core/ovmf/ovmf_git.bb b/meta/recipes-core/ovmf/ovmf_git.bb index a658c9d115..898c5b76af 100644 --- a/meta/recipes-core/ovmf/ovmf_git.bb +++ b/meta/recipes-core/ovmf/ovmf_git.bb | |||
@@ -11,7 +11,6 @@ PACKAGECONFIG ??= "" | |||
11 | PACKAGECONFIG[secureboot] = ",,," | 11 | PACKAGECONFIG[secureboot] = ",,," |
12 | 12 | ||
13 | SRC_URI = "git://github.com/tianocore/edk2.git;branch=master \ | 13 | SRC_URI = "git://github.com/tianocore/edk2.git;branch=master \ |
14 | file://0001-BaseTools-Force-tools-variables-to-host-toolchain.patch \ | ||
15 | file://0002-ovmf-update-path-to-native-BaseTools.patch \ | 14 | file://0002-ovmf-update-path-to-native-BaseTools.patch \ |
16 | file://0003-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch \ | 15 | file://0003-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch \ |
17 | file://VfrCompile-increase-path-length-limit.patch \ | 16 | file://VfrCompile-increase-path-length-limit.patch \ |
@@ -51,31 +50,54 @@ COMPATIBLE_HOST='(i.86|x86_64).*' | |||
51 | OVMF_SECURE_BOOT_EXTRA_FLAGS ??= "" | 50 | OVMF_SECURE_BOOT_EXTRA_FLAGS ??= "" |
52 | OVMF_SECURE_BOOT_FLAGS = "-DSECURE_BOOT_ENABLE=TRUE ${OVMF_SECURE_BOOT_EXTRA_FLAGS}" | 51 | OVMF_SECURE_BOOT_FLAGS = "-DSECURE_BOOT_ENABLE=TRUE ${OVMF_SECURE_BOOT_EXTRA_FLAGS}" |
53 | 52 | ||
54 | do_patch_append_class-native() { | 53 | do_patch[postfuncs] += "fix_basetools_location" |
55 | bb.build.exec_func('do_fix_iasl', d) | 54 | fix_basetools_location () { |
56 | bb.build.exec_func('do_fix_toolchain', d) | ||
57 | } | 55 | } |
58 | 56 | fix_basetools_location_class-target() { | |
59 | do_fix_basetools_location() { | 57 | # Replaces the fake path inserted by 0002-ovmf-update-path-to-native-BaseTools.patch. |
58 | # Necessary for finding the actual BaseTools from ovmf-native. | ||
60 | sed -i -e 's#BBAKE_EDK_TOOLS_PATH#${STAGING_BINDIR_NATIVE}/${EDK_TOOLS_DIR}#' ${S}/OvmfPkg/build.sh | 59 | sed -i -e 's#BBAKE_EDK_TOOLS_PATH#${STAGING_BINDIR_NATIVE}/${EDK_TOOLS_DIR}#' ${S}/OvmfPkg/build.sh |
61 | } | 60 | } |
62 | 61 | ||
63 | do_patch_append_class-target() { | 62 | do_patch[postfuncs] += "fix_iasl" |
64 | bb.build.exec_func('do_fix_basetools_location', d) | 63 | fix_iasl() { |
65 | } | 64 | } |
66 | 65 | fix_iasl_class-native() { | |
67 | 66 | # iasl is not installed under /usr/bin when building with OE. | |
68 | do_fix_iasl() { | ||
69 | sed -i -e 's#/usr/bin/iasl#${STAGING_BINDIR_NATIVE}/iasl#' ${S}/BaseTools/Conf/tools_def.template | 67 | sed -i -e 's#/usr/bin/iasl#${STAGING_BINDIR_NATIVE}/iasl#' ${S}/BaseTools/Conf/tools_def.template |
70 | } | 68 | } |
71 | 69 | ||
72 | do_fix_toolchain(){ | 70 | # Inject CC and friends into the build. LINKER already is in GNUmakefile. |
73 | sed -i -e 's#DEF(ELFGCC_BIN)/#${TARGET_PREFIX}#' ${S}/BaseTools/Conf/tools_def.template | 71 | # Must be idempotent and thus remove old assignments that were inserted |
74 | sed -i -e 's#DEF(GCC.*PREFIX)#${TARGET_PREFIX}#' ${S}/BaseTools/Conf/tools_def.template | 72 | # earlier. |
75 | sed -i -e "s#^LINKER\(.*\)#LINKER\1\nLFLAGS += ${BUILD_LDFLAGS}#" ${S}/BaseTools/Source/C/Makefiles/app.makefile | 73 | do_patch[postfuncs] += "fix_toolchain" |
76 | sed -i -e "s#^LINKER\(.*\)#LINKER\1\nCFLAGS += ${BUILD_CFLAGS}#" ${S}/BaseTools/Source/C/Makefiles/app.makefile | 74 | fix_toolchain() { |
77 | sed -i -e "s#^LINKER\(.*\)#LINKER\1\nLFLAGS += ${BUILD_LDFLAGS}#" ${S}/BaseTools/Source/C/VfrCompile/GNUmakefile | 75 | sed -i \ |
78 | sed -i -e "s#^LINKER\(.*\)#LINKER\1\nCFLAGS += ${BUILD_CFLAGS}#" ${S}/BaseTools/Source/C/VfrCompile/GNUmakefile | 76 | -e '/^\(CC\|CXX\|AS\|AR\|LD\|LINKER\) =/d' \ |
77 | -e '/^APPLICATION/a CC = ${CC}\nCXX = ${CXX}\nAS = ${AS}\nAR = ${AR}\nLD = ${LD}\nLINKER = $(CC)' \ | ||
78 | ${S}/BaseTools/Source/C/Makefiles/app.makefile | ||
79 | sed -i \ | ||
80 | -e '/^\(CC\|CXX\|AS\|AR\|LD\)/d' \ | ||
81 | -e '/^VFR_CPPFLAGS/a CC = ${CC}\nCXX = ${CXX}\nAS = ${AS}\nAR = ${AR}\nLD = ${LD}' \ | ||
82 | ${S}/BaseTools/Source/C/VfrCompile/GNUmakefile | ||
83 | } | ||
84 | fix_toolchain_append_class-native() { | ||
85 | # This tools_def.template is going to be used by the target ovmf and | ||
86 | # defines which compilers to use. For the GCC toolchain definitions, | ||
87 | # that will be ${HOST_PREFIX}gcc. However, "make" doesn't need that | ||
88 | # prefix. | ||
89 | # | ||
90 | # Injecting ENV(HOST_PREFIX) matches exporting that value as env | ||
91 | # variable in do_compile_class-target. | ||
92 | sed -i \ | ||
93 | -e 's#\(ENV\|DEF\)(GCC.*_PREFIX)#ENV(HOST_PREFIX)#' \ | ||
94 | -e 's#ENV(HOST_PREFIX)make#make#' \ | ||
95 | ${S}/BaseTools/Conf/tools_def.template | ||
96 | sed -i \ | ||
97 | -e '/^\(LFLAGS\|CFLAGS\) +=/d' \ | ||
98 | -e '/^LINKER/a LFLAGS += ${BUILD_LDFLAGS}\nCFLAGS += ${BUILD_CFLAGS}' \ | ||
99 | ${S}/BaseTools/Source/C/Makefiles/app.makefile \ | ||
100 | ${S}/BaseTools/Source/C/VfrCompile/GNUmakefile | ||
79 | } | 101 | } |
80 | 102 | ||
81 | GCC_VER="$(${CC} -v 2>&1 | tail -n1 | awk '{print $3}')" | 103 | GCC_VER="$(${CC} -v 2>&1 | tail -n1 | awk '{print $3}')" |
@@ -119,6 +141,16 @@ do_compile_class-target() { | |||
119 | OVMF_ARCH="IA32" | 141 | OVMF_ARCH="IA32" |
120 | fi | 142 | fi |
121 | 143 | ||
144 | # The build for the target uses BaseTools/Conf/tools_def.template | ||
145 | # from ovmf-native to find the compiler, which depends on | ||
146 | # exporting HOST_PREFIX. | ||
147 | export HOST_PREFIX="${HOST_PREFIX}" | ||
148 | |||
149 | # BaseTools/Conf gets copied to Conf, but only if that does not | ||
150 | # exist yet. To ensure that an updated template gets used during | ||
151 | # incremental builds, we need to remove the copy before we start. | ||
152 | rm -f `ls ${S}/Conf/*.txt | grep -v ReadMe.txt` | ||
153 | |||
122 | # ${WORKDIR}/ovmf is a well-known location where do_install and | 154 | # ${WORKDIR}/ovmf is a well-known location where do_install and |
123 | # do_deploy will be able to find the files. | 155 | # do_deploy will be able to find the files. |
124 | rm -rf ${WORKDIR}/ovmf | 156 | rm -rf ${WORKDIR}/ovmf |