Alex James has uploaded this change for review. ( https://review.coreboot.org/c/vboot/+/60234 )
Change subject: vboot: Ignore Linux-specific definitions on macOS ......................................................................
vboot: Ignore Linux-specific definitions on macOS
vboot already has several preprocessor checks to avoid Linux-specific code on macOS, FreeBSD, and OpenBSD. This change automatically adds HAVE_MACOS to CFLAGS on macOS hosts and adds some missing preprocessor checks. This resolves various errors when compiling coreboot on macOS 10.15.7.
Signed-off-by: Alex James theracermaster@gmail.com Change-Id: Ie5cfd63d6cb17c16ec6a461589b4bc82cf668d73 --- M Makefile M futility/dump_kernel_config_lib.c M host/arch/x86/lib/crossystem_arch.c 3 files changed, 6 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/vboot refs/changes/34/60234/1
diff --git a/Makefile b/Makefile index 25539c7..a59bf0d 100644 --- a/Makefile +++ b/Makefile @@ -252,7 +252,7 @@ COV_INFO = ${BUILD}/coverage.info endif
-ifdef HAVE_MACOS +ifeq ($(shell uname -s), Darwin) CFLAGS += -DHAVE_MACOS -Wno-deprecated-declarations endif
diff --git a/futility/dump_kernel_config_lib.c b/futility/dump_kernel_config_lib.c index ff39c41..9efd5c0 100644 --- a/futility/dump_kernel_config_lib.c +++ b/futility/dump_kernel_config_lib.c @@ -10,7 +10,7 @@ #include <string.h> #include <sys/mman.h> #include <sys/stat.h> -#if !defined (__FreeBSD__) && !defined(__OpenBSD__) +#if !defined(HAVE_MACOS) && !defined(__FreeBSD__) && !defined(__OpenBSD__) #include <sys/sysmacros.h> #endif #include <sys/types.h> @@ -125,7 +125,7 @@ char *newstr = NULL;
int fd = open(infile, O_RDONLY | O_CLOEXEC -#if !defined(__FreeBSD__) && !defined(__OpenBSD__) +#if !defined(HAVE_MACOS) && !defined(__FreeBSD__) && !defined(__OpenBSD__) | O_LARGEFILE #endif ); diff --git a/host/arch/x86/lib/crossystem_arch.c b/host/arch/x86/lib/crossystem_arch.c index e805e2a..3cc441f 100644 --- a/host/arch/x86/lib/crossystem_arch.c +++ b/host/arch/x86/lib/crossystem_arch.c @@ -7,7 +7,7 @@ #include <dirent.h> #include <errno.h> #include <fcntl.h> -#if !defined(__FreeBSD__) && !defined(__OpenBSD__) +#if !defined(HAVE_MACOS) && !defined(__FreeBSD__) && !defined(__OpenBSD__) #include <linux/nvram.h> #include <linux/version.h> #endif @@ -100,7 +100,7 @@
static void VbFixCmosChecksum(FILE* file) { -#if !defined(__FreeBSD__) && !defined(__OpenBSD__) +#if !defined(HAVE_MACOS) && !defined(__FreeBSD__) && !defined(__OpenBSD__) int fd = fileno(file); ioctl(fd, NVRAM_SETCKS); #endif @@ -666,7 +666,7 @@
if (uname(&host) == 0) { if (sscanf(host.release, "%u.%u.", &maj, &min) == 2) { -#if !defined(__FreeBSD__) && !defined(__OpenBSD__) +#if !defined(HAVE_MACOS) && !defined(__FreeBSD__) && !defined(__OpenBSD__) if (KERNEL_VERSION(maj, min, 0) >= KERNEL_VERSION(4, 16, 0) && *offset > 11) *offset += 3;