From 1b36c9de66eb91981983df21e7f3c05c19a15709 Mon Sep 17 00:00:00 2001 From: Piotr Kubaj Date: Wed, 17 May 2017 20:33:47 +0200 Subject: [PATCH] nvramtool: Fix build with OpenBSD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OpenBSD needs the same includes as NetBSD. It also doesn't have x86_64_iopl function, but amd64_iopl. Change-Id: I28273d4d87a3a77cf35412a0695325c0535e42e5 Signed-off-by: Piotr Kubaj Reviewed-on: https://review.coreboot.org/19741 Tested-by: build bot (Jenkins) Reviewed-by: Arthur Heymans Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Philipp Deppenwiese --- util/nvramtool/Makefile | 2 +- util/nvramtool/accessors/cmos-hw-unix.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/util/nvramtool/Makefile b/util/nvramtool/Makefile index bb623bbe1a..8da7c76c8c 100644 --- a/util/nvramtool/Makefile +++ b/util/nvramtool/Makefile @@ -34,7 +34,7 @@ OS_ARCH = $(shell uname) ifeq ($(OS_ARCH), Darwin) LDFLAGS = -framework DirectHW endif -ifeq ($(OS_ARCH), NetBSD) +ifeq ($(OS_ARCH),$(filter $(OS_ARCH),NetBSD OpenBSD)) LDFLAGS = -l$(shell uname -p) endif ifeq ($(shell uname -o 2>/dev/null), Cygwin) diff --git a/util/nvramtool/accessors/cmos-hw-unix.c b/util/nvramtool/accessors/cmos-hw-unix.c index 33d699415f..c66fa3e365 100644 --- a/util/nvramtool/accessors/cmos-hw-unix.c +++ b/util/nvramtool/accessors/cmos-hw-unix.c @@ -17,7 +17,7 @@ #if (defined(__MACH__) && defined(__APPLE__)) #include #endif -#if defined(__NetBSD__) +#if defined(__NetBSD__) || defined(__OpenBSD__) #if defined(__i386__) || defined(__x86_64__) #include @@ -58,8 +58,12 @@ static inline uint32_t inl(uint16_t port) } #endif #ifdef __x86_64__ +#ifdef __OpenBSD__ +#define iopl amd64_iopl +#else #define iopl x86_64_iopl #endif +#endif #ifdef __i386__ #define iopl i386_iopl #endif