Alex James has uploaded this change for review. ( https://review.coreboot.org/c/vboot/+/60217 )
Change subject: vboot: Fix compilation on macOS hosts ......................................................................
vboot: Fix compilation on macOS hosts
Signed-off-by: Alex James theracermaster@gmail.com Change-Id: Ifca476620386260835d75e58f1e316b2d281e4af --- M Makefile M cgpt/cgpt_endian.h M firmware/2lib/2crypto.c M futility/dump_kernel_config_lib.c M host/arch/x86/lib/crossystem_arch.c 5 files changed, 15 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/vboot refs/changes/17/60217/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/cgpt/cgpt_endian.h b/cgpt/cgpt_endian.h index f59ab1b..8a5886b 100644 --- a/cgpt/cgpt_endian.h +++ b/cgpt/cgpt_endian.h @@ -9,6 +9,11 @@ // Newer distros already have this. For those that don't, we add it here. #if !defined(HAVE_MACOS) && !defined(__FreeBSD__) #include <endian.h> +#elif defined(HAVE_MACOS) +#include <machine/endian.h> +#define __BYTE_ORDER BYTE_ORDER +#define __LITTLE_ENDIAN LITTLE_ENDIAN +#define __BIG_ENDIAN BIG_ENDIAN #elif defined(__FreeBSD__) #include <sys/endian.h> #endif diff --git a/firmware/2lib/2crypto.c b/firmware/2lib/2crypto.c index 0c0978d..6b3c1c4 100644 --- a/firmware/2lib/2crypto.c +++ b/firmware/2lib/2crypto.c @@ -19,7 +19,9 @@ * they are only allocatable (a) but not writeable (w). */
+#ifndef CHROMEOS_ENVIRONMENT __attribute__((section(".rodata.vb2_sig_names,"a"\n# "))) +#endif const char *vb2_sig_names[VB2_SIG_ALG_COUNT] = { [VB2_SIG_NONE] = "none", [VB2_SIG_RSA1024] = "RSA1024", @@ -30,7 +32,9 @@ [VB2_SIG_RSA3072_EXP3] = "RSA3072EXP3", };
+#ifndef CHROMEOS_ENVIRONMENT __attribute__((section(".rodata.vb2_hash_names,"a"\n# "))) +#endif const char *vb2_hash_names[VB2_HASH_ALG_COUNT] = { [VB2_HASH_NONE] = "none", #if VB2_SUPPORT_SHA1 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..38c1a7e 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(__APPLE__) && !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(__APPLE__) && !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(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) if (KERNEL_VERSION(maj, min, 0) >= KERNEL_VERSION(4, 16, 0) && *offset > 11) *offset += 3;