pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/sysutils/dmidecode optionally use /dev/smbios on all n...
details: https://anonhg.NetBSD.org/pkgsrc/rev/e2873bdc66e5
branches: trunk
changeset: 388932:e2873bdc66e5
user: mrg <mrg%pkgsrc.org@localhost>
date: Mon Nov 28 04:26:08 2022 +0000
description:
optionally use /dev/smbios on all netbsd platforms, if machdep.smbios
exists and is non-zero.
this makes dmidecode by default work on x86 with INSECURE.
bump pkg version.
diffstat:
sysutils/dmidecode/Makefile | 3 +-
sysutils/dmidecode/distinfo | 9 ++++-
sysutils/dmidecode/patches/patch-biosdecode.c | 21 ++++++++++++
sysutils/dmidecode/patches/patch-config.h | 24 ++++++++++---
sysutils/dmidecode/patches/patch-dmiopt.c | 22 +++++++++++++
sysutils/dmidecode/patches/patch-ownership.c | 20 ++++++++++++
sysutils/dmidecode/patches/patch-util.c | 45 +++++++++++++++++++++++++++
sysutils/dmidecode/patches/patch-vpdopt.c | 20 ++++++++++++
8 files changed, 155 insertions(+), 9 deletions(-)
diffs (220 lines):
diff -r c1b755300b65 -r e2873bdc66e5 sysutils/dmidecode/Makefile
--- a/sysutils/dmidecode/Makefile Mon Nov 28 02:15:03 2022 +0000
+++ b/sysutils/dmidecode/Makefile Mon Nov 28 04:26:08 2022 +0000
@@ -1,10 +1,11 @@
-# $NetBSD: Makefile,v 1.38 2022/10/11 09:12:18 msaitoh Exp $
+# $NetBSD: Makefile,v 1.39 2022/11/28 04:26:08 mrg Exp $
#
DISTNAME= dmidecode-3.4
EXTRACT_SUFX= .tar.xz
CATEGORIES= sysutils
MASTER_SITES= https://download.savannah.gnu.org/releases/dmidecode/
+PKGREVISION= 1
MAINTAINER= msaitoh%NetBSD.org@localhost
HOMEPAGE= https://www.nongnu.org/dmidecode/
diff -r c1b755300b65 -r e2873bdc66e5 sysutils/dmidecode/distinfo
--- a/sysutils/dmidecode/distinfo Mon Nov 28 02:15:03 2022 +0000
+++ b/sysutils/dmidecode/distinfo Mon Nov 28 04:26:08 2022 +0000
@@ -1,8 +1,13 @@
-$NetBSD: distinfo,v 1.34 2022/10/11 09:12:18 msaitoh Exp $
+$NetBSD: distinfo,v 1.35 2022/11/28 04:26:08 mrg Exp $
BLAKE2s (dmidecode-3.4.tar.xz) = 4c77dc57ab99615165128047f803e6bf0844e7f97396a6754da4780d39a620c3
SHA512 (dmidecode-3.4.tar.xz) = 62990b6159e5a7c8688d37e44957e7948391d2c6afeabaa4514ba9dad2d08b020297676e2dbbfcb6471efc6fb6f3682750422931a953f78f358bb3dd3745e95b
Size (dmidecode-3.4.tar.xz) = 61420 bytes
SHA1 (patch-aa) = 4ffeddeb647d07d8d712bab9983c1530e59e6f37
-SHA1 (patch-config.h) = 6ca6459a79ca207ec8b59f0532b2c1db841dc05c
+SHA1 (patch-biosdecode.c) = 76366037a20d7bed2f90771343fbe777ac1e1059
+SHA1 (patch-config.h) = d06c1d45b60e0c687a39b76b4beb007ffa1b4ee4
SHA1 (patch-dmidecode.c) = fe63079df824753a2aca9b9d0371523a36bb08ce
+SHA1 (patch-dmiopt.c) = dd4b990fdf9b5b417459a0a2ddb2e97589605377
+SHA1 (patch-ownership.c) = 4417df76809b187be5c2c3ef691cba2285278df2
+SHA1 (patch-util.c) = d87f60f232e3facbd9aa8fae2e2a2be6bfe4ade5
+SHA1 (patch-vpdopt.c) = 1237207adb8db7aae294153f1bdc27a4e7941737
diff -r c1b755300b65 -r e2873bdc66e5 sysutils/dmidecode/patches/patch-biosdecode.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/dmidecode/patches/patch-biosdecode.c Mon Nov 28 04:26:08 2022 +0000
@@ -0,0 +1,21 @@
+$NetBSD: patch-biosdecode.c,v 1.1 2022/11/28 04:26:08 mrg Exp $
+
+* Use /dev/smbios instead of /dev/mem on NetBSD if available.
+
+--- biosdecode.c.orig 2022-06-27 08:06:32.000000000 -0700
++++ biosdecode.c 2022-11-27 14:28:45.654835935 -0800
+@@ -645,12 +645,12 @@
+ static const char *help =
+ "Usage: biosdecode [OPTIONS]\n"
+ "Options are:\n"
+- " -d, --dev-mem FILE Read memory from device FILE (default: " DEFAULT_MEM_DEV ")\n"
++ " -d, --dev-mem FILE Read memory from device FILE (default: %s)\n"
+ " --pir full Decode the details of the PCI IRQ routing table\n"
+ " -h, --help Display this help text and exit\n"
+ " -V, --version Display the version and exit\n";
+
+- printf("%s", help);
++ printf(help, DEFAULT_MEM_DEV);
+ }
+
+ int main(int argc, char * const argv[])
diff -r c1b755300b65 -r e2873bdc66e5 sysutils/dmidecode/patches/patch-config.h
--- a/sysutils/dmidecode/patches/patch-config.h Mon Nov 28 02:15:03 2022 +0000
+++ b/sysutils/dmidecode/patches/patch-config.h Mon Nov 28 04:26:08 2022 +0000
@@ -1,15 +1,27 @@
-$NetBSD: patch-config.h,v 1.1 2021/07/24 13:23:52 jmcneill Exp $
+$NetBSD: patch-config.h,v 1.2 2022/11/28 04:26:08 mrg Exp $
-* Use /dev/smbios instead of /dev/mem on NetBSD aarch64
+* Use /dev/smbios instead of /dev/mem on NetBSD if available.
---- config.h.orig 2020-10-14 12:51:11.000000000 +0000
-+++ config.h
+--- config.h.orig 2022-06-27 08:06:32.000000000 -0700
++++ config.h 2022-11-27 14:30:20.312604489 -0800
@@ -8,6 +8,8 @@
/* Default memory device file */
#if defined(__BEOS__) || defined(__HAIKU__)
#define DEFAULT_MEM_DEV "/dev/misc/mem"
-+#elif defined(__NetBSD__) && defined(__aarch64__)
-+#define DEFAULT_MEM_DEV "/dev/smbios"
++#elif defined(__NetBSD__)
++#define USE_DEFAULT_MEM_DEV_FUNC 1
#else
#ifdef __sun
#define DEFAULT_MEM_DEV "/dev/xsvc"
+@@ -16,6 +18,11 @@
+ #endif
+ #endif
+
++#ifdef USE_DEFAULT_MEM_DEV_FUNC
++const char *default_mem_dev(void);
++#define DEFAULT_MEM_DEV default_mem_dev()
++#endif
++
+ /* Use mmap or not */
+ #ifndef __BEOS__
+ #define USE_MMAP
diff -r c1b755300b65 -r e2873bdc66e5 sysutils/dmidecode/patches/patch-dmiopt.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/dmidecode/patches/patch-dmiopt.c Mon Nov 28 04:26:08 2022 +0000
@@ -0,0 +1,22 @@
+$NetBSD: patch-dmiopt.c,v 1.1 2022/11/28 04:26:08 mrg Exp $
+
+* Use /dev/smbios instead of /dev/mem on NetBSD if available.
+
+--- dmiopt.c.orig 2022-06-27 08:06:32.000000000 -0700
++++ dmiopt.c 2022-11-27 14:28:45.656425673 -0800
+@@ -368,7 +368,7 @@
+ static const char *help =
+ "Usage: dmidecode [OPTIONS]\n"
+ "Options are:\n"
+- " -d, --dev-mem FILE Read memory from device FILE (default: " DEFAULT_MEM_DEV ")\n"
++ " -d, --dev-mem FILE Read memory from device FILE (default: %s)\n"
+ " -h, --help Display this help text and exit\n"
+ " -q, --quiet Less verbose output\n"
+ " -s, --string KEYWORD Only display the value of the given DMI string\n"
+@@ -381,5 +381,5 @@
+ " --oem-string N Only display the value of the given OEM string\n"
+ " -V, --version Display the version and exit\n";
+
+- printf("%s", help);
++ printf(help, DEFAULT_MEM_DEV);
+ }
diff -r c1b755300b65 -r e2873bdc66e5 sysutils/dmidecode/patches/patch-ownership.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/dmidecode/patches/patch-ownership.c Mon Nov 28 04:26:08 2022 +0000
@@ -0,0 +1,20 @@
+$NetBSD: patch-ownership.c,v 1.1 2022/11/28 04:26:08 mrg Exp $
+
+* Use /dev/smbios instead of /dev/mem on NetBSD if available.
+
+--- ownership.c.orig 2022-06-27 08:06:32.000000000 -0700
++++ ownership.c 2022-11-27 14:28:45.655641133 -0800
+@@ -146,11 +146,11 @@
+ static const char *help =
+ "Usage: ownership [OPTIONS]\n"
+ "Options are:\n"
+- " -d, --dev-mem FILE Read memory from device FILE (default: " DEFAULT_MEM_DEV ")\n"
++ " -d, --dev-mem FILE Read memory from device FILE (default: %s)\n"
+ " -h, --help Display this help text and exit\n"
+ " -V, --version Display the version and exit\n";
+
+- printf("%s", help);
++ printf(help, DEFAULT_MEM_DEV);
+ }
+
+ int main(int argc, char * const argv[])
diff -r c1b755300b65 -r e2873bdc66e5 sysutils/dmidecode/patches/patch-util.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/dmidecode/patches/patch-util.c Mon Nov 28 04:26:08 2022 +0000
@@ -0,0 +1,45 @@
+$NetBSD: patch-util.c,v 1.1 2022/11/28 04:26:08 mrg Exp $
+
+* Use /dev/smbios instead of /dev/mem on NetBSD if available.
+
+--- util.c.orig 2022-06-27 08:06:32.000000000 -0700
++++ util.c 2022-11-27 14:28:45.657997798 -0800
+@@ -36,6 +36,9 @@
+ #define MAP_FAILED ((void *) -1)
+ #endif /* !MAP_FAILED */
+ #endif /* USE MMAP */
++#ifdef __NetBSD__
++#include <sys/sysctl.h>
++#endif
+
+ #include <stdio.h>
+ #include <stdlib.h>
+@@ -314,3 +317,28 @@
+
+ return res;
+ }
++
++#ifdef USE_DEFAULT_MEM_DEV_FUNC
++const char *
++default_mem_dev(void)
++{
++#ifdef __NetBSD__
++ uint64_t addr;
++ size_t addrlen = sizeof addr;
++ int ret;
++
++ /*
++ * If machdep.smbios exists and has a non-zero value, /dev/smbios
++ * should work. Otherwise fallback to /dev/mem.
++ */
++ ret = sysctlbyname("machdep.smbios", &addr, &addrlen, NULL, 0);
++ if (ret == 0 && addr != 0) {
++ return "/dev/smbios";
++ } else {
++ return "/dev/mem";
++ }
++#else
++# error "not implemented."
++#endif
++}
++#endif
diff -r c1b755300b65 -r e2873bdc66e5 sysutils/dmidecode/patches/patch-vpdopt.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/dmidecode/patches/patch-vpdopt.c Mon Nov 28 04:26:08 2022 +0000
@@ -0,0 +1,20 @@
+$NetBSD: patch-vpdopt.c,v 1.1 2022/11/28 04:26:08 mrg Exp $
+
+* Use /dev/smbios instead of /dev/mem on NetBSD if available.
+
+--- vpdopt.c.orig 2022-06-27 08:06:32.000000000 -0700
++++ vpdopt.c 2022-11-27 14:28:45.657210082 -0800
+@@ -147,11 +147,11 @@
+ static const char *help =
+ "Usage: vpddecode [OPTIONS]\n"
+ "Options are:\n"
+- " -d, --dev-mem FILE Read memory from device FILE (default: " DEFAULT_MEM_DEV ")\n"
++ " -d, --dev-mem FILE Read memory from device FILE (default: %s)\n"
+ " -h, --help Display this help text and exit\n"
+ " -s, --string KEYWORD Only display the value of the given VPD string\n"
+ " -u, --dump Do not decode the VPD records\n"
+ " -V, --version Display the version and exit\n";
+
+- printf("%s", help);
++ printf(help, DEFAULT_MEM_DEV);
+ }
Home |
Main Index |
Thread Index |
Old Index