Skip to contentSkip to conversation

ovmf-native: fix compile issue on new OS like FC27 and Ubuntu 17

PATCH New Armin Kuster 1 participant 1 message Feb 25, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ovmf-native: fix compile issue on new OS like FC27 and Ubuntu 17

Fixed this error:
| VfrUtilityLib.cpp:3375:26: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]

|    if (mStringFileName == '\0' ) {
|                           ^~~~
| VfrUtilityLib.cpp:3398:9: warning: ignoring return value of ‘size_t
fread(void*, size_t, size_t, FILE*)’, declared with attribute
warn_unused_result [-Wunused-result]
|    fread ((char *)StringPtr, sizeof (UINT8), Length, pInFile);
|    ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| ../Makefiles/footer.makefile:30: recipe for target 'VfrUtilityLib.o'

failed

[Yocto #12530]

---
 ...fix-invalid-comparison-between-pointer-an.patch | 32 ++++++++++++++++++++++
 meta/recipes-core/ovmf/ovmf_git.bb                 |  1 +
 2 files changed, 33 insertions(+)
 create mode 100644 meta/recipes-core/ovmf/ovmf/0001-VfrCompile-fix-invalid-comparison-between-pointer-an.patch
meta/recipes-core/ovmf/ovmf/0001-VfrCompile-fix-invalid-comparison-between-pointer-an.patch new file +32 -0
new file mode 100644
index 0000000..43bfce4
@@ -0,0 +1,32 @@
+From d37fa01fbbe2cf0cd8b49069a71706a33cb4a53e Mon Sep 17 00:00:00 2001
+From: Paolo Bonzini <[email protected]>
+Date: Mon, 13 Feb 2017 20:54:00 +0800
+Subject: [PATCH] VfrCompile: fix invalid comparison between pointer and
+ integer
+
+This would be valid C but is not valid C++, so change the comparison to do what it has always been doing.
+
+Contributed-under: TianoCore Contribution Agreement 1.0
+Signed-off-by: Paolo Bonzini <[email protected]>
+Reviewed-by: Yonghong Zhu <[email protected]>
+
+Upstream-Status: Backport
+Signed-off-by: Armin Kuster <[email protected]>
+
+---
+ BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: git/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
+===================================================================
+--- git.orig/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
++++ git/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
+@@ -3372,7 +3372,7 @@ CVfrStringDB::GetVarStoreNameFormStringI
+   UINT8       BlockType;
+   EFI_HII_STRING_PACKAGE_HDR *PkgHeader;
+   
+-  if (mStringFileName == '\0' ) {
++  if (mStringFileName == NULL) {
+     return NULL;
+   }
+ 
meta/recipes-core/ovmf/ovmf_git.bb +1 -0
index 9d988e9..4ddfb47 100644
@@ -15,6 +15,7 @@ SRC_URI = "git://github.com/tianocore/edk2.git;branch=master \
 	file://0003-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch \
 	file://VfrCompile-increase-path-length-limit.patch \
         file://0001-MdeModulePkg-UefiHiiLib-Fix-incorrect-comparison-exp.patch \
+        file://0001-VfrCompile-fix-invalid-comparison-between-pointer-an.patch \
         "
 
 SRC_URI_append_class-target = " \
Signature · 1 line
2.7.4