summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIdwer Vollering <vidwer@gmail.com>2021-05-10 21:15:45 +0200
committerCommit Bot <commit-bot@chromium.org>2021-05-20 10:31:43 +0000
commitb384db34664466386016b03615fe1387aa2d53c7 (patch)
tree11192e23da45b41982aecb45ea74f274f6d697a0
parent6bdfa02d7dccfbc94871bf50f2282e2081b8559c (diff)
downloadvboot-stabilize-13982.88.B.tar.gz
This was done on OpenBSD 6.8. Required packages are: e2fsprogs and gcc. Change-Id: I86ec080e1ddb90053d81f1edd17d3406e7e737c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2903352 Reviewed-by: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
-rw-r--r--Makefile8
-rw-r--r--cgpt/cgpt.h2
-rw-r--r--cgpt/cgpt_common.c6
-rw-r--r--futility/cmd_vbutil_kernel.c4
-rw-r--r--futility/dump_kernel_config_lib.c4
-rw-r--r--futility/misc.c4
-rw-r--r--futility/updater_archive.c3
-rw-r--r--futility/updater_utils.c2
-rw-r--r--host/arch/x86/lib/crossystem_arch.c6
9 files changed, 25 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index acaad3e3..ab8f7912 100644
--- a/Makefile
+++ b/Makefile
@@ -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;