summaryrefslogtreecommitdiff
path: root/Ports/dmidecode
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2021-01-29 14:05:06 +0200
committerAndreas Kling <kling@serenityos.org>2021-02-01 17:13:23 +0100
commita9d1ddb1a5c959e2ced29b6906228e695498bdb9 (patch)
tree1b94268e44d8b41961ad88cf5c97180626cae898 /Ports/dmidecode
parentc6fe1de30ea95cbcf24a9f708e7cb838e35a4e41 (diff)
downloadserenity-a9d1ddb1a5c959e2ced29b6906228e695498bdb9.zip
Ports: Add a port of dmidecode
Diffstat (limited to 'Ports/dmidecode')
-rwxr-xr-xPorts/dmidecode/package.sh24
-rw-r--r--Ports/dmidecode/patches/dmidecode.patch31
-rw-r--r--Ports/dmidecode/patches/dmiopt.patch22
3 files changed, 77 insertions, 0 deletions
diff --git a/Ports/dmidecode/package.sh b/Ports/dmidecode/package.sh
new file mode 100755
index 0000000000..d1542a214e
--- /dev/null
+++ b/Ports/dmidecode/package.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env -S bash ../.port_include.sh
+port=dmidecode
+version=3.1
+useconfigure=false
+prefix=
+files="https://download.savannah.gnu.org/releases/dmidecode/dmidecode-${version}.tar.xz dmidecode-${version}.tar.xz
+https://download.savannah.gnu.org/releases/dmidecode/dmidecode-${version}.tar.xz.sig dmidecode-${version}.tar.xz.sig
+https://ftp.gnu.org/gnu/gnu-keyring.gpg gnu-keyring.gpg"
+auth_type="sig"
+auth_import_key="90DFD6523C57373D81F63D19865688D038F02FC8"
+auth_opts="--keyring ./gnu-keyring.gpg dmidecode-${version}.tar.xz.sig"
+
+install() {
+ run make clean
+ run make CC=i686-pc-serenity-gcc
+}
+
+post_install() {
+ mkdir -p $SERENITY_ROOT/Build/Root/bin
+ run make install-bin DESTDIR=$SERENITY_ROOT/Build/Root/
+ ln -s /usr/local/sbin/dmidecode $SERENITY_ROOT/Build/Root/bin/dmidecode
+ ln -s /usr/local/sbin/biosdecode $SERENITY_ROOT/Build/Root/bin/biosdecode
+ ln -s /usr/local/sbin/vpddecode $SERENITY_ROOT/Build/Root/bin/vpddecode
+}
diff --git a/Ports/dmidecode/patches/dmidecode.patch b/Ports/dmidecode/patches/dmidecode.patch
new file mode 100644
index 0000000000..0fbec65a73
--- /dev/null
+++ b/Ports/dmidecode/patches/dmidecode.patch
@@ -0,0 +1,31 @@
+diff --git a/dmidecode.c b/dmidecode.c
+index 6559567..17573a9 100644
+--- a/dmidecode.c
++++ b/dmidecode.c
+@@ -80,7 +80,7 @@ static const char *bad_index = "<BAD INDEX>";
+ #define FLAG_NO_FILE_OFFSET (1 << 0)
+ #define FLAG_STOP_AT_EOT (1 << 1)
+
+-#define SYS_FIRMWARE_DIR "/sys/firmware/dmi/tables"
++#define SYS_FIRMWARE_DIR "/proc"
+ #define SYS_ENTRY_FILE SYS_FIRMWARE_DIR "/smbios_entry_point"
+ #define SYS_TABLE_FILE SYS_FIRMWARE_DIR "/DMI"
+
+@@ -5053,7 +5053,7 @@ int main(int argc, char * const argv[])
+ }
+
+ /*
+- * First try reading from sysfs tables. The entry point file could
++ * First try reading from procfs tables. The entry point file could
+ * contain one of several types of entry points, so read enough for
+ * the largest one, then determine what type it contains.
+ */
+@@ -5062,7 +5062,7 @@ int main(int argc, char * const argv[])
+ && (buf = read_file(0, &size, SYS_ENTRY_FILE)) != NULL)
+ {
+ if (!(opt.flags & FLAG_QUIET))
+- printf("Getting SMBIOS data from sysfs.\n");
++ printf("Getting SMBIOS data from procfs.\n");
+ if (size >= 24 && memcmp(buf, "_SM3_", 5) == 0)
+ {
+ if (smbios3_decode(buf, SYS_TABLE_FILE, FLAG_NO_FILE_OFFSET))
diff --git a/Ports/dmidecode/patches/dmiopt.patch b/Ports/dmidecode/patches/dmiopt.patch
new file mode 100644
index 0000000000..c91fff322b
--- /dev/null
+++ b/Ports/dmidecode/patches/dmiopt.patch
@@ -0,0 +1,22 @@
+diff --git a/dmiopt.c b/dmiopt.c
+index da42546..8d43119 100644
+--- a/dmiopt.c
++++ b/dmiopt.c
+@@ -259,7 +259,7 @@ int parse_command_line(int argc, char * const argv[])
+ { "dump-bin", required_argument, NULL, 'B' },
+ { "from-dump", required_argument, NULL, 'F' },
+ { "oem-string", required_argument, NULL, 'O' },
+- { "no-sysfs", no_argument, NULL, 'S' },
++ { "no-procfs", no_argument, NULL, 'S' },
+ { "version", no_argument, NULL, 'V' },
+ { NULL, 0, NULL, 0 }
+ };
+@@ -353,7 +353,7 @@ void print_help(void)
+ " -u, --dump Do not decode the entries\n"
+ " --dump-bin FILE Dump the DMI data to a binary file\n"
+ " --from-dump FILE Read the DMI data from a binary file\n"
+- " --no-sysfs Do not attempt to read DMI data from sysfs files\n"
++ " --no-procfs Do not attempt to read DMI data from procfs files\n"
+ " --oem-string N Only display the value of the given OEM string\n"
+ " -V, --version Display the version and exit\n";
+