diff options
-rw-r--r-- | Makefile | 8 | ||||
-rw-r--r-- | cgpt/cgpt.h | 2 | ||||
-rw-r--r-- | cgpt/cgpt_common.c | 6 | ||||
-rw-r--r-- | futility/cmd_vbutil_kernel.c | 4 | ||||
-rw-r--r-- | futility/dump_kernel_config_lib.c | 4 | ||||
-rw-r--r-- | futility/misc.c | 4 | ||||
-rw-r--r-- | futility/updater_archive.c | 3 | ||||
-rw-r--r-- | futility/updater_utils.c | 2 | ||||
-rw-r--r-- | host/arch/x86/lib/crossystem_arch.c | 6 |
9 files changed, 25 insertions, 14 deletions
@@ -373,6 +373,9 @@ INCLUDES += \ ifeq (${FIRMWARE_ARCH},) INCLUDES += -Ihost/include -Ihost/lib/include INCLUDES += -Ihost/lib21/include +ifeq ($(shell uname -s), OpenBSD) +INCLUDES += -I/usr/local/include +endif endif # Firmware library, used by the other firmware components (depthcharge, @@ -963,6 +966,8 @@ cgpt: ${CGPT} $(if ${GPT_SPI_NOR},cgpt_wrapper) # on FreeBSD: install misc/e2fsprogs-libuuid from ports, # or e2fsprogs-libuuid from its binary package system. +# on OpenBSD: install sysutils/e2fsprogs from ports, +# or e2fsprogs from its binary package system, to install uuid/uid.h ${CGPT}: LDLIBS += -luuid ${CGPT}: ${CGPT_OBJS} ${UTILLIB} @@ -1138,6 +1143,9 @@ CRYPTO_LIBS := $(shell ${PKG_CONFIG} --libs libcrypto) ifeq ($(shell uname -s), FreeBSD) CRYPTO_LIBS += -lcrypto endif +ifeq ($(shell uname -s), OpenBSD) +LDFLAGS += -Wl,-z,notext +endif ${BUILD}/utility/dumpRSAPublicKey: LDLIBS += ${CRYPTO_LIBS} ${BUILD}/utility/pad_digest_utility: LDLIBS += ${CRYPTO_LIBS} diff --git a/cgpt/cgpt.h b/cgpt/cgpt.h index 0747b5ce..89c357e8 100644 --- a/cgpt/cgpt.h +++ b/cgpt/cgpt.h @@ -7,7 +7,7 @@ #define VBOOT_REFERENCE_CGPT_H_ #include <fcntl.h> -#if !defined(HAVE_MACOS) && !defined(__FreeBSD__) +#if !defined(HAVE_MACOS) && !defined(__FreeBSD__) && !defined(__OpenBSD__) #include <features.h> #endif #include <stdint.h> diff --git a/cgpt/cgpt_common.c b/cgpt/cgpt_common.c index 426be3b8..c3edd0fc 100644 --- a/cgpt/cgpt_common.c +++ b/cgpt/cgpt_common.c @@ -9,7 +9,7 @@ #include <errno.h> #include <fcntl.h> #include <getopt.h> -#if !defined(HAVE_MACOS) && !defined(__FreeBSD__) +#if !defined(HAVE_MACOS) && !defined(__FreeBSD__) && !defined(__OpenBSD__) #include <linux/major.h> #include <mtd/mtd-user.h> #endif @@ -295,7 +295,7 @@ static int ObtainDriveSize(int fd, uint64_t* size, uint32_t* sector_bytes) { if (fstat(fd, &stat) == -1) { return -1; } -#if !defined(HAVE_MACOS) && !defined(__FreeBSD__) +#if !defined(HAVE_MACOS) && !defined(__FreeBSD__) && !defined(__OpenBSD__) if ((stat.st_mode & S_IFMT) != S_IFREG) { if (ioctl(fd, BLKGETSIZE64, size) < 0) { return -1; @@ -325,7 +325,7 @@ int DriveOpen(const char *drive_path, struct drive *drive, int mode, memset(drive, 0, sizeof(struct drive)); drive->fd = open(drive_path, mode | -#if !defined(HAVE_MACOS) && !defined(__FreeBSD__) +#if !defined(HAVE_MACOS) && !defined(__FreeBSD__) && !defined(__OpenBSD__) O_LARGEFILE | #endif O_NOFOLLOW); diff --git a/futility/cmd_vbutil_kernel.c b/futility/cmd_vbutil_kernel.c index 83a76f84..27cbb9bc 100644 --- a/futility/cmd_vbutil_kernel.c +++ b/futility/cmd_vbutil_kernel.c @@ -9,7 +9,7 @@ #include <fcntl.h> #include <getopt.h> #include <inttypes.h> /* For PRIu64 */ -#if !defined(HAVE_MACOS) && !defined(__FreeBSD__) +#if !defined(HAVE_MACOS) && !defined(__FreeBSD__) && !defined(__OpenBSD__) #include <linux/fs.h> /* For BLKGETSIZE64 */ #endif #include <stdarg.h> @@ -173,7 +173,7 @@ static uint8_t *ReadOldKPartFromFileOrDie(const char *filename, FATAL("Unable to stat %s: %s\n", filename, strerror(errno)); if (S_ISBLK(statbuf.st_mode)) { -#if !defined(HAVE_MACOS) && !defined(__FreeBSD__) +#if !defined(HAVE_MACOS) && !defined(__FreeBSD__) && !defined(__OpenBSD__) int fd = open(filename, O_RDONLY); if (fd >= 0) { ioctl(fd, BLKGETSIZE64, &file_size); diff --git a/futility/dump_kernel_config_lib.c b/futility/dump_kernel_config_lib.c index 4240e5ed..ff39c412 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__) +#if !defined (__FreeBSD__) && !defined(__OpenBSD__) #include <sys/sysmacros.h> #endif #include <sys/types.h> @@ -125,7 +125,7 @@ char *FindKernelConfig(const char *infile, uint64_t kernel_body_load_address) char *newstr = NULL; int fd = open(infile, O_RDONLY | O_CLOEXEC -#if !defined(__FreeBSD__) +#if !defined(__FreeBSD__) && !defined(__OpenBSD__) | O_LARGEFILE #endif ); diff --git a/futility/misc.c b/futility/misc.c index 0c8a0e71..f3e7748e 100644 --- a/futility/misc.c +++ b/futility/misc.c @@ -5,7 +5,7 @@ #include <assert.h> #include <errno.h> -#if !defined(HAVE_MACOS) && !defined(__FreeBSD__) +#if !defined(HAVE_MACOS) && !defined(__FreeBSD__) && !defined(__OpenBSD__) #include <linux/fs.h> /* For BLKGETSIZE64 */ #endif #include <stdarg.h> @@ -272,7 +272,7 @@ enum futil_file_err futil_map_file(int fd, int writeable, return FILE_ERR_STAT; } -#if !defined(HAVE_MACOS) && !defined(__FreeBSD__) +#if !defined(HAVE_MACOS) && !defined(__FreeBSD__) && !defined(__OpenBSD__) if (S_ISBLK(sb.st_mode)) ioctl(fd, BLKGETSIZE64, &sb.st_size); #endif diff --git a/futility/updater_archive.c b/futility/updater_archive.c index 218499e4..70d8bb33 100644 --- a/futility/updater_archive.c +++ b/futility/updater_archive.c @@ -8,6 +8,9 @@ #include <assert.h> #include <ctype.h> #include <errno.h> +#if defined(__OpenBSD__) +#include <sys/types.h> +#endif #include <fts.h> #include <string.h> #include <stdio.h> diff --git a/futility/updater_utils.c b/futility/updater_utils.c index 1c626bcd..70ed3962 100644 --- a/futility/updater_utils.c +++ b/futility/updater_utils.c @@ -10,7 +10,7 @@ #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> -#if defined (__FreeBSD__) +#if defined (__FreeBSD__) || defined(__OpenBSD__) #include <sys/wait.h> #endif diff --git a/host/arch/x86/lib/crossystem_arch.c b/host/arch/x86/lib/crossystem_arch.c index 6a8f5a26..e805e2a9 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__) +#if !defined(__FreeBSD__) && !defined(__OpenBSD__) #include <linux/nvram.h> #include <linux/version.h> #endif @@ -100,7 +100,7 @@ typedef struct { static void VbFixCmosChecksum(FILE* file) { -#if !defined(__FreeBSD__) +#if !defined(__FreeBSD__) && !defined(__OpenBSD__) int fd = fileno(file); ioctl(fd, NVRAM_SETCKS); #endif @@ -666,7 +666,7 @@ static int BraswellFindGpioChipOffset(unsigned *gpio_num, unsigned *offset, if (uname(&host) == 0) { if (sscanf(host.release, "%u.%u.", &maj, &min) == 2) { -#if !defined(__FreeBSD__) +#if !defined(__FreeBSD__) && !defined(__OpenBSD__) if (KERNEL_VERSION(maj, min, 0) >= KERNEL_VERSION(4, 16, 0) && *offset > 11) *offset += 3; |