"-Wno-error=unused-result" is added to BUILD_CFLAGS to bypass ubuntu check for fread return not being checked.
Use BUILD_* variables for native compilation instead of hardcoding the tools
Signed-off-by: Khem Raj raj.khem@gmail.com --- .../uefi/edk2/0001-Check-the-result-of-fread.patch | 42 ++++++++++++++++++++++ ...OE-to-let-it-provide-its-own-native-sysro.patch | 35 ++++++++++++++++++ recipes-bsp/uefi/edk2_git.bb | 5 +++ 3 files changed, 82 insertions(+) create mode 100644 recipes-bsp/uefi/edk2/0001-Check-the-result-of-fread.patch create mode 100644 recipes-bsp/uefi/edk2/0001-accomodate-OE-to-let-it-provide-its-own-native-sysro.patch
diff --git a/recipes-bsp/uefi/edk2/0001-Check-the-result-of-fread.patch b/recipes-bsp/uefi/edk2/0001-Check-the-result-of-fread.patch new file mode 100644 index 0000000..5bcfd4f --- /dev/null +++ b/recipes-bsp/uefi/edk2/0001-Check-the-result-of-fread.patch @@ -0,0 +1,42 @@ +From fd11433c7ba4d78da765c80b32eca63a8abe436d Mon Sep 17 00:00:00 2001 +From: Khem Raj raj.khem@gmail.com +Date: Fri, 8 May 2015 00:30:53 -0700 +Subject: [PATCH] Check the result of fread() + +Fixes build errors on newer ubuntu machines + +| SimpleFileParsing.c: In function 'ProcessFile': +| SimpleFileParsing.c:705:3: error: ignoring return value of 'fread', +declared with attribute warn_unused_result [-Werror=unused-result] +| fread ((VOID *) SourceFile->FileBuffer, SourceFile->FileSize, 1, +SourceFile->Fptr); +| ^ +| cc1: all warnings being treated as errors +| ../Makefiles/footer.makefile:27: recipe for target +'SimpleFileParsing.o' failed + +Signed-off-by: Khem Raj raj.khem@gmail.com +--- + BaseTools/Source/C/Common/SimpleFileParsing.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/BaseTools/Source/C/Common/SimpleFileParsing.c b/BaseTools/Source/C/Common/SimpleFileParsing.c +index 877bb6f..d11ac38 100644 +--- a/BaseTools/Source/C/Common/SimpleFileParsing.c ++++ b/BaseTools/Source/C/Common/SimpleFileParsing.c +@@ -702,7 +702,11 @@ Returns: + return STATUS_ERROR; + } + +- fread ((VOID *) SourceFile->FileBuffer, SourceFile->FileSize, 1, SourceFile->Fptr); ++ size_t sz = fread ((VOID *) SourceFile->FileBuffer, SourceFile->FileSize, 1, SourceFile->Fptr); ++ if (sz != SourceFile->FileSize) { ++ Error (NULL, 0, 4001, "Resource: Unable to read data from file", NULL); ++ return STATUS_ERROR; ++ } + SourceFile->FileBuffer[(SourceFile->FileSize / sizeof (CHAR8 ))] = T_CHAR_NULL; + // + // Pre-process the file to replace comments with spaces +-- +2.1.4 + diff --git a/recipes-bsp/uefi/edk2/0001-accomodate-OE-to-let-it-provide-its-own-native-sysro.patch b/recipes-bsp/uefi/edk2/0001-accomodate-OE-to-let-it-provide-its-own-native-sysro.patch new file mode 100644 index 0000000..e7feded --- /dev/null +++ b/recipes-bsp/uefi/edk2/0001-accomodate-OE-to-let-it-provide-its-own-native-sysro.patch @@ -0,0 +1,35 @@ +From f22bad85283f8cdb15e0b508c44c181e33cb5296 Mon Sep 17 00:00:00 2001 +From: Khem Raj raj.khem@gmail.com +Date: Fri, 8 May 2015 00:18:05 -0700 +Subject: [PATCH] accomodate OE to let it provide its own native sysroot + +We need util-linux for uuid stuff from build host otherwise + +Signed-off-by: Khem Raj raj.khem@gmail.com +--- + BaseTools/Source/C/Makefiles/header.makefile | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +Index: git/BaseTools/Source/C/Makefiles/header.makefile +=================================================================== +--- git.orig/BaseTools/Source/C/Makefiles/header.makefile ++++ git/BaseTools/Source/C/Makefiles/header.makefile +@@ -21,12 +21,12 @@ CYGWIN:=$(findstring CYGWIN, $(shell una + LINUX:=$(findstring Linux, $(shell uname -s)) + DARWIN:=$(findstring Darwin, $(shell uname -s)) + +-CC = gcc +-CXX = g++ +-AS = gcc +-AR = ar +-LD = ld +-LINKER ?= $(CC) ++CC = $(BUILD_CC) $(BUILD_CFLAGS) ++CXX = $(BUILD_CXX) ++AS = $(BUILD_GCC) ++AR = $(BUILD_AR) ++LD = $(BUILD_LD) $(BUILD_LDFLAGS) ++LINKER ?= $(CC) $(BUILD_LDFLAGS) + ifeq ($(ARCH), IA32) + ARCH_INCLUDE = -I $(MAKEROOT)/Include/Ia32/ + endif diff --git a/recipes-bsp/uefi/edk2_git.bb b/recipes-bsp/uefi/edk2_git.bb index dd20d62..adf9863 100644 --- a/recipes-bsp/uefi/edk2_git.bb +++ b/recipes-bsp/uefi/edk2_git.bb @@ -4,6 +4,8 @@ LICENSE = "BSD" LIC_FILES_CHKSUM = "file://BaseTools/License.txt;md5=a041d47c90fd51b4514d09a5127210e6 \ "
+DEPENDS += "util-linux-native" + inherit deploy
PV = "0.0+${SRCPV}" @@ -23,6 +25,8 @@ SRCREV_uefitools = "1a4887ae459b4c6242ac94fc5342c6c7200fb66c" SRC_URI = "git://github.com/96boards/edk2.git;name=edk2;branch=${EDKBRANCH} \ git://github.com/96boards/arm-trusted-firmware.git;name=atf;branch=${ATFBRANCH};destsuffix=git/atf \ git://git.linaro.org/uefi/uefi-tools.git;name=uefitools;destsuffix=git/uefi-tools \ + file://0001-accomodate-OE-to-let-it-provide-its-own-native-sysro.patch \ + file://0001-Check-the-result-of-fread.patch \ "
S = "${WORKDIR}/git" @@ -36,6 +40,7 @@ export CROSS_COMPILE_32 = "${TARGET_PREFIX}" # Workaround a gcc 4.9 feature # https://lists.96boards.org/pipermail/dev/2015-March/000146.html CFLAGS = " -fno-delete-null-pointer-checks" +BUILD_CFLAGS += "-Wno-error=unused-result"
# This is a bootloader, so unset OE LDFLAGS. # OE assumes ld==gcc and passes -Wl,foo