SHA256
1
0
forked from pool/dmidecode
Dominique Leuenberger 2020-04-23 16:29:14 +00:00 committed by Git OBS Bridge
commit 408c090673
6 changed files with 164 additions and 3 deletions

View File

@ -0,0 +1,51 @@
From: Jean Delvare <jdelvare@suse.de>
Date: Fri, 17 Apr 2020 17:14:15 +0200
Subject: Allow overriding build settings from the environment
Git-commit: 5b3c8e9950262fc941bb5b3b3a1275720d47d62d
Patch-mainline: yes
Let packagers pass their own CC, CFLAGS and LDFLAGS settings. The
settings which are specific to dmidecode are appended later so that
they are applied no matter what.
This should fix bug #55805:
https://savannah.nongnu.org/bugs/?55805
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
Makefile | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
--- a/Makefile
+++ b/Makefile
@@ -12,8 +12,13 @@
# (at your option) any later version.
#
-CC = gcc
-CFLAGS = -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual \
+CC ?= gcc
+# Base CFLAGS can be overridden by environment
+CFLAGS ?= -O2
+# When debugging, disable -O2 and enable -g
+#CFLAGS ?= -g
+
+CFLAGS += -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual \
-Wcast-align -Wwrite-strings -Wmissing-prototypes -Winline -Wundef
# Let lseek and mmap support 64-bit wide offsets
@@ -22,12 +27,8 @@ CFLAGS += -D_FILE_OFFSET_BITS=64
#CFLAGS += -DBIGENDIAN
#CFLAGS += -DALIGNMENT_WORKAROUND
-# When debugging, disable -O2 and enable -g.
-CFLAGS += -O2
-#CFLAGS += -g
-
-# Pass linker flags here
-LDFLAGS =
+# Pass linker flags here (can be set from environment too)
+LDFLAGS ?=
DESTDIR =
prefix = /usr/local

View File

@ -0,0 +1,33 @@
From: Jean Delvare <jdelvare@suse.de>
Date: Mon, 23 Mar 2020 16:47:23 +0100
Subject: dmidecode: Don't choke on invalid processor voltage
Git-commit: 5bb7eb173b72256f70c6b3f3916d7a444be93340
Patch-mainline: yes
If the processor voltage encoding has some of the reserved bits set
and none of the proper bits set, print it as "Unknown" instead of an
empty field.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
dmidecode.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -1186,13 +1186,13 @@ static void dmi_processor_voltage(u8 cod
if (code & 0x80)
printf(" %.1f V", (float)(code & 0x7f) / 10);
+ else if ((code & 0x07) == 0x00)
+ printf(" Unknown");
else
{
for (i = 0; i <= 2; i++)
if (code & (1 << i))
printf(" %s", voltage[i]);
- if (code == 0x00)
- printf(" Unknown");
}
}

View File

@ -0,0 +1,24 @@
From: Jean Delvare <jdelvare@suse.de>
Date: Mon, 23 Mar 2020 16:47:30 +0100
Subject: dmidecode: Fix the alignment of type 25 name
Git-commit: 557c3c373a9992d45d4358a6a2ccf53b03276f39
Patch-mainline: yes
No tabulation needed before DMI structure names.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
dmidecode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -4629,7 +4629,7 @@ static void dmi_decode(const struct dmi_
break;
case 25: /* 7.26 System Power Controls */
- printf("\tSystem Power Controls\n");
+ printf("System Power Controls\n");
if (h->length < 0x09) break;
printf("\tNext Scheduled Power-on:");
dmi_power_controls_power_on(data + 0x04);

View File

@ -0,0 +1,26 @@
From: Jean Delvare <jdelvare@suse.de>
Date: Mon, 23 Mar 2020 16:47:20 +0100
Subject: dmidecode: Print type 33 name unconditionally
Git-commit: 65438a7ec0f4cddccf810136da6f280bd148af71
Patch-mainline: yes
Even if a type 33 structure is too short, we can still display its
type name as we do for all other structure types.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
dmidecode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -4786,8 +4786,8 @@ static void dmi_decode(const struct dmi_
break;
case 33: /* 7.34 64-bit Memory Error Information */
- if (h->length < 0x1F) break;
printf("64-bit Memory Error Information\n");
+ if (h->length < 0x1F) break;
printf("\tType: %s\n",
dmi_memory_error_type(data[0x04]));
printf("\tGranularity: %s\n",

View File

@ -1,3 +1,22 @@
-------------------------------------------------------------------
Tue Apr 21 08:17:46 UTC 2020 - Jean Delvare <jdelvare@suse.de>
3 recommended fixes from upstream:
- dmidecode-print-type-33-name-unconditionally.patch: Print type 33
name unconditionally.
- dmidecode-dont-choke-on-invalid-processor-voltage.patch: Don't
choke on invalid processor voltage.
- dmidecode-fix-the-alignment-of-type-25-name.patch: Fix the
alignment of type 25 name.
Build fix:
- dmidecode-allow-overriding-build-settings-from-env.patch: Fix the
build system so that the compilation flags passed by OBS are
added to the ones dmidecode needs, instead of overriding them
entirely.
- dmidecode.spec: Pass the CFLAGS through the environment, instead
of as a parameter.
-------------------------------------------------------------------
Wed Oct 23 13:31:26 UTC 2019 - Jean Delvare <jdelvare@suse.de>

View File

@ -1,7 +1,7 @@
#
# spec file for package dmidecode
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -22,7 +22,7 @@ Release: 0
Summary: DMI table decoder
License: GPL-2.0-or-later
Group: System/Console
Url: http://www.nongnu.org/dmidecode/
URL: http://www.nongnu.org/dmidecode/
Source0: http://download.savannah.gnu.org/releases/%{name}/%{name}-%{version}.tar.xz
Source1: http://download.savannah.gnu.org/releases/%{name}/%{name}-%{version}.tar.xz.sig
# https://savannah.nongnu.org/project/memberlist-gpgkeys.php?group=dmidecode
@ -33,6 +33,10 @@ Patch3: dmidecode-only-scan-dev-mem-for-entry-point-on-x86.patch
Patch4: dmidecode-fix-formatting-of-tpm-table-output.patch
Patch5: dmidecode-fix-system-slot-information-for-pcie-ssd.patch
Patch6: dmidecode-add-enumerated-values-from-smbios-3.3.0.patch
Patch7: dmidecode-print-type-33-name-unconditionally.patch
Patch8: dmidecode-dont-choke-on-invalid-processor-voltage.patch
Patch9: dmidecode-fix-the-alignment-of-type-25-name.patch
Patch10: dmidecode-allow-overriding-build-settings-from-env.patch
Provides: pmtools:%{_sbindir}/dmidecode
Obsoletes: pmtools < 20071117
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -61,9 +65,13 @@ the BIOS told it to.
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%build
make CFLAGS="%{optflags}" %{?_smp_mflags}
CFLAGS="%{optflags}" make %{?_smp_mflags}
%install
install -dm 755 %{buildroot}%{_sbindir}