Index: vendor/CMakeLists.txt
--- vendor/CMakeLists.txt.orig
+++ vendor/CMakeLists.txt
@@ -16,6 +16,17 @@ if(APPLE)
 	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_DARWIN_C_SOURCE -D__DARWIN_C_LEVEL=__DARWIN_C_FULL")
 endif()
 
+if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
+	set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_BSD_SOURCE")
+	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_BSD_SOURCE")
+	add_compile_definitions(off64_t=off_t lseek64=lseek ftruncate64=ftruncate
+		pread64=pread pwrite64=pwrite mmap64=mmap)
+	include_directories(BEFORE
+		${CMAKE_CURRENT_SOURCE_DIR}/compat
+		${CMAKE_CURRENT_SOURCE_DIR}/e2fsprogs/lib
+		${CMAKE_CURRENT_SOURCE_DIR}/e2fsprogs/lib/ext2fs)
+endif()
+
 # Different versions of clang require a different set of flags for -ftrivial-auto-var-init
 # Simplify this contruct once old clang version support is dropped
 include(CheckCXXCompilerFlag)
@@ -105,7 +116,9 @@ include(CMakeLists.libandroidfw.txt)
 include(CMakeLists.adb.txt)
 include(CMakeLists.sparse.txt)
 include(CMakeLists.fastboot.txt)
+if(NOT CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
 include(CMakeLists.f2fstools.txt)
+endif()
 include(CMakeLists.mke2fs.txt)
 include(CMakeLists.partition.txt)
 include(CMakeLists.mkbootimg.txt)
@@ -124,13 +137,15 @@ install(TARGETS
 	lpflash
 	lpmake
 	lpunpack
-	make_f2fs
-	sload_f2fs
 	simg2img
 	ext2simg
 	DESTINATION bin)
 
-if(NOT APPLE)
+if(NOT CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
+	install(TARGETS make_f2fs sload_f2fs DESTINATION bin)
+endif()
+
+if(NOT APPLE AND NOT CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
 	install(TARGETS
 		e2fsdroid
 		DESTINATION bin)
