flashrom tweaks:

- allow building on all arches (without libpci support, it can
programme some devices via USB flashers)

- remove dmidecode dependency, flashrom moved to using an internal
DMI/SMBIOS decoder by default in 0.9.8.
This commit is contained in:
sthen 2020-11-20 12:48:58 +00:00
parent add9e763bb
commit 0f47388f5a
4 changed files with 68 additions and 12 deletions

View File

@ -1,6 +1,4 @@
# $OpenBSD: Makefile,v 1.17 2020/07/11 22:54:39 sthen Exp $
ONLY_FOR_ARCHS= i386 amd64
# $OpenBSD: Makefile,v 1.18 2020/11/20 12:48:58 sthen Exp $
COMMENT= flash ROM programmer for BIOS etc
@ -8,7 +6,7 @@ V= 1.2
DISTNAME= flashrom-v${V}
PKGNAME= flashrom-${V}
EXTRACT_SUFX= .tar.bz2
REVISION= 0
REVISION= 1
CATEGORIES= sysutils
@ -23,22 +21,28 @@ WANTLIB= c ftdi1 usb-1.0 z
MASTER_SITES= https://download.flashrom.org/releases/
# pciutils' libpci.a is linked statically; a patched version is required.
BUILD_DEPENDS= sysutils/pciutils:patch
RUN_DEPENDS= sysutils/dmidecode
LIB_DEPENDS= devel/libftdi1 \
devel/libusb1
MAKE_FLAGS= LDFLAGS="-L./pciutils/lib" WARNERROR=no
MAKE_FLAGS+= WARNERROR=no
FAKE_FLAGS= PREFIX="${TRUEPREFIX}" MANDIR="${TRUEPREFIX}/man"
PATCHORIG= .orig.port
USE_GMAKE= Yes
NO_TEST= Yes
.if ${MACHINE_ARCH} == amd64 || ${MACHINE_ARCH} == i386
# a patched pciutils libpci.a is needed (see patches/patchpci-*)
BUILD_DEPENDS= sysutils/pciutils:patch
MAKE_FLAGS+= LDFLAGS="-L./pciutils/lib"
PATCH_LIST= patchpci-* patch-*
pre-patch:
mv ${WRKDIR}/sysutils/pciutils/pciutils-* ${WRKSRC}/pciutils
do-configure:
${MAKE_PROGRAM} -C ${WRKSRC}/pciutils CC="${CC}" OPT="${CFLAGS}"
.else
MAKE_FLAGS+= CONFIG_ENABLE_LIBPCI_PROGRAMMERS=no
.endif
.include <bsd.port.mk>

View File

@ -1,12 +1,35 @@
$OpenBSD: patch-Makefile,v 1.5 2020/06/13 14:04:53 kn Exp $
$OpenBSD: patch-Makefile,v 1.6 2020/11/20 12:48:58 sthen Exp $
use patched pciutils.
- fix arch/endian detection, machine/endian.h includes some asm that
isn't stripped by upstream's pipeline
fix clock_gettime detection.
- OpenBSD clock_gettime is in libc not librt
- use patched pciutils
Index: Makefile
--- Makefile.orig
+++ Makefile
@@ -106,7 +106,7 @@ endif
# IMPORTANT: The following line must be placed before TARGET_OS is ever used
# (of course), but should come after any lines setting CC because the line
# below uses CC itself.
-override TARGET_OS := $(strip $(call debug_shell,$(CC) $(CPPFLAGS) -E os.h 2>/dev/null | grep -v '^\#' | grep '"' | cut -f 2 -d'"'))
+override TARGET_OS := $(strip $(call debug_shell,$(CC) $(CPPFLAGS) -E os.h 2>/dev/null | grep -v '^\#' | grep '"' | cut -f 2 -d'"' | tail -1))
ifeq ($(TARGET_OS), Darwin)
override CPPFLAGS += -I/opt/local/include -I/usr/local/include
@@ -421,8 +421,8 @@ endif
# IMPORTANT: The following line must be placed before ARCH is ever used
# (of course), but should come after any lines setting CC because the line
# below uses CC itself.
-override ARCH := $(strip $(call debug_shell,$(CC) $(CPPFLAGS) -E archtest.c 2>/dev/null | grep -v '^\#' | grep '"' | cut -f 2 -d'"'))
-override ENDIAN := $(strip $(call debug_shell,$(CC) $(CPPFLAGS) -E endiantest.c 2>/dev/null | grep -v '^\#'))
+override ARCH := $(strip $(call debug_shell,$(CC) $(CPPFLAGS) -E archtest.c 2>/dev/null | grep -v '^\#' | grep '"' | cut -f 2 -d'"' | tail -1))
+override ENDIAN := $(strip $(call debug_shell,$(CC) $(CPPFLAGS) -E endiantest.c 2>/dev/null | grep -v '^\#' | tail -1))
# Disable the internal programmer on unsupported architectures (everything but x86 and mipsel)
ifneq ($(ARCH)-little, $(filter $(ARCH),x86 mips)-$(ENDIAN))
@@ -1120,7 +1120,6 @@ FEATURE_CFLAGS += $(call debug_shell,grep -q "UTSNAME
FEATURE_LIBS += $(call debug_shell,grep -q "NEEDLIBZ := yes" .libdeps && printf "%s" "-lz")

View File

@ -0,0 +1,29 @@
$OpenBSD: patch-platform_h,v 1.1 2020/11/20 12:48:58 sthen Exp $
fix generic endian detection for openbsd (aarch64 falls through to
the generic as we don't define __ARMEL__ or __ARMEB__).
Index: platform.h
--- platform.h.orig
+++ platform.h
@@ -141,11 +141,17 @@
#if !IS_WINDOWS
#include <sys/param.h>
-#if defined (__BYTE_ORDER)
+#if defined (__BYTE_ORDER__)
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+#define __FLASHROM_LITTLE_ENDIAN__ 1
+#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+#define __FLASHROM_BIG_ENDIAN__ 1
+#endif
+#elif defined (__BYTE_ORDER)
#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define __FLASHROM_LITTLE_ENDIAN__
+#define __FLASHROM_LITTLE_ENDIAN__ 1
#elif __BYTE_ORDER == __BIG_ENDIAN
-#define __FLASHROM_BIG_ENDIAN__
+#define __FLASHROM_BIG_ENDIAN__ 1
#else
#error Unknown byte order!
#endif

View File

@ -1,4 +1,4 @@
$OpenBSD: patch-pciutils_lib_obsd-device_c,v 1.1.1.1 2016/06/01 16:42:23 sthen Exp $
$OpenBSD: patchpci-pciutils_lib_obsd-device_c,v 1.1 2020/11/20 12:48:58 sthen Exp $
OpenBSD's /dev/pci only permits aligned 32 bit writes.
Emulate smaller writes by doing read/modify/write.