diff options
| author | mrg <mrg@pkgsrc.org> | 2022-11-28 04:26:08 +0000 |
|---|---|---|
| committer | mrg <mrg@pkgsrc.org> | 2022-11-28 04:26:08 +0000 |
| commit | 191ba493f0a5129be418f9dc788dd2d8aea76d61 (patch) | |
| tree | 982bd4e280561cf8eed2fe4f1afb2f992e2ff7f8 /sysutils | |
| parent | 5745051a95678131250acc42b7687b9295fdcd24 (diff) | |
| download | pkgsrc-191ba493f0a5129be418f9dc788dd2d8aea76d61.tar.gz | |
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 (limited to 'sysutils')
| -rw-r--r-- | sysutils/dmidecode/Makefile | 3 | ||||
| -rw-r--r-- | sysutils/dmidecode/distinfo | 9 | ||||
| -rw-r--r-- | sysutils/dmidecode/patches/patch-biosdecode.c | 21 | ||||
| -rw-r--r-- | sysutils/dmidecode/patches/patch-config.h | 24 | ||||
| -rw-r--r-- | sysutils/dmidecode/patches/patch-dmiopt.c | 22 | ||||
| -rw-r--r-- | sysutils/dmidecode/patches/patch-ownership.c | 20 | ||||
| -rw-r--r-- | sysutils/dmidecode/patches/patch-util.c | 45 | ||||
| -rw-r--r-- | sysutils/dmidecode/patches/patch-vpdopt.c | 20 |
8 files changed, 155 insertions, 9 deletions
diff --git a/sysutils/dmidecode/Makefile b/sysutils/dmidecode/Makefile index 82a24137ffe..fa7dfced8fb 100644 --- a/sysutils/dmidecode/Makefile +++ b/sysutils/dmidecode/Makefile @@ -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 HOMEPAGE= https://www.nongnu.org/dmidecode/ diff --git a/sysutils/dmidecode/distinfo b/sysutils/dmidecode/distinfo index ab055cbf316..603f8b6fdad 100644 --- a/sysutils/dmidecode/distinfo +++ b/sysutils/dmidecode/distinfo @@ -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 --git a/sysutils/dmidecode/patches/patch-biosdecode.c b/sysutils/dmidecode/patches/patch-biosdecode.c new file mode 100644 index 00000000000..697f97eca06 --- /dev/null +++ b/sysutils/dmidecode/patches/patch-biosdecode.c @@ -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 --git a/sysutils/dmidecode/patches/patch-config.h b/sysutils/dmidecode/patches/patch-config.h index 15d61aa107b..9a2959f6514 100644 --- a/sysutils/dmidecode/patches/patch-config.h +++ b/sysutils/dmidecode/patches/patch-config.h @@ -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 --git a/sysutils/dmidecode/patches/patch-dmiopt.c b/sysutils/dmidecode/patches/patch-dmiopt.c new file mode 100644 index 00000000000..c3a694c4dc3 --- /dev/null +++ b/sysutils/dmidecode/patches/patch-dmiopt.c @@ -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 --git a/sysutils/dmidecode/patches/patch-ownership.c b/sysutils/dmidecode/patches/patch-ownership.c new file mode 100644 index 00000000000..19b8b8a621a --- /dev/null +++ b/sysutils/dmidecode/patches/patch-ownership.c @@ -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 --git a/sysutils/dmidecode/patches/patch-util.c b/sysutils/dmidecode/patches/patch-util.c new file mode 100644 index 00000000000..5f5662779f1 --- /dev/null +++ b/sysutils/dmidecode/patches/patch-util.c @@ -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 --git a/sysutils/dmidecode/patches/patch-vpdopt.c b/sysutils/dmidecode/patches/patch-vpdopt.c new file mode 100644 index 00000000000..648b7016a8a --- /dev/null +++ b/sysutils/dmidecode/patches/patch-vpdopt.c @@ -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); + } |
